Oracle® Database Backup and Recovery User's Guide 11g Release 1 (11.1) Part Number B28270-01 |
|
|
View PDF |
This chapter explains how to check the integrity of database files and backups. This chapter includes the following topics:
This section explains the basic concepts and tasks involved in RMAN validation.
The main purpose of RMAN validation is to check for corrupt blocks and missing files. You can also use RMAN to determine whether backups can be restored. You can use the following RMAN commands to perform validation:
VALIDATE
BACKUP ... VALIDATE
RESTORE ... VALIDATE
See Also:
Oracle Database Backup and Recovery Reference for VALIDATE
syntax
Oracle Database Backup and Recovery Reference for RESTORE ... VALIDATE
syntax
The database prevents operations that result in unusable backup files or corrupted restored datafiles. The database automatically does the following:
Blocks access to datafiles while they are being restored or recovered
Permits only one restore operation for each datafile at a time
Ensures that incremental backups are applied in the correct order
Stores information in backup files to allow detection of corruption
Checks a block every time it is read or written in an attempt to report a corruption as soon as it has been detected
A corrupt block is a block that has been changed so that it differs from what Oracle Database expects to find. Block corruptions can be caused by a number of different failures including, but not limited to the following:
Faulty disks and disk controllers
Faulty memory
Oracle Database software defects
In a physical corruption, which is also called a media corruption, the database does not recognize the block at all: the checksum is invalid, the block contains all zeros, or the header and footer of the block do not match. In a logical corruption, the contents of the block are logically inconsistent. Examples of logical corruption include corruption of a row piece or index entry.
Block corruptions can also be divided into interblock corruption and intrablock corruption. In intrablock corruption, the corruption occurs within the block itself and can be either physical or logical corruption. In an interblock corruption, the corruption occurs between blocks and can only be logical corruption.
Oracle Database supports different techniques for detecting, repairing, and monitoring block corruption. The technique depends on the corruption type. For example, the V$DATABASE_BLOCK_CORRUPTION
view tracks intrablock corruptions, while the Automatic Diagnostic Repository (ADR) tracks all types of corruptions. Table 15-1 summarizes how the database treats different types of block corruption.
Table 15-1 Detection, Repair, and Monitoring of Block Corruption
Response | Intrablock Corruption | Interblock Corruption |
---|---|---|
Detection |
All database utilities detect intrablock corruption, including RMAN (for example, the |
Only DBVERIFY and the |
Tracking |
When any database utility or process encounters an intrablock corruption, it automatically records it in A repair removes metadata about corrupt blocks from the view. The |
The database monitors this type of block corruption in ADR. |
Repair |
Repair techniques include block media recovery, restoring datafiles, recovering by means of incremental backups, and block newing. Block media recovery can repair physical corruptions, but not logical corruptions. If you repair a block corruption, then the database removes the metadata for the corruption from the view. |
You must fix this block corruption by means of manual techniques such as dropping an object, rebuilding an index, and so on. |
You can use the VALIDATE
command to manually check for physical and logical corruptions in database files. This command performs the same types of checks as BACKUP VALIDATE
, but VALIDATE
can check a larger selection of objects. For example, you can validate individual blocks with the VALIDATE DATAFILE ... BLOCK
command.
When validating whole files, RMAN checks every block of the input files. If the backup validation discovers corrupt blocks, then RMAN updates the V$DATABASE_BLOCK_CORRUPTION
view with rows describing the corruptions.
Use VALIDATE BACKUPSET
when you suspect that one or more backup pieces in a backup set are missing or have been damaged. This command checks every block in a backup set to ensure that the backup can be restored. If RMAN finds block corruption, then it issues an error and terminates the validation. Note that VALIDATE BACKUPSET
enables you to choose which backups to check, whereas the VALIDATE
option of the RESTORE
command lets RMAN choose.
To use VALIDATE to check database files and backups:
Start an RMAN session on the target database.
Execute the VALIDATE
command with the desired options.
For example, to validate all datafiles and control files (and the server parameter file if one is in use), execute the following command at the RMAN prompt:
RMAN> VALIDATE DATABASE;
Alternatively, you can validate a particular backup set by using the form of the command shown in the following example (sample output included).
RMAN> VALIDATE BACKUPSET 22; Starting validate at 17-AUG-06 using channel ORA_DISK_1 allocated channel: ORA_SBT_TAPE_1 channel ORA_SBT_TAPE_1: SID=89 device type=SBT_TAPE channel ORA_SBT_TAPE_1: Oracle Secure Backup channel ORA_DISK_1: starting validation of datafile backup set channel ORA_DISK_1: reading from backup piece /disk1/oracle/work/orcva/RDBMS/backupset/2007_08_16/o1_mf_nnndf_TAG20070816T153034_2g774bt2_.bkp channel ORA_DISK_1: piece handle=/disk1/oracle/work/orcva/RDBMS/backupset/2007_08_16/o1_mf_nnndf_TAG20070816T153034_2g774bt2_.bkp tag=TAG20070816T153034 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: validation complete, elapsed time: 00:00:01 Finished validate at 17-AUG-06
The following example illustrates how you can check individual data blocks within a datafile for corruption.
RMAN> VALIDATE DATAFILE 1 BLOCK 10; Starting validate at 17-AUG-06 using channel ORA_DISK_1 channel ORA_DISK_1: starting validation of datafile channel ORA_DISK_1: specifying datafile(s) for validation input datafile file number=00001 name=/disk1/oracle/dbs/tbs_01.f channel ORA_DISK_1: validation complete, elapsed time: 00:00:01 List of Datafiles ================= File Status Marked Corrupt Empty Blocks Blocks Examined High SCN ---- ------ -------------- ------------ --------------- ---------- 1 OK 0 2 127 481907 File Name: /disk1/oracle/dbs/tbs_01.f Block Type Blocks Failing Blocks Processed ---------- -------------- ---------------- Data 0 36 Index 0 31 Other 0 58 Finished validate at 17-AUG-06
If you need to validate a large datafile, then RMAN can parallelize the work by dividing the file into sections and processing each file section in parallel. If multiple channels are configured or allocated, and if you want the channels to parallelize the validation, then specify the SECTION SIZE
parameter of the VALIDATE
command.
If you specify a section size that is larger than the size of the file, then RMAN does not create a multisection backup of the file. If you specify a small section size that would produce more than 256 sections, then RMAN increases the section size to a value that results in exactly 256 sections.
To parallelize the validation of a datafile:
Start an RMAN session on a target database, which must be mounted or open.
Execute VALIDATE
with the SECTION SIZE
parameter.
The following example allocates two channels and validates a large datafile. The section size is 1200 MB.
See Also:
Oracle Database Backup and Recovery Reference to learn about the VALIDATE
command
You can use the BACKUP VALIDATE
command to do the following:
Check datafiles for physical and logical block corruption
Confirm that all database files exist and are in the correct locations
When you run BACKUP
VALIDATE
, RMAN reads the files to be backed up in their entirety, as it would during a real backup. RMAN does not, however, actually produce any backup sets or image copies.
You cannot use the BACKUPSET
, MAXCORRUPT
, or PROXY
parameters with BACKUP VALIDATE
. To validate specific backup sets, run the VALIDATE
command.
To validate files with the BACKUP VALIDATE command:
Start an RMAN session on the target database.
Execute the BACKUP VALIDATE
command.
For example, you can validate that all database files and archived logs can be backed up by running a command as shown in the following example. This command checks for physical corruptions only.
BACKUP VALIDATE DATABASE ARCHIVELOG ALL;
To check for logical corruptions in addition to physical corruptions, run the following variation of the preceding command:
BACKUP VALIDATE CHECK LOGICAL DATABASE ARCHIVELOG ALL;
In the preceding examples, the RMAN client displays the same output that it would if it were really backing up the files. If RMAN cannot back up one or more of the files, then it issues an error message. For example, RMAN may show output similar to the following:
RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of backup command at 08/29/2007 14:33:47 ORA-19625: error identifying file /oracle/oradata/trgt/arch/archive1_6.dbf ORA-27037: unable to obtain file status SVR4 Error: 2: No such file or directory Additional information: 3
See Also:
Oracle Database Backup and Recovery Reference for BACKUP
syntax
Chapter 18, "Performing Block Media Recovery"to learn how to repair corrupt blocks discovered by BACKUP
VALIDATE
You can run RESTORE
...
VALIDATE
tests whether RMAN can restore a specific file or set of files from a backup. RMAN chooses which backups to use.
The database must be mounted or open for this command. You do not have to take datafiles offline when validating the restore of datafiles, because validation of backups of the datafiles only reads the backups and does not affect the production datafiles.
When validating files on disk or tape, RMAN reads all blocks in the backup piece or image copy. RMAN also validates offsite backups. The validation is identical to a real restore operation except that RMAN does not write output files.
Note:
As an additional test measure, you can perform a trial recovery with theRECOVER ... TEST
command. A trial recovery applies redo in a way similar to normal recovery, but it is in memory only and it rolls back its changes after the trial.To validate backups with the RESTORE
command:
Run the RESTORE
command the VALIDATE
option.
This following example illustrates validating the restore of the database and all archived redo logs:
RESTORE DATABASE VALIDATE; RESTORE ARCHIVELOG ALL VALIDATE;
If you do not see an RMAN error stack, then skip the subsequent steps. The lack of error messages means that RMAN had confirmed that it can use these backups successfully during a real restore and recovery.
If you see error messages in the output and the RMAN-06026
message, then investigate the cause of the problem. If possible, correct the problem that is preventing RMAN from validating the backups and retry the validation.
The following error means that RMAN cannot restore one or more of the specified files from your available backups:
RMAN-06026: some targets not found - aborting restore
The following sample output shows that RMAN encountered a problem reading the specified backup:
RMAN-03009: failure of restore command on c1 channel at 12-DEC-06 23:22:30 ORA-19505: failed to identify file "oracle/dbs/1fafv9gl_1_1" ORA-27037: unable to obtain file status SVR4 Error: 2: No such file or directory Additional information: 3
See Also:
Oracle Database Backup and Recovery Reference to learn about theRESTORE ... VALIDATE
command