rman刪除舊的歸檔日誌問題

shilei1發表於2012-12-11
rman: delete [all] input
資料庫oracle 11g 全備指令碼如下:
rman target /  <
run {
allocate channel t1 type disk; 
allocate channel t2 type disk; 
allocate channel t3 type disk; 
set limit channel t1 kbytes 4194304;
set limit channel t2 kbytes 4194304;
set limit channel t3 kbytes 4194304;
backup 
format '/u01/rman/full_MPdb_%U' 
(database include current controlfile);
backup 
format '/u01/rman/redolog_MPdb_%U'  archivelog all delete  input;
sql ' alter system archive log current';
release channel t1;
release channel t2;
release channel t3;
exit
EOF

以下是11g下的全備
rman target /  <
run {
allocate channel t1 type disk; 
allocate channel t2 type disk; 
set limit channel t1 kbytes 4194304;
set limit channel t2 kbytes 4194304;
backup full tag 'order' as compressed backupset database
include current controlfile
format '/u01/rman/full_MP_%d_%T_%s' 
plus archivelog
format '/u01/rman/redolog_MP_%d_%T_%s' delete all input;
delete noprompt obsolete;
release channel t1;
release channel t2;
exit
EOF

RMAN> show retention policy;

使用目標資料庫控制檔案替代恢復目錄
db_unique_name 為 ORAMP 的資料庫的 RMAN 配置引數為:
CONFIGURE RETENTION POLICY TO REDUNDANCY 3;

-----------------------------------------------------------------------------
問題是每次備份完後只刪除/u01/app/oracle/flash_recovery_area/ORACLE11/archivelog下的舊的歸檔日誌檔案
但是/u01/app/oracle/product/11.1.0/db_1/dbs下的歸檔日誌並沒有刪除

原因如下:
backup archivelog all delete input 和 backup archivelog all delete all input的區別是什麼?
有資料上說的是:
delete input 表示備份結束後刪除歸檔日誌
delete all input 表示備份結束後刪除所有歸檔日誌目錄檔案
做了試驗,沒有刪除目錄啊........
結論:
當有多個歸檔目錄時 例如:log_archive_dest_2 、log_archive_dest_1

--delete input後 log_archive_dest_2  中的archivelog並沒有被刪除(只刪除log_archive_dest_1中的)

如果delete all input,所有log_archive_dest_n中的備份的archivelog都會被刪除~

-----------------------------------------------------------------------------

還有注意的就是如果flash_recovery_area設定太小會出問題
ORA-00257: 歸檔程式錯誤。在釋放之前僅限於內部連線
檢查alert_log日誌原來是歸檔日誌佔滿了FLASH_RECOVERY_AREA 的2G空間。
解決方法1:先手工刪除D:\oracle\product\10.2.0\flash_recovery_area裡面的
日誌,
然後使用者用rman進入把歸檔日誌刪除
1)命令>rman target/
2)命令>crosscheck archivelog all;
3)命令>delete expired archivelog all;
4)命令>exit
上面第3個命令
delete noprompt  expired archivelog all; 其中noprompt 是不用手工確認.
解決方法2:改變了FLASH_RECOVERY_AREA的大小
修改命令>alter system set db_recovery_file_dest_size=8G scope=both;
檢視命令>show parameter db_recovery_file_dest_size

另外一個rman要注意地方,比如手工刪除rman的備份檔案,但rman認為沒有刪除,解決方法:
crosscheck backup ;
delete noprompt expired backup ;
這種方法可以解決 刪除無效的或手工通過rm刪除的問題。

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

上一篇: 'format' 詳解
rman刪除舊的歸檔日誌問題
請登入後發表評論 登入
全部評論

相關文章