Validate and clean up RMAN backup records (CROSSCHECK, EXPIRED, OBSOLETE)
OracleRMANCommand
SHOW RETENTION POLICY;
# 1) Compare records with the physical files (missing ones become EXPIRED):
CROSSCHECK BACKUP;
CROSSCHECK COPY;
CROSSCHECK ARCHIVELOG ALL;
# 2) Review before deleting:
LIST EXPIRED BACKUP;
LIST EXPIRED ARCHIVELOG ALL;
REPORT OBSOLETE;
# 3) Clean up:
DELETE NOPROMPT EXPIRED BACKUP;
DELETE NOPROMPT EXPIRED COPY;
DELETE NOPROMPT EXPIRED ARCHIVELOG ALL;
DELETE NOPROMPT OBSOLETE;What it does
CROSSCHECK checks whether the backups in the RMAN records still exist on disk/tape; DELETE EXPIRED removes the records of missing files, and DELETE OBSOLETE deletes backups no longer needed by the retention policy from both the records and the disk.
When to use it
When backup files were deleted/moved at the OS level, when the FRA fills up, and as part of the regular backup maintenance job.
Caution
DELETE OBSOLETE physically deletes files; verify the list with REPORT OBSOLETE first and make sure the retention policy (RECOVERY WINDOW / REDUNDANCY) is what you expect. If you run CROSSCHECK while the tape/media manager is temporarily unreachable, valid backups show as EXPIRED; do not run DELETE EXPIRED at that moment.
Related
- Create an RMAN recovery catalog and register the database
- Create a physical standby from the active database with RMAN DUPLICATE
- Validate the database and backups against corruption (VALIDATE)
- See which backups a restore would use and validate them (PREVIEW / VALIDATE)
- Repair corrupt blocks online (block media recovery, RECOVER CORRUPTION LIST)
- Return a tablespace to a point in the past (TSPITR)