增量備份解決DataGuard庫日誌GAP
有時候備庫滯後於主庫很長時間了,而主庫的歸檔日誌已經不存在了,此時的日誌間隔如何消除那,很多人選擇重建備庫,這個是很麻煩的,尤其當主庫資料量很大的時候,此時我們還有另外一種選擇,那就是使用增量Database Backup來前滾備庫,消除日誌間隔。
具體作法如下:
1.備庫查看丟失的歸檔時的scn號
idle> select current_scn from v$database;
CURRENT_SCN
-----------
96458277
2.主庫建立基於丟失歸檔scn號為起始的增量備份(要確定主庫和備庫的目標目錄有足夠的空間,這裡使用/tmp檔案夾)
RMAN>
run{
BACKUP DEVICE TYPE DISK INCREMENTAL FROM SCN 96458277 DATABASE FORMAT '/tmp/stb_bk/%U_for_stb.bk' include current controlfile for standby;
}
3.備份好之後,從主庫傳到備份庫的目錄中,可以與上文的目錄不同。
RMAN> CATALOG START WITH '/tmp/stb_bk/';
4.查看一下controlfile的位置,因為接下來要使用備份的控制檔案。
idle> show parameter control
再查看一下standby_log檔案的位置,因為接下來可能需要重建。
idle> select *from v$logfile ;
5.使用如下命令在rman中恢複
RMAN>
run{
restore standby controlfile to '/tmp/stb_controlfile01.ctl';
recover database noredo;
}
如果報如下錯誤,可能是recover managed standby命令正在執行:
ORA-19870: errorwhile restoring backup piece /tmp/stb_bk/05n5a31s_1_1_for_stb.bk
ORA-19573: cannotobtain exclusive enqueue for datafile 1
執行如下命令,或者重啟資料庫到mount狀態:
idle>alter database recover managed standby database cancel ;
然後在rman中再次執行:
RMAN>
run{
restore standby controlfile to '/tmp/stb_controlfile01.ctl' ;
recover database noredo;
}
6.關閉資料庫,將恢複出來的備份控制檔案覆蓋掉原有的控制檔案。
在CentOS 6.4下安裝Oracle 11gR2(x64)
Oracle 11gR2 在VMWare虛擬機器中安裝步驟
Debian 下 安裝 Oracle 11g XE R2
Oracle Data Guard 重要配置參數
基於同一主機配置 Oracle 11g Data Guard
探索Oracle之11g DataGuard
Oracle Data Guard (RAC+DG) 歸檔刪除策略及指令碼
Oracle Data Guard 的角色轉換
Oracle Data Guard的日誌FAL gap問題
Oracle 11g Data Guard Error 16143 Heartbeat failed to connect to standby 處理方法