As an oracle backup and recovery tool, rman provides us with powerful functions, including physical and logical detection of data files and validity detection of backup files.
First, let's take a look at rman's detection of data files. We know that when rman backs up data, it reads the data into the read cache, and then writes the data from the read cache to the write cache and finally writes the data to the database. During the process from Read cache to write cache, rman performs physical consistency detection (db_block_checksum is not true) and logical consistency detection (the check logical option is used ). For example:
SQL> show parameter db_blockNAME TYPE VALUE types ------------- ------------------------------ db_block_buffers integer 0db_block_checking string FALSEdb_block_checksum string TRUEdb_block_size integer 8192SQL>
RMAN> backup tablespace test1; Starting backup at 2014-11-06 15: 12: 49 using channel ORA_DISK_1channel ORA_DISK_1: starting full datafile backupsetchannel ORA_DISK_1: specifying datafile (s) in backupsetinput datafile fno = 00005 name =/home/app/oraten/oradata/oraten/test01.dbfchannel ORA_DISK_1: starting piece 1 at 2014-11-06 15: 12: 50RMAN-00571: ========================================================== ============================== RMAN-00569: ================ error message stack follows ============================ RMAN-00571: ========================================================== ============================== RMAN-03009: failure of backup command on ORA_DISK_1 channel at 11/06/2014 15: 12: 51ORA-19566: exceeded limit of 0 blocks UPT blocks for file/home/app/oraten/oradata/oraten/test01.dbf
Sometimes, we just want to verify whether the data file can be backed up, rather than the real backup, we can use the validate command, as shown in
RMAN> backup validate database; Starting backup at 2014-11-06 15: 14: 23 using channel ORA_DISK_1channel ORA_DISK_1: starting full datafile backupsetchannel ORA_DISK_1: specifying datafile (s) in backupsetinput datafile fno = 00001 name =/home/app/oraten/oradata/oraten/system01.dbfinput datafile fno = 00003 name =/home/app/oraten/oradata/oraten/export datafile fno = 00002 name =/home/app/oraten/oradata/oraten/undotbs01.dbfinput datafile fno = 00005 name =/home/app/oraten/oradata/oraten/test01.dbfinput datafile fno = 00004 name = /home/app/oraten/oradata/oraten/users01.dbfchannel ORA_DISK_1: backup set complete, elapsed time: 00: 00: 01 channel ORA_DISK_1: starting full datafile backupsetchannel ORA_DISK_1: specifying datafile (s) in seconds current control file in seconds current SPFILE in backupsetchannel ORA_DISK_1: backup set complete, elapsed time: 00: 00: 03 Finished backup at 15:14:27
Note: no physical damaged block of test01.dbf is found here,
In my opinion, rman only reads data files into the read cache, but does not perform the following operations. That is to say, it has limited functions for detecting physical blocks. However, we can use it to detect the readability and location of physical files.
The descriptions in the official documentation are as follows:
VALIDATE Causes RMAN to scan the specified files and verify their contents, testing whether this file can be backed up. RMAN creates no output files. Use this
Command periodically to check for physical and logical errors in database files.
Use the validate command to verify the validity of the backup set. Official documentation:
To examine a backup set and report whether it can be restored. RMAN scans all of the backup pieces in the specified backup sets and looks at the checksums to verify that
The contents are intact so that the backup can be successfully restored if necessary. Use this command when you suspect that one or more backup pieces in a backup set
Are missing or have been damaged. Use validate backupset to specify which backups to test; use the VALIDATE option of the RESTORE command to let RMAN
Choose which backups to validate. For validating image copies, run RESTORE VALIDATE FROM DATAFILECOPY
Example:
RMAN> run {2> set maxcompute UPT for datafile 5 to 2; 3> backup database ;}
RMAN> validate backupset 84; using channel implements ORA_DISK_1: starting validation of datafile backupsetchannel ORA_DISK_1: reading from backup piece/home/app/oraten/flash_recovery_area/ORATEN/backupset/reply _. bkpchannel ORA_DISK_1: restored backup piece 1 piece handle =/home/app/oraten/flash_recovery_area/ORATEN/backupset/2014_11_06/o1_mf_nnndf_TAG20141106T152820_b5p8ro7v _. bkp tag = TAG20141106T152820channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
The validate command verifies the physical validity of the backup, not the physical validity of the data block stored in the backup.
RESTORE... PREVIEW
This command is used to preview the restore command. You can add preview to any resotre command to restore the preview. This command only reads the required backup metadata from the data dictionary without file verification.
You can apply RESTORE... PREVIEW to any RESTORE operation to create a detailed list of every backup to be used in the requested RESTORE operation, as well as the necessary target SCN for recovery after the RESTORE operation is complete. this command accesses the RMAN repository to query the backup metadata, but does not actually read the backup files to ensure that they can be restored.
RMAN> restore database preview; Starting restore at 2014-11-06 15: 44: 28 using channel ORA_DISK_1List of Backup Sets ======================== BS Key Type LV Size Device Type Elapsed Time Completion Time ------------- ---------- ----------- ------------ ------------------- 84 Full 551.76 m disk 00:00:18 15:28:24 BP Key: 52 Status: AVAILABLE Compressed: NO Tag: TAG20141106T152820 Piece Name:/home/app/oraten/flash_recovery_area/ORATEN/backupset/2014_11_06/o1_mf_nnndf_TAG20141106T152820_b5p8ro7v _. bkp List of Datafiles in backup set 84 File LV Type Ckp SCN Ckp Time Name ---- ----------------------- ---- 1 Full 922948 15:28:20/home/app/oraten/oradata/oraten/system01.dbf 2 full 922948 15:28:20/home/app/oraten/oradata/oraten/undotbs01.dbf 3 Full 922948 15:28:20/home/app/oraten/oradata/oraten/sysaux01.dbf 4 Full 922948 15:28:20/home /app/oraten/oradata/oraten/users01.dbf 5 Full 922948 15:28:20/home/app/oraten/oradata/oraten/test01.dbfarchive logs generated after SCN 922948 not found in repositoryMedia recovery start SCN is 922948 Recovery must be done beyond SCN 922948 to clear data files fuzzinessFinished restore at 15:44:28
RECOVER... TEST: simulates the recover process in the memory and does not perform a real recovery. You can use this command to detect problems in the recovery. Note that the simulated recovery and normal recovery may encounter different problems.
A simulated recovery initiated with the RECOVER... TEST command in RMAN or SQL * Plus. A trial recovery applies redo in a way similar to normal media recovery, but it never writes its changes to disk and it always rolls back its changes. trial recovery occurs only in memory.
Trial recovery lets you foresee what problems might occur if you were to continue with normal recovery. For problems caused by ongoing memory resume uption, trial recovery and normal recovery can encounter different errors.
Validate command-rman for backup and reply verification