As part of your backup-and-recovery strategy, you should periodically validate the integrity of the backup files.
This is also included as part of using RMAN to back up the database, but a separate job can run against them to validate for restore.
RMAN provides a RESTORE…VALIDATE command that checks for physical corruption within the backup files.
The following script starts RMAN and spools a log file. The log file is subsequently searched for the keyword error.
If there are any errors in the log file, an email is sent:
#!/bin/bash #
if [ $# -ne 1 ]; then
The RESTORE…VALIDATE does not actually restore any files; it validates only that the files required to restore the database are available and checks for physical corruption.
If you need to check for logical corruption as well, specify the CHECK LOGICAL clause.
For example, to check for logical corruption, the prior shell script would have this line in it:
restore database validate check logical;
For large databases the validation process can take a great deal of time (because the script checks each block in the backup file for corruption).
If you want to verify only that the backup files exist, specify the VALIDATE HEADER clause, like so:
restore database validate header;
This command checks only for valid information in the header of each file that would be required for a restore and recovery.
Leave a Reply