帶庫或VTL作為關鍵業務的備份,雖在普通用戶接觸較少,但總體使用量還是比較大。
很多實例在做專業備份軟件的同時會采用disk方式在本地或共享地址上再備一次,如果專業備份軟件采用的是帶庫或VTL方式進行存儲,在cross check後發現存在大量的備份集仍然無法刪除,可以參考本文。
export ORACLE_SID=bzzh1 date >> /home/oracle/rman_log/rman_delete.log rman target / append << EOF configure device type disk parallelism 16; allocate channel for maintenance device type disk; run { crosscheck backup; delete expired backup; crosscheck archivelog all; delete noprompt obsolete device type disk; delete noprompt expired archivelog all; } release channel; ##for TAPE## allocate channel for maintenance device type 'sbt_tape'; run { crosscheck backup; delete expired backup; crosscheck archivelog all; delete noprompt obsolete device type 'sbt_tape'; delete noprompt expired archivelog all; } release channel; EOF date >> /home/oracle/rman_log/rman_delete.log
需要注意,僅當backupset的Device Type為SBT_TAPE是參考本文才有意義。
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 3177 Incr 0 256.00K SBT_TAPE 00:00:47 30-JUL-15 BP Key: 3137 Status: AVAILABLE Compressed: NO Tag: HOT_DB_BK_LEVEL0 Handle: bk_3229_1_886451722 Media: SPFILE Included: Modification time: 10-JUL-15 BS Key Size Device Type Elapsed Time Completion Time ------- ---------- ----------- ------------ --------------- 3179 83.75M SBT_TAPE 00:00:57 30-JUL-15 BP Key: 3139 Status: AVAILABLE Compressed: NO Tag: TAG20150730T203744 Handle: al_3230_1_886451865 Media: List of Archived Logs in backup set 3179 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- --------- ---------- --------- 1 4005 12030094721658 30-JUL-15 12030095358801 30-JUL-15 1 4006 12030095358801 30-JUL-15 12030095373861 30-JUL-15