RAC--歸檔日誌的開啟方法

n-lauren發表於2012-10-09
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
===========================================

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22990797/viewspace-745952/,如需轉載,請註明出處,否則將追究法律責任。

相關文章