首页 » ORACLE » delete obsolete和delete expired区别

delete obsolete和delete expired区别

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.

打赏

目前这篇文章有2条评论(Rss)评论关闭。

  1. Dorsey Cobrin | #1
    2011-12-21 at 06:33

    I went over this site and I conceive you have a lot of fantastic information, saved to my bookmarks (:.

  2. Irish | #2
    2011-06-23 at 09:09

    Hey, subtle must be your mdidle name. Great post!