log_archive_dest與log_archive_dest_n區別

hd_system發表於2016-11-10

1.log_archive_dest.
使用log_archive_dest引數最多可設定2個歸檔路徑,透過log_archive_dest設定一個主歸檔路徑,透過LOG_ARCHIVE_DUPLEX_DEST 引數設定一個從歸檔路徑。所有的路徑必須是本地的,該引數的設定格式如下:

LOG_ARCHIVE_DEST = '/disk1/archive'
LOG_ARCHIVE_DUPLEX_DEST = '/disk2/archive'

 

2.LOG_ARCHIVE_DEST_n
LOG_ARCHIVE_DEST_n引數可以設定最多10(n=[1..10])個不同的歸檔路徑,透過設定關鍵詞location或service,該引數指向的路徑可以是本地或遠端的。

LOG_ARCHIVE_DEST_1 = 'LOCATION = /disk1/archive'
LOG_ARCHIVE_DEST_2 = 'LOCATION = /disk2/archive'
LOG_ARCHIVE_DEST_3 = 'LOCATION = /disk3/archive'

如果要歸檔到遠端的standby,可以設定service:
LOG_ARCHIVE_DEST_4 = 'SERVICE = standby1'


可見,這兩個引數都可以設定歸檔路徑,不同的是後者可以設定遠端歸檔到standby端,而前者只能歸檔到本地,且最多同時歸檔到2個路徑下。

 

log_archive_dest與log_archive_dest_n這兩個引數是互斥的,之所以保留log_archive_dest和 log_archive_duplex_dest是為了保證向後的相容。
見下面的官方文件:

LOG_ARCHIVE_DEST is applicable only if you are running the database in ARCHIVELOG mode or are recovering a database from archived redo logs. LOG_ARCHIVE_DEST is incompatible with the LOG_ARCHIVE_DEST_n parameters, and must be defined as the null string ("") or (' ') when any LOG_ARCHIVE_DEST_n parameter has a value other than a null string. Use a text string to specify the default location and root of the disk file or tape device when archiving redo log files. (Archiving to tape is not supported on all operating systems.) The value cannot be a raw partition.

其中:
and must be defined as the null string ("") or (' ') when any LOG_ARCHIVE_DEST_n parameter has a value other than a null string.
就是這個意思:

下面做個實驗證明下這兩個引數不能同時使用:

 

SQL> alter system set log_archive_dest_1='location=/u01/app/oracle/bak/arch1';

System altered.

SQL> alter system set log_archive_dest_2='location=/u01/app/oracle/bak/arch2';

System altered.

 

SQL> alter system set log_archive_dest='location=/u01/app/oracle/bak/arch3';
alter system set log_archive_dest='location=/u01/app/oracle/bak/arch3'
*
ERROR at line 1:
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-16018: cannot use LOG_ARCHIVE_DEST with LOG_ARCHIVE_DEST_n or
DB_RECOVERY_FILE_DEST

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

相關文章