当前位置:网站首页>把 Oracle 数据库从 Windows 系统迁移到 Linux Oracle Rac 集群环境(3)—— 把数据库设置为归档模式
把 Oracle 数据库从 Windows 系统迁移到 Linux Oracle Rac 集群环境(3)—— 把数据库设置为归档模式
2022-06-24 22:55:00 【睿思达DBA_WGX】
把 Oracle 数据库从 Windows 系统迁移到 Linux Oracle Rac 集群环境(3)—— 把数据库设置为归档模式
一、查看数据库是否为归档模式
-- 节点1:非归档模式
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 15
Current log sequence 17
-- 节点2:非归档模式
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 1
Current log sequence 2
二、打开归档模式
在 oracle rac 集群环境下,要设置一个节点为归档模式或非归档模式,必须关闭其他节点。
1、设置节点 rac1 为归档模式
(1)关闭节点2的实例
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
2、在节点 rac1 上执行如下操作
(1)正常停库,然后启动数据库到 mount 状态
-- 关闭实例
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
-- 启动数据库到 mount 状态
SQL> startup mount
ORACLE instance started.
Total System Global Area 638853120 bytes
Fixed Size 2255952 bytes
Variable Size 507511728 bytes
Database Buffers 121634816 bytes
Redo Buffers 7450624 bytes
Database mounted.
(2)使用 alter database 命令打开归档模式
SQL> alter database archivelog;
Database altered.
(3)关闭节点1的实例
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
3、在节点 rac2 上执行如下操作
(1)然后启动数据库到 mount 状态
-- 节点 rac2 处于关闭状态
-- 启动数据库到 mount 状态
SQL> startup mount
ORACLE instance started.
Total System Global Area 638853120 bytes
Fixed Size 2255952 bytes
Variable Size 465568688 bytes
Database Buffers 163577856 bytes
Redo Buffers 7450624 bytes
Database mounted.
(2)使用 alter database 命令打开归档模式
SQL> alter database archivelog;
Database altered.
(3)关闭节点1的实例归档模式
SQL> alter database archivelog;
Database altered.
4、打开数据库,查看归档状态
-- 节点1
SQL> startup
ORACLE instance started.
Total System Global Area 638853120 bytes
Fixed Size 2255952 bytes
Variable Size 507511728 bytes
Database Buffers 121634816 bytes
Redo Buffers 7450624 bytes
Database mounted.
Database opened.
-- 查看归档状态
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 1
Next log sequence to archive 2
Current log sequence 2
-- 节点2
SQL> alter database open;
Database altered.
-- 查看归档状态
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 15
Next log sequence to archive 17
Current log sequence 17
三、设置归档的位置
当数据库处于归档模式时,进行日志切换时后台进程将自动生成归档日志。
1、查看归档进程数
SQL> show parameter LOG_ARCHIVE_MAX_PROCESSES
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_max_processes integer 4
2、查看归档文件
可知当前归档位置为:/u01/app/oracle/flash_recovery_area/HISDB/archivelog
SQL> select sequence#, name from v$archived_log;
SEQUENCE# NAME
--------------------------------------------------------------------------------
17
/u01/app/oracle/flash_recovery_area/HISDB/archivelog/2022_06_17/o1_mf_1_17_kbr52
8s8_.arc
18
/u01/app/oracle/flash_recovery_area/HISDB/archivelog/2022_06_17/o1_mf_1_18_kbr52
d2g_.arc
19
/u01/app/oracle/flash_recovery_area/HISDB/archivelog/2022_06_17/o1_mf_1_19_kbr52
g87_.arc
2
/u01/app/oracle/flash_recovery_area/HISDB/archivelog/2022_06_17/o1_mf_2_2_kbr52d
rp_.arc
20
/u01/app/oracle/flash_recovery_area/HISDB/archivelog/2022_06_17/o1_mf_1_20_kbr52
hdo_.arc
3、修改归档日志的位置为:+BAK/hisdb/archivelog
修改 log_archive_dest_1 参数指向定义的归档位置:
SQL> alter system set log_archive_dest_1 = 'location=+BAK' scope = both sid='*';
System altered.
-- 对比log_archive_dest 和log_archive_dest_1 设置归档的区别
-- alter system set log_archive_dest='+DATA'
-- alter system set log_archive_dest_1='location=+DATA'
4、查看归档文件
-- 切日志
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
SQL> select sequence#, name from v$archived_log;
SEQUENCE# NAME
--------------------------------------------------------------------------------
17
/u01/app/oracle/flash_recovery_area/HISDB/archivelog/2022_06_17/o1_mf_1_17_kbr52
8s8_.arc
18
/u01/app/oracle/flash_recovery_area/HISDB/archivelog/2022_06_17/o1_mf_1_18_kbr52
d2g_.arc
19
/u01/app/oracle/flash_recovery_area/HISDB/archivelog/2022_06_17/o1_mf_1_19_kbr52
g87_.arc
2
/u01/app/oracle/flash_recovery_area/HISDB/archivelog/2022_06_17/o1_mf_2_2_kbr52d
rp_.arc
20
/u01/app/oracle/flash_recovery_area/HISDB/archivelog/2022_06_17/o1_mf_1_20_kbr52
hdo_.arc
21
+BAK/hisdb/archivelog/2022_06_17/thread_1_seq_21.262.1107612429
22
+BAK/hisdb/archivelog/2022_06_17/thread_1_seq_22.263.1107612429
23
+BAK/hisdb/archivelog/2022_06_17/thread_1_seq_23.264.1107612429
24
+BAK/hisdb/archivelog/2022_06_17/thread_1_seq_24.265.1107612453
25
+BAK/hisdb/archivelog/2022_06_17/thread_1_seq_25.266.1107612453
26
+BAK/hisdb/archivelog/2022_06_17/thread_1_seq_26.267.1107612457
3
+BAK/hisdb/archivelog/2022_06_17/thread_2_seq_3.268.1107612601
4
+BAK/hisdb/archivelog/2022_06_17/thread_2_seq_4.269.1107612605
5
+BAK/hisdb/archivelog/2022_06_17/thread_2_seq_5.270.1107612607
14 rows selected.
边栏推荐
猜你喜欢

一线城市软件测试工资——你拖后腿了吗

Use of hashcat

When they are in private, they have a sense of propriety

Folding screen will become an important weapon for domestic mobile phones to share the apple market

Are programmers from Huawei, Alibaba and other large manufacturers really easy to find?

入坑机器学习:一,绪论

高速缓存Cache详解(西电考研向)

1-6搭建Win7虚拟机环境

Experience of epidemic prevention and control, home office and online teaching | community essay solicitation

It's 2022, and you still don't know what performance testing is?
随机推荐
EasyCVR平台EHOME协议接入,视频播放出现断流是什么原因?
Specific list of regular and safe domestic stock trading account opening
数据库系统概论必背知识
Smartctl opens the device and encounters permission denied problem troubleshooting process record
Is GF futures safe? What do I need to open an account?
如何卸载cuda
Kaggle 专利匹配比赛赛后总结
Squid 代理服务器之 ACL 访问控制
Experience of epidemic prevention and control, home office and online teaching | community essay solicitation
[mobile terminal] design size of mobile phone interface
元宇宙的生态圈
Computing service network: a systematic revolution of multi integration
[live review] battle code pioneer phase 7: how third-party application developers contribute to open source
Cusdis - 轻量级、隐私优先的开源评论系统 | 倾城之链
谈谈飞书对开发工作的优势 | 社区征文
Software testing salary in first tier cities - are you dragging your feet
保险APP适老化服务评测分析2022第06期
左手梦想 右手责任 广汽本田不光关注销量 还有儿童安全
Multimodal emotion recognition_ Research on emotion recognition based on multimodal fusion
EasyCVR国标协议接入的通道,在线通道部分播放异常是什么原因?