Thursday, March 3, 2011

Oracle RMAN: Unexpiring Database Backups in Bulk

Quick Description:  On a recent Disaster Recovery drill, we ended up with a disparity between the date of the RMAN catalog database and the backup files it keeps track of. 

Normally, the backup catalog and raw backup files would be in sync.  In our recent DR drill, we had a problem with the catalog on tape and had to restore a more recent copy of the catalog database.  The  database was several days newer than the raw files, and it expected that the files in question were no longer online.  RMAN came up after restoring the catalog.  A restore set to an 'until time' which was  available in the raw backup files started, but RMAN immediately failed to find a copy of any of the datafiles in the database.  Running a 'list backup' showed that the backups for the target date were now expired.

There is a very tedious process for unexpiring backups individually.  This involves checking the backup list for the files from the target time (or just the available files), determining their BS key, listing the backupset for that BS Key, and then setting the backupset to available for each individual BS key (change backupset available).  If you have only one expired backupset this may be feasible.  We had thousands of raw files.

If you just want to force the RMAN catalog to set all backups which are available on disk to available in the catalog, the command is much more simple.   In the RMAN shell, while connected to the rman catalog, and the target, send the command:
crosscheck backup;

This will check all backups in the catalog to see if they are available at the location stored in the catalog.  It will set available backups to available, and expire backups which are not on disk.

This was a lifesaver for our DR drill.

No comments:

Post a Comment