【轉】詳解log_archive_dest與log_archive_dest_n區別

spectre2發表於2013-08-13

今天把一個新上線的資料庫改為了歸檔模式,順便修改了一下歸檔檔案存放路徑,開始配置的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 anyLOG_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 statementALTER 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.

 

轉載自:http://www.anbob.com/?p=752

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

相關文章