10g的DATA GUARD的一個主要特點就是引入了log_archive_config參數,如果缺少這個參數,可能會導致歸檔路徑被禁用。
看別人建立DATA GUARD時碰到了這個問題,當時覺得比較有意思,於是特意重現一下。
當前是一個已經配置好的DATA GUARD,為了類比錯誤,先將這個參數設定為空白:
SQL> alter system set log_archive_config = '';
System altered.
SQL> alter system switch logfile;
System altered.
SQL> show parameter archive_dest_2
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_2 string SERVICE=standby LGWR SYNC VALI
D_FOR=(ONLINE_LOGFILES,PRIMARY
_ROLE) DB_UNIQUE_NAME=standby
SQL> alter system set log_archive_dest_2 = 'SERVICE=standby ARCH ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=standby';
System altered.
SQL> alter system switch logfile;
System altered.
日誌切換後,alert檔案中並沒有任何的錯誤,包含重新設定log_archive_dest_2參數後再次執行切換日誌,alert檔案中仍然看不到預期的錯誤。
導致問題無法重現的原因可能是由於系統中已經設定過log_archive_config參數了,雖然現在置為空白,但是這個參數的生效可能會一直保留,於是嘗試重啟資料庫:
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 2147483648 bytes
Fixed Size 2074112 bytes
Variable Size 486541824 bytes
Database Buffers 1644167168 bytes
Redo Buffers 14700544 bytes
Database mounted.
Database opened.
SQL> alter system switch logfile;
System altered.
SQL> alter system set log_archive_dest_2 = 'SERVICE=standby LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=standby';
System altered.
SQL> alter system switch logfile;
System altered.
這是從alert檔案中已經可以看到預期的錯誤了:
Thu Dec 23 21:42:48 2010
Completed: ALTER DATABASE OPEN
Thu Dec 23 21:42:51 2010
Thread 1 advanced to log sequence 11
Current log# 2 seq# 11 mem# 0: /data/oradata/primary/redo02.log
Thu Dec 23 21:42:51 2010
Errors in file /opt/ora10g/admin/primary/bdump/primary_arc1_18406.trc:
ORA-16057: DGID from server not in Data Guard configuration
Thu Dec 23 21:42:51 2010
FAL[server, ARC1]: Error 16057 creating remote archivelog file 'standby'
FAL[server, ARC1]: FAL archive failed, see trace file.
Thu Dec 23 21:42:51 2010
Errors in file /opt/ora10g/admin/primary/bdump/primary_arc1_18406.trc:
ORA-16055: FAL request rejected
ARCH: FAL archive failed. Archiver continuing
Thu Dec 23 21:42:51 2010
ORACLE Instance primary - Archival Error. Archiver continuing.
Thu Dec 23 21:43:46 2010
Shutting down archive processes
Thu Dec 23 21:43:51 2010
ARCH shutting down
ARC2: Archival stopped