log_archive_dest:指定归档文件存放的路径,该路径只能是本地磁盘,默认为''。如果设置了log_archive_dest_n,就不能设置log_archive_dest,同样的,如果设置了db_recovery_file_dest,也不能设置log_archive_dest;也就是说,设置了log_archive_dest,就不能设置log_archive_dest_n,也不能设置db_recovery_file_dest,不过可以设log_archive_duplex_dest,

 

SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
SQL> show parameter db_recovery_file

NAME                                      TYPE                VALUE
------------------------------------ -----------       ---------------------------
db_recovery_file_dest            string              C:/oracle/product/10.2.0/flash_recovery_area
db_recovery_file_dest_size    big integer      8G

SQL> show parameter log_archive_dest_

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1                   string
log_archive_dest_10                  string
log_archive_dest_2                   string
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_n,只设置了db_recovery_file_dest;

SQL> alter system set log_archive_dest='C:/ARCHIVE';
alter system set log_archive_dest='C:/ARCHIVE'
*
第 1 行出现错误: 
ORA-02097: 无法修改参数, 因为指定的值无效
ORA-16018: 无法将 LOG_ARCHIVE_DEST 与 LOG_ARCHIVE_DEST_n 或DB_RECOVERY_FILE_DEST 一起使用

 

SQL> alter system set db_recovery_file_dest='';

系统已更改。

SQL> alter system set log_archive_dest='C:/ARCHIVE';

系统已更改。

SQL> alter system set log_archive_dest_1='LOCATION=C:/ARCHIVE1';
alter system set log_archive_dest_1='C:/ARCHIVE1'
*
第 1 行出现错误:
ORA-32017: 更新 SPFILE 时失败
ORA-16179: 不允许使用 SPFILE 对 "log_archive_dest_1" 进行增量更改


log_archive_dest_n:默认值为''.ORACLE最多支持把日志文件归档到10g地方,n从1到10,归档地址可以为本地磁盘,或者网络设备,如果设置了log_archive_dest就不能设置log_archive_dest_n,但是如果设置了db_recovery_file_dest,也能够设置log_archive_dest_n,默认的情况下归档日志都是存放在db_recovery_file_dest目录下,如果设置了log_archive_dest_n,那么归档日志就不会存放在db_recovery_file_dest,而是存放在log_archive_dest指定的目录下

 

SQL> alter system set log_archive_dest='';

系统已更改。

SQL> archive log list
数据库日志模式            存档模式
自动存档             启用
存档终点            C:/ARCHIVE2
最早的联机日志序列     168
下一个存档日志序列   170
当前日志序列           170
当前日志序列           170       ----可以看到日志切换之后 现在的日志序列为170,

SQL> alter system set db_recovery_file_dest='C:/oracle/product/10.2.0/flash_recovery_area';

系统已更改。

SQL> alter system set log_archive_dest_1='location=C:/ARCHIVE1';

系统已更改。

SQL> alter system set log_archive_dest_2='location=C:/ARCHIVE2';

系统已更改。

SQL> ALTER SYSTEM SWITCH LOGFILE;

系统已更改。

SQL> select name from v$archived_log where recid>=170;---当设置了几个log_archived_dest_就会从当前日志号开始产生几个相同的归档日志

NAME
--------------------------------------------------------
C:/ARCHIVE1/ARC00170_0698319194.001    -----可以看到归档日志没有在db_recovery_file_dest中生成

C:/ARCHIVE2/ARC00170_0698319194.001    

总结一下:

1.如果数据库设置了db_recovery_file_dest,就不能设置log_archive_dest,默认的归档日志存放于db_recovery_file_dest中,如果设置了log_archive_dest_n,那么归档日志不再存放于db_recovery_file_dest中,而是存放于设置的log_archive_dest_n目录中,如果想要归档日志继续存放在db_recovery_file_dest中,可以通过如下命令

alter system set log_archive_dest_2='location=USE_DB_RECOVERY_FILE_DEST';

2.log_archive_dest只能与 log_archive_duplex_dest共存,他们作用一样。

3.还有一点就是,如果我们设置的log_archive_dest_n不正确,那么ORACLE会在我们设置的上一级目录归档,比如说我们设置log_archive_dest_1='location=C:/ARCHIVE1',如果操作系统中没有ARCHIVE1这个目录,那么ORACLE会在C盘归档

 

附上oracle官方资料:

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.

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.

If LOG_ARCHIVE_DEST is not explicitly defined and all the LOG_ARCHIVE_DEST_n parameters have null string values, LOG_ARCHIVE_DEST is set to an operating system-specific default value on instance startup.

To override the destination that this parameter specifies, either specify a different destination for manual archiving or use the SQL*Plus statement ARCHIVE LOG START filespec for automatic archiving, where filespec is the new archive destination. To permanently change the destination, use the statement ALTER SYSTEM SET LOG_ARCHIVE_DEST = filespec, where filespec is the new archive destination.

Neither LOG_ARCHIVE_DEST nor LOG_ARCHIVE_FORMAT have to be complete file or directory specifiers themselves; they only need to form a valid file path after the variables are substituted into LOG_ARCHIVE_FORMAT and the two parameters are concatenated together.