转自:http://blog.chinaunix.net/uid-11570547-id-59115.html
log_archive_dest_n 和log_archive_dest和 log_archive_duplex_dest
1、
LOG_ARCHIVE_DEST_n这个参数应该是在9i之后引入的一个参数,Oracle之所以引入这个参数我认为是有以下几点:
1、为了多引入一些归档日志的存放位置。其中n为1-10(10g)
For Enterprise Edition users, this parameter has been deprecated in favor of the LOG_ARCHIVE_DEST_n parameters.
If Oracle Enterprise Edition is not installed or it is installed,
but you have not specified any LOG_ARCHIVE_DEST_n parameters, this parameter is valid.
2、
从上面可以看到log_archive_dest和 log_archive_duplex_dest是被LOG_ARCHIVE_DEST_n参数替代的。两者有区别:
其中log_archive_dest和 log_archive_duplex_dest只能指定本地的主机位置,而LOG_ARCHIVE_DEST_n参数可以是本地也可一是远端。
所以这里只是指定归档日志存放位置的参数而已,不是两种备份方法。
你上面遇见的问题是:
因为这两个参数是互斥的,Oracle之所以保留log_archive_dest和 log_archive_duplex_dest是为了保证向后的兼容。
而你是将LOG_ARCHIVE_DEST_n 参数设置为一个NULL,这个也是Oracle不允许的
见下面的官方文档:
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> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production
SQL> show parameter LOG_ARCHIVE_DEST_1
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1 string
log_archive_dest_10 string
SQL> show parameter log_archive_dest_1
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1 string LOCATION=c:appkb
log_archive_dest_10 string
--安装你的要求设置为NULL
SQL> alter system set LOG_ARCHIVE_DEST_1='';
系统已更改。
SQL> show parameter log_archive_dest_1
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1 string
log_archive_dest_10 string
SQL> show parameter log_archive_dest_1
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1 string
log_archive_dest_10 string
SQL> alter system set LOG_ARCHIVE_DEST='c:app';
alter system set LOG_ARCHIVE_DEST='c:app'
*
第 1 行出现错误:
ORA-02097: 无法修改参数, 因为指定的值无效
ORA-16018: 无法将 LOG_ARCHIVE_DEST 与 LOG_ARCHIVE_DEST_n 或
DB_RECOVERY_FILE_DEST 一起使用
也会出现错误;
解决的方式:
SQL> alter system reset log_archive_dest_1 sid='orcl';
系统已更改。
这样就可以将这个参数清除,重启就可以修改 了
SQL> alter system reset DB_RECOVERY_FILE_DEST;
系统已更改。
SQL> alter system set log_archive_dest='c:app';
alter system set log_archive_dest='c:app'
*
第 1 行出现错误:
ORA-02097: 无法修改参数, 因为指定的值无效
ORA-16018: 无法将 LOG_ARCHIVE_DEST 与 LOG_ARCHIVE_DEST_n 或
DB_RECOVERY_FILE_DEST 一起使用
SQL> alter system set log_archive_dest='c:app' scope=spfile;
系统已更改。
SQL> create pfile from spfile;
文件已创建。
这时候就可以使用log_archive_dest参数了,不过不建议使用。
SQL> show parameter log_archive_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest string c:app
log_archive_dest_1 string
ps
:
ORA-16018: cannot use string with LOG_ARCHIVE_DEST_n or DB_RECOVERY_FILE_DEST
Cause: One of the following events caused an incompatibility: 1) Parameter LOG_ARCHIVE_DEST or LOG_ARCHIVE_DUPLEX_DEST was in use when a LOG_ARCHIVE_DEST_n (n = 1...10) parameter was encountered while fetching initialization parameters. 2) An ALTER SYSTEM ARCHIVE LOG START TO command was in effect when a LOG_ARCHIVE_DEST_n parameter was encountered while fetching initialization parameters. 3) A LOG_ARCHIVE_DEST_n parameter was in use when an ALTER SYSTEM command was used to define a value for either the LOG_ARCHIVE_DEST or LOG_ARCHIVE_DUPLEX_DEST parameter. 4) Parameter DB_RECOVERY_FILE_DEST was in use when an attempt was made to use an ALTER SYSTEM or ALTER SESSION command to define a value for LOG_ARCHIVE_DEST or LOG_ARCHIVE_DUPLEX_DEST.
Action: Eliminate any incompatible parameter definitions.