首页 » ORACLE 9i-23c » 详解log_archive_dest与log_archive_dest_n区别

详解log_archive_dest与log_archive_dest_n区别

今天把一个新上线的数据库改为了归档模式,顺便修改了一下归档文件存放路径,开始配置的log_archive_dest,后来发现在闪回区同样还会有一份共两份,后来重新配置log_archive_dest_1变成了一份,下面请仔细看我的操作过程

sqlplus / as sysdba

sql>alter system set log_archivelog_dest=’/backup/archivedlog/’ scope=spfile;

sql>shutdown immediate

sql>startup mount

sql>alter database  archivelog

sql>alter database open;

————————–

note:   不可以直接startup   mount    force,如果有数据需要recover

—————————

sql>alter system switch logfile;

sql>alter system switch logfile;

–强制两次切换日志归档

用rman 查看归档日志

RMAN> list archivelog all;

using target database control file instead of recovery catalog

List of Archived Log Copies
Key     Thrd Seq     S Low Time            Name
------- ---- ------- - ------------------- ----
1       1    13      A 2011-05-18 09:26:05 /backup/archivedlog/1_13_751026649.dbf
2       1    13      A 2011-05-18 09:26:05 /oracle/flash_recovery_area/AHJCYL/archivelog/2011_05_18/o1_mf_1_13_6x68b3yp_.arc
3       1    14      A 2011-05-18 09:30:43 /backup/archivedlog/1_14_751026649.dbf
4       1    14      A 2011-05-18 09:30:43 /oracle/flash_recovery_area/AHJCYL/archivelog/2011_05_18/o1_mf_1_14_6x68b5lj_.arc

—在log_archive_dest一份同时闪回区又一份

SQL> archive  log  list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     13
Next log sequence to archive   15
Current log sequence           15

SQL> alter system reset log_archive_dest scope=spfile sid=’*’;

System altered.
SQL> alter system set  log_archive_dest_1=’/backup/archivedlog/’ scope=spfile;
alter system set  log_archive_dest_1=’/backup/archivedlog/’ scope=spfile
*
ERROR at line 1:
ORA-32017: failure in updating SPFILE
ORA-16179: incremental changes to “log_archive_dest_1” not allowed with SPFILE

SQL> alter system set  log_archive_dest_1=’LOCATION=/backup/archivedlog/’ scope=spfile;

System altered.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 4412407808 bytes
Fixed Size                  2089696 bytes
Variable Size            1493175584 bytes
Database Buffers         2902458368 bytes
Redo Buffers               14684160 bytes
Database mounted.
Database opened.
SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /backup/archivedlog/
Oldest online log sequence     13
Next log sequence to archive   15
Current log sequence           15

SQL> alter system switch logfile

SQL> alter system switch logfile

RMAN> list archivelog all;

using target database control file instead of recovery catalog

List of Archived Log Copies
Key     Thrd Seq     S Low Time            Name
------- ---- ------- - ------------------- ----
1       1    13      A 2011-05-18 09:26:05 /backup/archivedlog/1_13_751026649.dbf
2       1    13      A 2011-05-18 09:26:05 /oracle/flash_recovery_area/AHJCYL/archivelog/2011_05_18/o1_mf_1_13_6x68b3yp_.arc
3       1    14      A 2011-05-18 09:30:43 /backup/archivedlog/1_14_751026649.dbf
4       1    14      A 2011-05-18 09:30:43 /oracle/flash_recovery_area/AHJCYL/archivelog/2011_05_18/o1_mf_1_14_6x68b5lj_.arc
5       1    15      A 2011-05-18 09:30:45 /backup/archivedlog/1_15_751026649.dbf
6       1    16      A 2011-05-18 10:05:38 /backup/archivedlog/1_16_751026649.dbf

–现在变为一份了

总结:

老版本使用log_archive_dest配置归档日志路径最多可以配置2个,除了这个参数还有一个LOG_ARCHIVE_DUPLEX_DEST,这两个参数都只能配置本地路径,格式是log_archive_dest=’/backup1/xxx/’;

到了企业版,log_archive_dest这个参数已被oracle不推荐,如果用log_archive_dest_n最多可以配置10个路径,而且可以是本地也可以是远程的standby DB,log_archive_dest_n路径必须加location或service

log_archive_dest与log_archive_dest_n两个参数冲突,如果指定了log_archive_des后log_archive_dest_n显示指定不会起作用

如果指定了log_archive_dest路径,oracle会隐式启用log_archive_dest_10,默认路径为闪回区,所以上面备份会两份,如果显示指定log_archive_dest_10为空串,将不会再备份到闪回区

这两组参数都是静态参数,修改后必须重启数据库生效,如果都未批定会用系统默认:闪回区

转载请声明出处

http://www.anbob.com/?p=752

官方:

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.

打赏

目前这篇文章有1条评论(Rss)评论关闭。

  1. Lynelle Demarco | #1
    2011-12-21 at 08:12

    I just added this feed to my bookmarks. I have to say, I really enjoy reading your blogs. Keep it up!