Managing Obsolete and Expired Backups in Oracle RMAN

When managing backups in Oracle RMAN (Recovery Manager), it’s essential to understand the difference between obsolete and expired backups. This distinction is key for keeping your storage clean and ensuring your database is recoverable within your desired retention policy.

Obsolete vs. Expired Backups

  • Obsolete backups: These are backups that fall outside of your retention policy. For example, if you’ve configured RMAN with a retention policy of RECOVERY WINDOW 7 DAYS, any backups older than 7 days will be considered obsolete. RMAN automatically identifies and deletes these backups when necessary, meaning you don’t need to intervene manually. Example retention policy commands:
  CONFIGURE RETENTION POLICY TO RECOVERY WINDOW 7 DAYS;
  CONFIGURE RETENTION POLICY TO REDUNDANCY 7;
  • Expired backups: These are backups that still exist in RMAN’s metadata but have been physically deleted from the system. This often happens if a file was removed directly using OS commands like rm -rf .... RMAN still tracks these backups, even though they no longer exist on disk.

Handling Expired Backups with RMAN

To handle expired backups, RMAN provides the command DELETE EXPIRED BACKUP, which removes entries of backups that no longer exist physically but are still listed in RMAN’s repository.

Here’s the process to manage expired backups effectively:

  1. Crosscheck your backups: This ensures that RMAN verifies the actual physical presence of each backup. If backups are missing, they will be marked as expired.
   RMAN> CROSSCHECK BACKUP;
  1. Delete expired backups: After identifying expired backups, use the following command to clean up the RMAN repository.
   RMAN> DELETE EXPIRED BACKUP;

Example Workflow

If you delete backup files manually using a command like:

rm -rf /path/to/backup/files

RMAN will not automatically know about this deletion. To synchronize RMAN’s metadata, you should first run the crosscheck command, followed by delete expired backup to remove outdated entries from the catalog.

RMAN> CROSSCHECK BACKUP;
RMAN> DELETE EXPIRED BACKUP;

Automatic Cleanup of Obsolete Backups

One of RMAN’s strengths is its ability to automatically delete obsolete backups based on your retention policy. Once a backup is identified as obsolete (outside the recovery window or redundancy level), RMAN can manage these files without manual intervention. This ensures your system stays clean and efficient, saving space while maintaining recoverability.

Conclusion

Managing backups in RMAN is straightforward when you understand the distinction between obsolete and expired backups. Use the CROSSCHECK and DELETE EXPIRED BACKUP commands to keep RMAN’s repository aligned with the actual state of your storage, and trust RMAN’s retention policy to handle obsolete backups automatically.

Leave a Reply

Your email address will not be published. Required fields are marked *