通過RMAN設定standby接收日誌後主庫歸檔日誌才可刪除
因為Oracle archivelog會不斷生產,一般會設定定期清理archivelog的排程,類似下面。
但DG環境中因為某些原因導致主庫事務沒有即使傳到standby,而這時如果主庫的archivelog也被清理掉了,主備庫就產生了日誌GAP
export ORACLE_SID=abc
export ORACLE_HOME=/u01/product/oracle/
export PATH=$ORACLE_HOME/bin:$PATH
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
rman target / <<EOF
run
{
crosscheck archivelog all;
DELETE NOPROMPT ARCHIVELOG until time 'sysdate-7';
}
exit;
EOF
如何能夠確保standby日誌接收到了,主庫archivelog才會被刪除呢?
11G 後提供了RMAN的archivelog刪除策略
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;
注:這裡是說archivelog在standby目錄中接收生產了,並不是被實際應用了。
因為這樣說?一種情況standby正常開啟,但MPR不開啟應用redo,其實standby也能接收主庫傳遞過來的archivelog但並沒有被應用,這時主庫的archivelog是可以被清理的
預設 CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON NONE;
SHOW ALL 命令能看到
實驗
1.關閉standby DB,模擬standby無法接受archivelog
2. 主庫rman中配置
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;
3. 主庫切換生成新log,模擬gap
SQL> alter system switch logfile;
SQL> /
4.因為standby未接收到archivelog,對主庫備份archivelog同時加了DELETE INPUT清理歸檔報錯RMAM-08120
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=9 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=12585 RECID=25142 STAMP=1040319318
input archived log thread=1 sequence=12586 RECID=25144 STAMP=1040319532
input archived log thread=1 sequence=12587 RECID=25146 STAMP=1040319628
input archived log thread=1 sequence=12588 RECID=25147 STAMP=1040320146
channel ORA_DISK_1: starting piece 1 at 13-MAY-20
channel ORA_DISK_1: finished piece 1 at 13-MAY-20
piece handle=/data/exp/arch_20200513_10_0av041ki_1_1 tag=TAG20200513T174906 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/data/epodb/arch/1_12585_893259821.arc RECID=25142 STAMP=1040319318
archived log file name=/data/epodb/arch/1_12586_893259821.arc RECID=25144 STAMP=1040319532
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/data/epodb/arch/1_12587_893259821.arc thread=1 sequence=12587
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/data/epodb/arch/1_12588_893259821.arc thread=1 sequence=12588
Finished backup at 13-MAY-20
5.因為standby未接收到archivelog,對主庫delete archivelog報錯RMAM-08120
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=9 device type=DISK
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/data/epodb/arch/1_12587_893259821.arc thread=1 sequence=12587
RMAN-08120: WARNING: archived log not deleted, not yet applied by standby
archived log file name=/data/epodb/arch/1_12588_893259821.arc thread=1 sequence=12588
注:如果帶上FORCE引數可以忽略 RMAM-08120直接刪除archivelog, delete FORCE archivelog until time 'sysdate' ;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25583515/viewspace-2691923/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 作用RMAN 刪除歸檔日誌
- 邏輯dg刪除主庫過期歸檔日誌
- RMAN delete archivelog命令刪除歸檔日誌及歸檔日誌拷貝deleteHive
- rman刪除歸檔日誌命令集
- 【Oracle】 rman 刪除歸檔日誌的命令Oracle
- 當ORACLE歸檔日誌滿後如何正確刪除歸檔日誌Oracle
- 用rman 正確地刪除歸檔日誌
- rman刪除舊的歸檔日誌問題
- oracle刪除歸檔日誌Oracle
- 歸檔日誌的刪除
- Oracle歸檔日誌刪除Oracle
- DATAGUARD_standby刪除歸檔日誌的指令碼指令碼
- Oralce資料庫關閉歸檔日誌並且刪除歸檔日誌資料庫
- 刪除歸檔日誌檔案
- oracle 刪除過期的歸檔日誌Oracle
- 11gR2 RMAN歸檔日誌刪除策略
- rman 刪除指定時間點的歸檔日誌
- 刪除data guard歸檔日誌
- 手動刪除歸檔日誌
- 配置rman來自動刪除應用過的歸檔日誌
- 【Oracle】歸檔日誌管理-設定歸檔日誌路徑以及歸檔日誌冗餘Oracle
- 誤刪歸檔日誌除導致備份歸檔日誌失敗
- rman清理歸檔日誌
- 手工rm刪除歸檔日誌對備份歸檔日誌的影響
- Postgresql日誌歸檔設定SQL
- standby庫歸檔日誌路徑小節
- RMAN刪除歸檔日誌時將ASM上空目錄同時刪除ASM
- 在Oracle中,如何定時刪除歸檔日誌檔案?Oracle
- Oracle RMAN 清除歸檔日誌Oracle
- Oracle RMAN清除歸檔日誌Oracle
- rman維護歸檔日誌
- crontab不能自動刪除歸檔日誌
- oracle dataguard 自動刪除歸檔日誌Oracle
- 歸檔日誌刪除的五種方法
- 如何定期自動刪除歸檔日誌
- 【警鐘】謹慎刪除歸檔日誌
- data guard 歸檔日誌管理 (standby)
- 刪除歸檔,保留最近的5個歸檔日誌