rman 刪除指定時間點的歸檔日誌

super_sky發表於2012-11-30
在論壇上看到有人提問要刪除指定時間點之前的歸檔日誌,根據大家的回答,我也簡單的進行了以下測試,以下是測試過程:

RMAN> list archivelog all;


List of Archived Log Copies
Key     Thrd Seq     S Low Time            Name
------- ---- ------- - ------------------- ----
74      1    47      A 2012-11-23 02:45:35 /ora10g/arch/1_47_797703448.dbf
75      1    48      A 2012-11-26 19:19:02 /ora10g/arch/1_48_797703448.dbf
76      1    49      A 2012-11-26 19:41:53 /ora10g/arch/1_49_797703448.dbf
77      1    50      A 2012-11-27 01:53:45 /ora10g/arch/1_50_797703448.dbf
78      1    51      A 2012-11-28 01:00:44 /ora10g/arch/1_51_797703448.dbf
79      1    52      A 2012-11-28 22:27:35 /ora10g/arch/1_52_797703448.dbf
80      1    53      A 2012-11-29 05:50:56 /ora10g/arch/1_53_797703448.dbf
81      1    54      A 2012-11-29 22:00:33 /ora10g/arch/1_54_797703448.dbf

RMAN>

RMAN> delete archivelog all completed before 'trunc(sysdate-1)+2/24';

released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=257 devtype=DISK

List of Archived Log Copies
Key     Thrd Seq     S Low Time            Name
------- ---- ------- - ------------------- ----
74      1    47      A 2012-11-23 02:45:35 /ora10g/arch/1_47_797703448.dbf
75      1    48      A 2012-11-26 19:19:02 /ora10g/arch/1_48_797703448.dbf
76      1    49      A 2012-11-26 19:41:53 /ora10g/arch/1_49_797703448.dbf
77      1    50      A 2012-11-27 01:53:45 /ora10g/arch/1_50_797703448.dbf
78      1    51      A 2012-11-28 01:00:44 /ora10g/arch/1_51_797703448.dbf

Do you really want to delete the above objects (enter YES or NO)? yes
deleted archive log
archive log filename=/ora10g/arch/1_47_797703448.dbf recid=74 stamp=800392743
deleted archive log
archive log filename=/ora10g/arch/1_48_797703448.dbf recid=75 stamp=800394114
deleted archive log
archive log filename=/ora10g/arch/1_49_797703448.dbf recid=76 stamp=800416426
deleted archive log
archive log filename=/ora10g/arch/1_50_797703448.dbf recid=77 stamp=800499645
deleted archive log
archive log filename=/ora10g/arch/1_51_797703448.dbf recid=78 stamp=800576855
Deleted 5 objects

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

相關文章