05 Sep RMAN : How to verify I have a consistent backup
The other day I was asked How can I verify that the backup I took was a good backup. For this RMAN has several commands to verify the integrity of these.
All the commands used below do not perform an actual recovery , it only reads and validates the backups , what I do have to say though is that is the word VALIDATE is missing in some commands and depending on which state you have your DB , it will actually start to do the restore process, so be very careful that you include that word.
Here are the commands I used for this exercise, also note that it doesn’t matter if the channel you are allocating is to DISK or to SBT, in this case I used DISK
- RESTORE DATABASE PREVIEW ;
- RESTORE DATABASE VALIDATE;
- RESTORE ARCHIVELOG FROM sequence xx UNTIL SEQUENCE yy THREAD nn VALIDATE;
- RESTORE CONTROLFILE VALIDATE;
- RESTORE SPFILE VALIDATE;
The first thing that you have to do is, if you are not going to use the latest backup, define the time that you want to validate your backup, the first command that we are going to use is RESTORE . . . PREVIEW, this command identifies the needed backup(s) to execute the restore process as well as the Archived Redo Logs needed.
The next step, which is RESTORE DATABASE VALIDATE, it will read the pieces of the backup and if it finds an error it will report it.
If you looked closely at the result above, this only read the backupset which contain the datafiles, not the Archived Redo Logs, so now we have to verify the integrity of these, as these will also be needed if the backup was an inconsistent backup (Hot Backup). What I recommend is that you get the value of the needed Archived Redo Logs from result of the RESTORE…PREVIEW, once you have these values, run the command RESTORE ARCHIVELOG. . . VALIDATE
To end this , we just need to validate that we can restore the control file and our binary parameter file
These commands even though they are simple, they are very powerful to validate your backups, mi recommendation is that you run this at least once a week , as you don’t want to be in a situation in which you need to perform a restore and in that moment find out that you don’t have a valid backup or a valid backup strategy.