DG備庫磁碟空間滿導致無法建立歸檔,dg磁碟空間

來源:互聯網
上載者:User

DG備庫磁碟空間滿導致無法建立歸檔,dg磁碟空間
上周五去某客戶那裡做資料庫巡檢,是window 2008系統上10g的一套NC系統的庫,已經配置了DG,但是巡檢時探索資料庫報錯:
Tue Nov 11 10:13:57 2014LNS: Standby redo logfile selected for thread 1 sequence 3945 for destination LOG_ARCHIVE_DEST_2Tue Nov 11 10:14:29 2014Errors in file d:\oracle\product\10.2.0\admin\nc\bdump\nc_arc0_177356.trc:ORA-16401: archivelog rejected by RFS
FAL[server, ARC0]: FAL archive failed, see trace file.Sun Nov 16 04:05:12 2014Errors in file d:\oracle\product\10.2.0\admin\nc\bdump\nc_arc0_177356.trc:ORA-16055: FAL request rejected
ARCH: FAL archive failed. Archiver continuingSun Nov 16 04:05:15 2014Errors in file d:\oracle\product\10.2.0\admin\nc\bdump\nc_arc0_177356.trc:ORA-00270: error creating archive log 
提示歸檔日誌被RFS進程拒絕,FAL進程請求被拒絕,無法建立歸檔日誌
*** 2014-11-11 10:14:29.806tkcrrsarc: (WARN) Failed to find ARCH for message (message:0x2)tkcrrpa: (WARN) Failed initial attempt to send ARCH message (message:0x2)Error 16401 creating standby archive log file at host 'ncdg'ORA-16401: archivelog rejected by RFS*** 2014-11-11 10:15:29.900tkcrrsarc: (WARN) Failed to find ARCH for message (message:0x2)tkcrrpa: (WARN) Failed initial attempt to send ARCH message (message:0x2)Error 16401 creating standby archive log file at host 'ncdg'ORA-16401: archivelog rejected by RFS*** 2014-11-11 10:16:29.962tkcrrsarc: (WARN) Failed to find ARCH for message (message:0x2)tkcrrpa: (WARN) Failed initial attempt to send ARCH message (message:0x2)Error 16401 creating standby archive log file at host 'ncdg'ORA-16401: archivelog rejected by RFS*** 2014-11-11 10:17:30.025tkcrrsarc: (WARN) Failed to find ARCH for message (message:0x2)tkcrrpa: (WARN) Failed initial attempt to send ARCH message (message:0x2)Error 16401 creating standby archive log file at host 'ncdg'ORA-16401: archivelog rejected by RFS*** 2014-11-11 10:18:30.088tkcrrsarc: (WARN) Failed to find ARCH for message (message:0x2)tkcrrpa: (WARN) Failed initial attempt to send ARCH message (message:0x2)Error 16401 creating standby archive log file at host 'ncdg'ORA-16401: archivelog rejected by RFS
查看trace檔案nc_arc0_177356.trc得知,從11月11日上午10點14分開始報錯,也是類似的提示,再目標主機無法建立歸檔記錄檔,平均1分鐘報一次錯誤,在備庫查看,發現原來是因為沒有定期清理主庫傳遞過來的歸檔日誌,磁碟空間耗盡了!



70G空間全部用完了,由於客戶的磁碟本來就比較小,其中一部分還用來存放資料檔案,本身就要佔用47G。


最後一個歸檔日誌是11月11日,7:25產生的,後面就沒有了,這和trace檔案中的報錯也是符合的,由於這個時刻耗盡了磁碟的最後一些空間,進而造成了主庫警示日誌中出現的無法建立遠程歸檔的錯誤,既然找到問題了,那麼處理就容易了,先把備庫應用過的歸檔刪除掉,釋放磁碟空間。
由於備庫歸檔存在GAP,並且這些GAP在主庫的歸檔中也已經沒有了,主庫並沒有保留非常多的歸檔,切歸檔日誌也沒有單獨做備份組,因此只能是重新設定DG Configuration。
今天過去客戶那邊,把DG重新設定了一下。步驟其實很簡單,因為之前已經配置過一次,這次只要是同步一下就行了,不需要修改參數,拷貝參數檔案、密碼檔案、tnsnames.ora、listener.ora等,只需要在主庫建立一個備庫控制檔案,然後再把主庫的RMAN備份組拿到備庫去恢複就行了。具體過程這裡就不寫了,配置完DG後,檢查兩邊歸檔路徑狀態,確定沒有error後開啟redo apply,備庫就又和主庫資料同步了。
因為可用磁碟空間仍然比較小,因此這次專門給客戶配置了自動刪除備庫歸檔日誌的指令碼,主要用到了3個檔案,大致內容如下:
--delete_dg_archivelogcd D:\archivelogdeld: sqlplus / as sysdba @delete_archive.sql echo rman target / cmdfile=rman_checkcross.rman>>delete_archivelog.bat delete_archivelog.bat >>delete_dg_archivelog_%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%".log exit 
--delete_archive.sql set lines 150 col name for a150 set pagesize 0 feedback off verify off heading off echo off spool delete_archivelog.bat select 'del '||name from v$archived_log where APPLIED='YES' AND NAME IS NOT NULL and DEST_ID=1; spool off exit; 
--rman_checkcross.rman crosscheck archivelog all; delete noprompt expired archivelog all; exit 
下面來說明一下這個指令碼,其中第一個bat指令碼就是去調用了delte_archive.sql和rman_checkcross.rman這2個命令檔案,最主要的就是delete_archive.sql這個指令碼的執行內容,用SQL拼接的方式找出已經應用過的歸檔檔案,然後產生del命令,在OS層級刪除它們,最後再調用rman命令交叉校正,最後刪除expired的歸檔日誌(OS層級的刪了,也要通知控制檔案這些歸檔已經不存在了,需要刪除),如果日誌還未在備庫應用,那麼之前的那條select語句是不會查詢出行記錄的。
今天第一次做的時候delete_archivelog.sql中select語句用DEST_ID=1的時候,居然沒查到資料行,用了DEST_ID=2才有結果,而後來又碰到用DEST_ID=2沒結果,於是又換回DEST_ID=1才行。其實最主要的就是要關注SQL指令碼要跑出結果,否則之前的那些命令都等於不起作用了,沒有結果,OS命令就不會去del這些檔案,而如果OS層級沒有del掉這些檔案,那麼RMAN就檢查不出是expired的,因此也就不會從控制檔案中刪除這些歸檔的相關記錄。
最後把這個指令碼添加到windows任務計劃中定期運行即可,由於客戶的日誌切換頻率並不高,因此暫訂為每周清一次歸檔。


相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.