oracle RAC--归档日志的开启方法
==================================
10g R1 要修改cluster_database参数 ,10G R2和以后的版本就不需要了
1. 例子(10g R1或之前):
srvctl stop database -d RAC
节点1
sql>startup mount
SQL> alter system set log_archive_dest_1=‘location=/racdb1_arch‘ scope=spfile sid=‘RAC1‘;
SQL> alter system set log_archive_dest_1=‘location=/racdb2_arch‘ scope=spfile sid=‘RAC2‘;
SQL> alter system set log_archive_dest_2=‘service=rac2‘ scope=spfile sid=‘RAC1‘;
SQL> alter system set log_archive_dest_2=‘service=rac1‘ scope=spfile sid=‘RAC2‘;
SQL> alter system set standby_archive_dest=‘/racdb2_arch‘ scope=spfile sid=‘RAC1‘;
SQL> alter system set standby_archive_dest=‘/racdb1_arch‘ scope=spfile sid=‘RAC2‘;
sql>alter system set cluster_database=false scope=spfile;
sql>shutdown immediate
sql>startup mount
sql>alter database archivelog
sql>alter database open
sql>alter system set cluster_database=true scope=spfile;
sql>shutdown immediate
srvctl start database -d RAC
2. 例子(10g R2或之后):
节点1
SQL>startup mount;
SQL> alter system set log_archive_dest_1=‘location=/racdb1_arch‘ scope=spfile sid=‘RAC1‘;
SQL> alter system set log_archive_dest_1=‘location=/racdb2_arch‘ scope=spfile sid=‘RAC2‘;
SQL> alter system set log_archive_dest_2=‘service=rac2‘ scope=spfile sid=‘RAC1‘;
SQL> alter system set log_archive_dest_2=‘service=rac1‘ scope=spfile sid=‘RAC2‘;
SQL> alter system set standby_archive_dest=‘/racdb2_arch‘ scope=spfile sid=‘RAC1‘;
SQL> alter system set standby_archive_dest=‘/racdb1_arch‘ scope=spfile sid=‘RAC2‘;
srvctl stop database -d RAC
节点1
SQL> startup mount
SQL> alter database archivelog;
srvctl start database -d RAC
3. 测试归档日志的切换:
节点一,二上分别执行切换日志操作如下:
SQL> alter system switch logfile; 操作执行这条语句5次
节点一查询:
SQL> !ls -l /racdb*
/racdb1_arch:
total 1072
-rw-r----- 1 oracle oinstall 93696 Oct 7 08:57 1_82_762368314.dbf
-rw-r----- 1 oracle oinstall 980992 Oct 7 09:10 1_83_762368314.dbf
-rw-r----- 1 oracle oinstall 1536 Oct 7 09:10 1_84_762368314.dbf
-rw-r----- 1 oracle oinstall 1024 Oct 7 09:10 1_85_762368314.dbf
-rw-r----- 1 oracle oinstall 1024 Oct 7 09:10 1_86_762368314.dbf
/racdb2_arch:
total 980
-rw-rw---- 1 oracle oinstall 166400 Oct 7 08:56 2_57_762368314.dbf
-rw-rw---- 1 oracle oinstall 811520 Oct 7 09:10 2_58_762368314.dbf
-rw-rw---- 1 oracle oinstall 2560 Oct 7 09:10 2_59_762368314.dbf
-rw-rw---- 1 oracle oinstall 1024 Oct 7 09:10 2_60_762368314.dbf
-rw-rw---- 1 oracle oinstall 1024 Oct 7 09:10 2_61_762368314.dbf
节点二查询:
SQL> !ls -l /racdb*
/racdb1_arch:
total 1072
-rw-rw---- 1 oracle oinstall 93696 Oct 7 08:57 1_82_762368314.dbf
-rw-rw---- 1 oracle oinstall 980992 Oct 7 09:10 1_83_762368314.dbf
-rw-rw---- 1 oracle oinstall 1536 Oct 7 09:10 1_84_762368314.dbf
-rw-rw---- 1 oracle oinstall 1024 Oct 7 09:10 1_85_762368314.dbf
-rw-rw---- 1 oracle oinstall 1024 Oct 7 09:10 1_86_762368314.dbf
/racdb2_arch:
total 980
-rw-r----- 1 oracle oinstall 166400 Oct 7 08:56 2_57_762368314.dbf
-rw-r----- 1 oracle oinstall 811520 Oct 7 09:10 2_58_762368314.dbf
-rw-r----- 1 oracle oinstall 2560 Oct 7 09:10 2_59_762368314.dbf
-rw-r----- 1 oracle oinstall 1024 Oct 7 09:10 2_60_762368314.dbf
-rw-r----- 1 oracle oinstall 1024 Oct 7 09:10 2_61_762368314.dbf
节点一:
SQL> show parameter archive_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest string
log_archive_dest_1 string location=/racdb1_arch
log_archive_dest_10 string
log_archive_dest_2 string service=rac2
log_archive_dest_3 string
log_archive_dest_4 string
log_archive_dest_5 string
log_archive_dest_6 string
log_archive_dest_7 string
log_archive_dest_8 string
log_archive_dest_9 string
log_archive_dest_state_1 string enable
log_archive_dest_state_10 string enable
log_archive_dest_state_2 string enable
log_archive_dest_state_3 string enable
log_archive_dest_state_4 string enable
log_archive_dest_state_5 string enable
log_archive_dest_state_6 string enable
log_archive_dest_state_7 string enable
log_archive_dest_state_8 string enable
log_archive_dest_state_9 string enable
standby_archive_dest string /racdb2_arch
节点二:
SQL> show parameter archive_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest string
log_archive_dest_1 string location=/racdb2_arch
log_archive_dest_10 string
log_archive_dest_2 string service=rac1
log_archive_dest_3 string
log_archive_dest_4 string
log_archive_dest_5 string
log_archive_dest_6 string
log_archive_dest_7 string
log_archive_dest_8 string
log_archive_dest_9 string
log_archive_dest_state_1 string enable
log_archive_dest_state_10 string enable
log_archive_dest_state_2 string enable
log_archive_dest_state_3 string enable
log_archive_dest_state_4 string enable
log_archive_dest_state_5 string enable
log_archive_dest_state_6 string enable
log_archive_dest_state_7 string enable
log_archive_dest_state_8 string enable
log_archive_dest_state_9 string enable
standby_archive_dest string /racdb1_arch
===========================================