在论坛上看到有人提问要删除指定时间点之前的归档日志,根据大家的回答,我也简单的进行了以下测试,以下是测试过程:
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
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/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/11590946/viewspace-750335/