對於Oracle Data Guard 的Maximum Availability和 Maximum Performance 兩種模式下的主庫歸檔文件的刪除,必須是在歸檔文件在備庫應用以後纔可以刪除。
對於Maximum Protection 模式,這種模式的日誌是同時寫到主庫和備庫的,所以這種模式下的主庫刪除歸檔,沒有限制。可以直接刪除。
那麼在Maximum Availability和 Maximum Performance下,RMAN 備份歸檔文件的時候,如果我們加上delete input,那麼如何確定歸檔問及愛你該不該刪除。
在10g之前的版本,只能通過操作系統腳本的方式,在刪除歸檔文件之前,首先對Standby端數據庫的歸檔文件應用狀態作判斷,應用之後才能在Primary端執行正常刪除。
在Oracle 10g 後,RMAN提供了配置歸檔文件刪除策略: configure archivelog deletion policy
該策略對應兩個值:
APPLIEDONSTANDBY :設置爲該值時,當通過附加的 DELETEINPUT 子句刪除Standby數據庫仍需要的日誌時,會提示RMAN-08137錯誤。不過仍然可以手動地通過 DELETEARCHIVELOG 方式刪除。
NONE :設置爲該值時,則不啓用歸檔文件的刪除策略。默認情況下就是NONE。
我們配置一下:
RMAN> configure archivelog deletion policy to applied on standby;
old RMAN configuration parameters:
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;
new RMAN configuration parameters:
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;
new RMAN configuration parameters are successfully stored
RMAN-08591: WARNING: invalid archivelog deletion policy
這裏有個警告, 解決方法,執行如下命令:
SQL>alter system set "_log_deletion_policy"=ALL scope=spfile sid='*';
設置該參數以後,DB 需要重啓。
具體參考:
RMAN backups in Max Performance/Max Availability Data Guard Environment [ID 331924.1]
http://blog.csdn.net/tianlesoftware/archive/2011/03/07/6227944.aspx
修改之後,我們在設置:
RMAN> configure archivelog deletion policy to applied on standby;
using target database control file instead of recovery catalog
old RMAN configuration parameters:
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;
new RMAN configuration parameters:
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;
new RMAN configuration parameters are successfully stored
RMAN> configure archivelog deletion policy to none;
old RMAN configuration parameters:
CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON STANDBY;
new RMAN configuration parameters:
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE;
new RMAN configuration parameters are successfully stored
修改之後成功修改RMAN 的歸檔文件刪除策略。