当前位置: 首页 > 工具软件 > Disk ARchive > 使用案例 >

log_archive_dest与log_archive_dest_n区别

万俟铭
2023-12-01

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这两个参数是互斥的,Oracle之所以保留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

 类似资料: