delete exipired
If you run CROSSCHECK, and if RMAN cannot locate the files, then it updates their records in the RMAN repository to EXPIRED status. You can then use the DELETE EXPIRED command to remove records of expired backups and copies from the RMAN repository.
delete obsolete
The RMAN DELETE command supports an OBSOLETE option, which deletes backups that are no longer needed to satisfy specified recoverability requirements. You can delete files obsolete according to the configured default retention policy, or another retention policy that you specify as an option to the DELETE OBSOLETE command. As with other forms of the DELETE command, the files deleted are removed from backup media, deleted from the recovery catalog, and marked as DELETED in the control file.
[oracle@orazhang ~]$ rm /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_19/o1_mf_1_43_6tv5dcbn_.arc
[oracle@orazhang ~]$ rman target/
Recovery Manager: Release 10.2.0.1.0 - Production on 星期一 4月 25 14:32:26 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1246063822)
RMAN> crosscheck archivelog all;
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=147 devtype=DISK
validation succeeded for archived log
archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_12/o1_mf_1_37_6t8pqv6c_.arc recid=345 stamp=748303229
validation succeeded for archived log
archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_13/o1_mf_1_38_6t9zmjpb_.arc recid=346 stamp=748345073
validation succeeded for archived log
archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_13/o1_mf_1_39_6tcc374o_.arc recid=347 stamp=748389608
validation succeeded for archived log
archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_18/o1_mf_1_40_6tq3mgso_.arc recid=348 stamp=748775161
validation succeeded for archived log
archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_18/o1_mf_1_41_6tq8hryh_.arc recid=349 stamp=748780153
validation succeeded for archived log
archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_18/o1_mf_1_42_6tqkcckb_.arc recid=350 stamp=748789228
validation failed for archived log
archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_19/o1_mf_1_43_6tv5dcbn_.arc recid=351 stamp=748908044
....
RMAN> delete obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
using channel ORA_DISK_1
no obsolete backups found
RMAN> delete expired archivelog all;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=147 devtype=DISK
List of Archived Log Copies
Key Thrd Seq S Low Time Name
------- ---- ------- - ---------- ----
351 1 43 X 18-4月 -11 /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_19/o1_mf_1_43_6tv5dcbn_.arc
Do you really want to delete the above objects (enter YES or NO)? no
--ps:可以简单的认为,crosscheck 会检查更新每个archivelog的物理文件是否存在的状态,用delete expired 可以删除文件不存在而rman备份存在的记录;delete obsolete 是把旧于备份保留策略定义的备份数据同时也更新RMAN资料库以及控制文件,同时也应用于数据文件、控制文件、也有控制文件,是通过CONFIGURE RETENTION POLICY 来定义的策略的。
疑问:不知道为什么delete obsolete时,默认会删除早于14天的归档日志?
Besides affecting the data file and control file backups, the retention policy affects archived redo logs and archived redo log backups. First, RMAN decides which data file and control file backups are obsolete. Then, RMAN considers the archived redo log backups (that are older than the oldest data file or control file backup that must be retained) as obsolete.
If you run CROSSCHECK, and if RMAN cannot locate the files, then it updates their records in the RMAN repository to EXPIRED status. You can then use the DELETE EXPIRED command to remove records of expired backups and copies from the RMAN repository.
delete obsolete
The RMAN DELETE command supports an OBSOLETE option, which deletes backups that are no longer needed to satisfy specified recoverability requirements. You can delete files obsolete according to the configured default retention policy, or another retention policy that you specify as an option to the DELETE OBSOLETE command. As with other forms of the DELETE command, the files deleted are removed from backup media, deleted from the recovery catalog, and marked as DELETED in the control file.
[oracle@orazhang ~]$ rm /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_19/o1_mf_1_43_6tv5dcbn_.arc
[oracle@orazhang ~]$ rman target/
Recovery Manager: Release 10.2.0.1.0 - Production on 星期一 4月 25 14:32:26 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORCL (DBID=1246063822)
RMAN> crosscheck archivelog all;
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=147 devtype=DISK
validation succeeded for archived log
archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_12/o1_mf_1_37_6t8pqv6c_.arc recid=345 stamp=748303229
validation succeeded for archived log
archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_13/o1_mf_1_38_6t9zmjpb_.arc recid=346 stamp=748345073
validation succeeded for archived log
archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_13/o1_mf_1_39_6tcc374o_.arc recid=347 stamp=748389608
validation succeeded for archived log
archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_18/o1_mf_1_40_6tq3mgso_.arc recid=348 stamp=748775161
validation succeeded for archived log
archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_18/o1_mf_1_41_6tq8hryh_.arc recid=349 stamp=748780153
validation succeeded for archived log
archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_18/o1_mf_1_42_6tqkcckb_.arc recid=350 stamp=748789228
validation failed for archived log
archive log filename=/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_19/o1_mf_1_43_6tv5dcbn_.arc recid=351 stamp=748908044
....
RMAN> delete obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
using channel ORA_DISK_1
no obsolete backups found
RMAN> delete expired archivelog all;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=147 devtype=DISK
List of Archived Log Copies
Key Thrd Seq S Low Time Name
------- ---- ------- - ---------- ----
351 1 43 X 18-4月 -11 /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2011_04_19/o1_mf_1_43_6tv5dcbn_.arc
Do you really want to delete the above objects (enter YES or NO)? no
--ps:可以简单的认为,crosscheck 会检查更新每个archivelog的物理文件是否存在的状态,用delete expired 可以删除文件不存在而rman备份存在的记录;delete obsolete 是把旧于备份保留策略定义的备份数据同时也更新RMAN资料库以及控制文件,同时也应用于数据文件、控制文件、也有控制文件,是通过CONFIGURE RETENTION POLICY 来定义的策略的。
疑问:不知道为什么delete obsolete时,默认会删除早于14天的归档日志?
Besides affecting the data file and control file backups, the retention policy affects archived redo logs and archived redo log backups. First, RMAN decides which data file and control file backups are obsolete. Then, RMAN considers the archived redo log backups (that are older than the oldest data file or control file backup that must be retained) as obsolete.
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




