Get in touch: [email protected]

Validating Backup Files Before Restoring – RMAN Backups and Reporting

There are several levels of verification that you can perform on backup files without actually restoring anything. If you just want RMAN to verify that the files exist and check the file headers, then use the RESTORE … VALIDATE HEADER command, as shown here:

RMAN> restore database validate header;

The command only validates the existence of backup files and checks the file headers. You can further instruct RMAN to verify the integrity of blocks within backup files required to restore the database data files via the RESTORE … VALIDATE command without the HEADER clause. Again, RMAN will not restore any data files in this mode:

RMAN> restore database validate;

This command checks only for physical corruption within the backup files. You can also check for logical corruption as follows:

RMAN> restore database validate check logical;

Here are some other examples of using RESTORE … VALIDATE:

RMAN> restore datafile 1, 2, 3 validate;

RMAN> restore pluggable database mmpdb validate; RMAN> restore controlfile validate;

This first step in doing the restore and recovery is important to make sure the files are available for the complete restore.

The command does not take long to run and allows you to make sure with the preview command you know what needs to be restored and validated so you know you have files that are available.

Testing Media Recovery

The prior sections covered reporting and verifying the restore operations. You can also instruct RMAN to verify the recovery process via the RECOVER…TEST command. Before performing a test recovery, you need to ensure that the data files being recovered are offline. Oracle will throw an error for any online data files being recovered in test mode.

In this example, the tablespace USERS is restored first, and then a trial recovery is performed:

RMAN> connect target / RMAN> startup mount;

RMAN> restore tablespace users; RMAN> recover tablespace users test;

If there are any missing archive redo logs that are required for recovery, the following error is thrown:

RMAN-06053: unable to perform media recovery because of missing log RMAN-06025: no backup of archived log for thread 1 with sequence 6 …

If the testing of the recovery succeeded, you will see messages such as the following, indicating that the application of redo was tested but not applied:

ORA-10574: Test recovery did not corrupt any data block

ORA-10573: Test recovery tested redo from change 4586939 to 4588462 ORA-10572: Test recovery canceled due to errors

ORA-10585: Test recovery can not apply redo that may modify control file

Here are some other examples of testing the recovery process:

RMAN> recover database test;

RMAN> recover tablespace users, tools test; RMAN> recover datafile 1,2,3 test;