log_archive_dest_n和standby_archive_dest

來源:互聯網
上載者:User

log_archive_dest_n和standby_archive_dest

今天查看資料,對log_archive_dest_n和standby_archive_dest的關係有點模糊了,做個簡單的測試,縷清關係、加深記憶。

首先看一下我們的實驗環境,10grac,雙節點:node1和node2

SQL> host hostnamenode1SQL> select * from v$version;BANNER----------------------------------------------------------------Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64biPL/SQL Release 10.2.0.1.0 - ProductionCORE10.2.0.1.0ProductionTNS for Linux: Version 10.2.0.1.0 - ProductionNLSRTL Version 10.2.0.1.0 - ProductionSQL> show parameter archvie;SQL> show parameter archvieSQL> show parameter archiveNAME     TYPE VALUE------------------------------------ ----------- ------------------------------archive_lag_target     integer 0log_archive_config     stringlog_archive_dest     stringlog_archive_dest_1     string location=/home/oracle/11log_archive_dest_10     stringlog_archive_dest_2     string service=racdb2log_archive_dest_3     stringlog_archive_dest_4     stringlog_archive_dest_5     stringlog_archive_dest_6     stringlog_archive_dest_7     stringNAME     TYPE VALUE------------------------------------ ----------- ------------------------------log_archive_dest_8     stringlog_archive_dest_9     stringlog_archive_dest_state_1     string enablelog_archive_dest_state_10     string enablelog_archive_dest_state_2     string enablelog_archive_dest_state_3     string enablelog_archive_dest_state_4     string enablelog_archive_dest_state_5     string enablelog_archive_dest_state_6     string enablelog_archive_dest_state_7     string enablelog_archive_dest_state_8     string enableNAME     TYPE VALUE------------------------------------ ----------- ------------------------------log_archive_dest_state_9     string enablelog_archive_duplex_dest      stringlog_archive_format     string %t_%s_%r.dbflog_archive_local_first      boolean TRUElog_archive_max_processes     integer 2log_archive_min_succeed_dest     integer 1log_archive_start     boolean FALSElog_archive_trace     integer 0remote_archive_enable     string truestandby_archive_dest     string ?/dbs/arch

SQL> host clearSQL> host hostnamenode2SQL> select * from v$version;BANNER----------------------------------------------------------------Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64biPL/SQL Release 10.2.0.1.0 - ProductionCORE10.2.0.1.0ProductionTNS for Linux: Version 10.2.0.1.0 - ProductionNLSRTL Version 10.2.0.1.0 - ProductionSQL> show parameter archiveNAME     TYPE VALUE------------------------------------ ----------- ------------------------------archive_lag_target     integer 0log_archive_config     stringlog_archive_dest     stringlog_archive_dest_1     string location=/home/oracle/21log_archive_dest_10     stringlog_archive_dest_2     string service=racdb1log_archive_dest_3     string LOCATION=/home/oracle/22 VALID _FOR=(standby_logfiles, all_ro les)log_archive_dest_4     stringlog_archive_dest_5     stringNAME     TYPE VALUE------------------------------------ ----------- ------------------------------log_archive_dest_6     stringlog_archive_dest_7     stringlog_archive_dest_8     stringlog_archive_dest_9     stringlog_archive_dest_state_1     string enablelog_archive_dest_state_10     string enablelog_archive_dest_state_2     string enablelog_archive_dest_state_3     string enablelog_archive_dest_state_4     string enablelog_archive_dest_state_5     string enablelog_archive_dest_state_6     string enableNAME     TYPE VALUE------------------------------------ ----------- ------------------------------log_archive_dest_state_7     string enablelog_archive_dest_state_8     string enablelog_archive_dest_state_9     string enablelog_archive_duplex_dest      stringlog_archive_format     string %t_%s_%r.dbflog_archive_local_first      boolean TRUElog_archive_max_processes     integer 2log_archive_min_succeed_dest     integer 1log_archive_start     boolean FALSElog_archive_trace     integer 0remote_archive_enable     string trueNAME     TYPE VALUE------------------------------------ ----------- ------------------------------standby_archive_dest     string ?/dbs/arch

在node1下執行如下命令:alter system archive log current;

SQL> alter system archive log current;System altered.SQL> 

在節點2下,查看

[oracle@node2 ~]$ cd 22[oracle@node2 22]$ lltotal 852-rw-r----- 1 oracle oinstall 854528 Jul  7 15:09 1_70_790532232.dbf-rw-r----- 1 oracle oinstall   8704 Jul  7 15:11 1_71_790532232.dbf[oracle@node2 22]$ cd ..[oracle@node2 ~]$ cd 21[oracle@node2 21]$ lltotal 836-rw-r----- 1 oracle oinstall 846848 Jul  7 15:09 2_52_790532232.dbf-rw-r----- 1 oracle oinstall   3072 Jul  7 15:11 2_53_790532232.dbf[oracle@node2 21]$ cd $ORACLE_HOME/dbs[oracle@node2 dbs]$ lltotal 44-rw-rw---- 1 oracle oinstall  1552 Jul  7 15:07 hc_racdb2.dat-rw-r----- 1 oracle oinstall 12920 May  3  2001 initdw.ora-rw-r----- 1 oracle oinstall  8385 Sep 11  1998 init.ora-rw-r----- 1 oracle oinstall    24 Aug  5  2012 initracdb2.ora-rw-r----- 1 oracle oinstall  1536 Aug  5  2012 orapwracdb2-rw-r----- 1 oracle oinstall  1536 Jul  7 15:07 spfileracdb2.ora
在節點2上設定standby_archvie_dest

SQL> alter system set standby_archive_dest='/home/oracle/33' sid='racdb2';System altered.

在節點1,歸檔

SQL> alter system archive log current;System altered.
查看節點2

[oracle@node2 ~]$ cd 33[oracle@node2 33]$ lltotal 4-rw-r----- 1 oracle oinstall 2048 Jul  7 15:14 1_72_790532232.dbf[oracle@node2 33]$ cd ../22[oracle@node2 22]$ lltotal 852-rw-r----- 1 oracle oinstall 854528 Jul  7 15:09 1_70_790532232.dbf-rw-r----- 1 oracle oinstall   8704 Jul  7 15:11 1_71_790532232.dbf[oracle@node2 22]$ 

結論:

在沒有設定standby_archvie_Dest的情況下,資料庫會將歸檔放置在standby資料庫的log_Archive_dest_n指定的目錄下,如果指定了STANDBY_ARCHIVE_DEST則存放在standby_archive_Dest指定的目錄下。




相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.