批量處理物理備庫出現archive gap

myownstars發表於2011-10-13

物理備庫出現gap,主庫為5節點RAC,資料庫版本10.2.0.5

登入物理備庫
SQL> select * from v$archive_gap;

   THREAD# LOW_SEQUENCE# HIGH_SEQUENCE#
---------- ------------- --------------
         1        122309         122325
         3          3517           3525
發現gap比較多,以前出現一個archive gap的時候,我們通常是在RAC主庫使用rman命令copy,即將ASM格式的archivelog改為普通格式的,然後傳到備庫register並recover
這次gap太多,用這個方法太慢了,更換一個
在主庫一個節點上rman執行
backup archivelog from sequence 122309 until sequence 122325 thread 1;
backup  archivelog from sequence 3517 until sequence 3525 thread 3;
然後將備份集傳到備庫
先使用catalog start with將這兩個備份集註冊到控制檔案,然後使用restore恢復出archivelog
RMAN> restore archivelog from sequence 122309 until sequence 122325 thread 1;

Starting restore at 13-OCT-11
using channel ORA_DISK_1

channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=122309
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=122310
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=122311
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=122312
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=122313
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=122314
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=122315
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=122316
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=122317
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=122318
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=122319
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=122320
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=122321
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=122322
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=122323
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=122324
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=122325
channel ORA_DISK_1: reading from backup piece /data/backup/j9movv4f_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/data/backup/j9movv4f_1_1 tag=TAG20111013T082342
channel ORA_DISK_1: restore complete, elapsed time: 00:00:56
Finished restore at 13-OCT-11

此時alertlog相應記錄為
Thu Oct 13 10:34:38 CST 2011
Archivelog restore complete. Elapsed time: 0:00:19
Archivelog restore complete. Elapsed time: 0:00:21
Archivelog restore complete. Elapsed time: 0:00:21
Archivelog restore complete. Elapsed time: 0:00:21
Archivelog restore complete. Elapsed time: 0:00:21
Archivelog restore complete. Elapsed time: 0:00:22
Archivelog restore complete. Elapsed time: 0:00:22
Archivelog restore complete. Elapsed time: 0:00:22
Thu Oct 13 10:35:00 CST 2011
Archivelog restore complete. Elapsed time: 0:00:20
Archivelog restore complete. Elapsed time: 0:00:22
Archivelog restore complete. Elapsed time: 0:00:22
Archivelog restore complete. Elapsed time: 0:00:22
Archivelog restore complete. Elapsed time: 0:00:22
Archivelog restore complete. Elapsed time: 0:00:21
Archivelog restore complete. Elapsed time: 0:00:21
Archivelog restore complete. Elapsed time: 0:00:21
Archivelog restore complete. Elapsed time: 0:00:02
此時v$archive_gap已經沒有了記錄
SQL> select * from v$archive_gap;

no rows selected
但是recover程式不會自動恢復這些log,需要先cancel再開啟
SQL> recover managed standby database cancel;
Media recovery complete.
SQL> recover managed standby database using current logfile disconnect from session;
Media recovery complete.
此時備庫恢復正常

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

相關文章