如何在Oracle RAC环境中开启归档
Oracle RAC归档设置需要不像单实例设置简单,开启过程需要注意一些细节
归档开启思路:
1:查看数据库是否开启归档
2:创建共享目录(归档一定要放在共享存储上)
3:将rac设置成单实例模式
4:分别关闭各个节点实例
5:将其中一个节点启动到mount状态,开启归档,设置归档路径,格式,并打开数据库还原rac模式
6: 打开所有节点数据库
7:查看数据库归档参数设置是否生效
8:切换归档,查看归档是否正常工作
1、查询归档当前信息
SQL> show parameter recovery
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string
db_recovery_file_dest_size big integer 0
recovery_parallelism integer 0
2、查询是否开户归档日志
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oracle/app/oracle/product/11.2.0/db_1/dbs/arch
Oldest online log sequence 35
Next log sequence to archive 36
Current log sequence 36
说明:从当前查询是已开始归档模式了,但是规定路径不对要重新修改
3、查询集群参数
SQL> show parameter cluster
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cluster_database boolean TRUE
cluster_database_instances integer 2
cluster_interconnects string
4、关闭另外一个节点数据库
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
5、在当前正常节点修改集群为单节点模式
SQL> alter system set cluster_database=false scope=spfile;
System altered.
6、配置闪回大小
SQL> alter system set db_recovery_file_dest_size=2G scope=both;
System altered.
7、配置归档日志路径,配置在DG中
SQL> alter system set db_recovery_file_dest='+DGRECOVERY'scope=both;
System altered.
8、关闭当前节点数据库
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
9.把当前节点数据库启动到mount状态中修改归档
SQL> startup mount
ORACLE instance started.
Total System Global Area 784998400 bytes
Fixed Size 2257352 bytes
Variable Size 331353656 bytes
Database Buffers 448790528 bytes
Redo Buffers 2596864 bytes
Database mounted.
10.查询当前数据库是处于什么状态
SQL> select status from v$instance
2 ;
STATUS
------------
MOUNTED
11.修改数据库归档
SQL> alter database archivelog;
Database altered.
12.恢复数据库双节点实例
SQL> alter system set cluster_database=true scope=spfile;
System altered.
13.打开数据库
SQL> alter database open;
Database altered.
14.查询当前数据库状态
SQL> select status from v$instance;
STATUS
------------
OPEN
15、查询数据库集群状态
123456 SQL> show parameter cluster
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cluster_database boolean TRUE
cluster_database_instances integer 2
cluster_interconnects string
16、再启动另外一个节点
startup
17、切换归档日志,判断是否切换成功
SQL> alter system switch logfile;
System altered.
18、查询归档中数据
ASMCMD> pwd
+DGRECOVERY/RAC/ARCHIVELOG/2017_06_13
ASMCMD> ls
thread_1_seq_37.256.946542069
thread_1_seq_38.257.946542129
thread_1_seq_39.258.946542133
thread_1_seq_40.260.946542135
thread_1_seq_41.261.946543367
thread_1_seq_42.262.946543369
thread_1_seq_43.264.946543373
thread_1_seq_44.265.946543375
thread_1_seq_45.266.946543377
thread_1_seq_46.267.946543377
thread_1_seq_47.269.946544929
thread_2_seq_4.259.946542029
thread_2_seq_5.263.946543265
thread_2_seq_6.268.946543277
通过以上则可以判断数据库可以正常归档