溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

dataguard 由于主庫(kù)參數(shù)未配置歸檔刪除策略導(dǎo)致庫(kù)歸檔丟失ORA-16016

發(fā)布時(shí)間:2020-08-14 10:55:25 來(lái)源:ITPUB博客 閱讀:289 作者:shawnloong 欄目:關(guān)系型數(shù)據(jù)庫(kù)
dataguard 由于主庫(kù)參數(shù)未配置歸檔刪除策略導(dǎo)致庫(kù)歸檔丟失
今天巡檢庫(kù)時(shí)候發(fā)現(xiàn)備庫(kù)未啟動(dòng),監(jiān)控agent也被人關(guān)閉了,手動(dòng)啟動(dòng)
按照日志慣例打開(kāi)備庫(kù)(read_only),但是在open的過(guò)程中顯示以下錯(cuò)誤

點(diǎn)擊(此處)折疊或打開(kāi)

  1. Standby crash recovery failed to bring standby database to a consistent
  2. point because needed redo hasn't arrived yet.
  3. MRP: Wait timeout: thread 1 sequence# 173
  4. Standby Crash Recovery aborted due to error 16016.
  5. Errors in file /u01/app/oracle/diag/rdbms/orcl_st1/orcl/trace/orcl_ora_29639.trc:
  6. ORA-16016: archived log for thread 1 sequence# 173 unavailable
  7. Recovery interrupted!
  8. Some recovered datafiles maybe left media fuzzy
  9. Media recovery may continue but open resetlogs may fail
  10. Completed Standby Crash Recovery.
  11. Errors in file /u01/app/oracle/diag/rdbms/orcl_st1/orcl/trace/orcl_ora_29639.trc:
  12. ORA-10458: standby database requires recovery
  13. ORA-01196: file 1 is inconsistent due to a failed media recovery session
  14. ORA-01110: data file 1: '/u01/app/oracle/oradata/orcl/system01.dbf'
  15. ORA-10458 signalled during: alter database open...


但是手動(dòng)應(yīng)用歸檔顯示已經(jīng)應(yīng)用完成,后臺(tái)查日志備庫(kù)應(yīng)用到sequence 173而主庫(kù)已經(jīng)應(yīng)用到214,查看歸檔目錄下,發(fā)現(xiàn)歸檔已經(jīng)丟失了,由于備機(jī)關(guān)機(jī)未啟動(dòng)導(dǎo)致歸檔未傳送過(guò)來(lái).
我們?cè)谥鲙?kù)中恢復(fù)歸檔

點(diǎn)擊(此處)折疊或打開(kāi)

  1. rman target /
  2. restore archivelog from sequence 173


將恢復(fù)出來(lái)的日志拷貝到備庫(kù)
手動(dòng)注冊(cè)丟失的歸檔,這里我用腳本批量處理的;

點(diǎn)擊(此處)折疊或打開(kāi)

  1. for i in `seq 173 214`;do echo "ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_"$i"_956999399.dbf;'";done
173-214為丟失歸檔的范圍

點(diǎn)擊(此處)折疊或打開(kāi)

  1. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_173_956999399.dbf';
  2. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_174_956999399.dbf';
  3. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_175_956999399.dbf';
  4. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_176_956999399.dbf';
  5. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_177_956999399.dbf';
  6. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_178_956999399.dbf';
  7. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_179_956999399.dbf';
  8. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_180_956999399.dbf';
  9. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_181_956999399.dbf';
  10. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_182_956999399.dbf';
  11. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_183_956999399.dbf';
  12. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_184_956999399.dbf';
  13. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_185_956999399.dbf';
  14. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_186_956999399.dbf';
  15. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_187_956999399.dbf';
  16. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_188_956999399.dbf';
  17. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_189_956999399.dbf';
  18. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_190_956999399.dbf';
  19. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_191_956999399.dbf';
  20. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_192_956999399.dbf';
  21. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_193_956999399.dbf';
  22. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_194_956999399.dbf';
  23. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_195_956999399.dbf';
  24. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_196_956999399.dbf';
  25. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_197_956999399.dbf';
  26. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_198_956999399.dbf';
  27. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_199_956999399.dbf';
  28. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_200_956999399.dbf';
  29. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_201_956999399.dbf';
  30. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_202_956999399.dbf';
  31. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_203_956999399.dbf';
  32. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_204_956999399.dbf';
  33. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_205_956999399.dbf';
  34. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_206_956999399.dbf';
  35. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_207_956999399.dbf';
  36. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_208_956999399.dbf';
  37. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_209_956999399.dbf';
  38. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_210_956999399.dbf';
  39. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_211_956999399.dbf';
  40. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_212_956999399.dbf';
  41. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_213_956999399.dbf';
  42. ALTER DATABASE REGISTER LOGFILE '/u01/archive/1_214_956999399.dbf';

點(diǎn)擊(此處)折疊或打開(kāi)

  1. SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;


注:如果歸檔量比較多可以指定并行度

點(diǎn)擊(此處)折疊或打開(kāi)

  1. ALTER DATABASE RECOVER MANAGED STANDBY DATABASE PARALLEL 2 DISCONNECT FROM SESSION;
  2. ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
數(shù)據(jù)庫(kù)可正常open

點(diǎn)擊(此處)折疊或打開(kāi)

  1. SQL> ALTER DATABASE OPEN;
  2. SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
最后設(shè)置一下主庫(kù)歸檔刪除策略
主庫(kù)操作

點(diǎn)擊(此處)折疊或打開(kāi)

  1. rman target /
  2. CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;
如果出現(xiàn)以下錯(cuò)誤

點(diǎn)擊(此處)折疊或打開(kāi)

  1. CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;
  2. new RMAN configuration parameters:
  3. CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;
  4. new RMAN configuration parameters are successfully stored
  5. RMAN-08591: WARNING: invalid archivelog deletion policy
需要修改修改數(shù)據(jù)庫(kù)參數(shù),重啟庫(kù),然后重新 設(shè)置歸檔刪除策略

點(diǎn)擊(此處)折疊或打開(kāi)

  1. SQL>alter system set "_log_deletion_policy"=ALL scope=spfile sid='*';

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI