(1)BACKUP ... VALIDATE
(3)RESTORE ... VALIDATE
(4)RESTORE ... PREVIEW
(5)RECOVER ... TEST
check logical 选项
一、BACKUP ... VALIDATE 命令
You can use the BACKUP VALIDATE command to do the following:
(1)Check datafiles for physical and logical block corruption
(2)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.
backup validate database archivelog all;
backup validate check logical database archivelog all;
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.
VALIDATE BACKUPSET xxx；
VALIDATE DATAFILE 1 BLOCK 10;
validate recovery area;
并行validate:Run VALIDATE with the SECTION SIZE parameter. The following example allocates two channels and validates a large datafile. The section size is 1200 MB.
ALLOCATE CHANNEL c1 DEVICE TYPE DISK;
ALLOCATE CHANNEL c2 DEVICE TYPE DISK;
VALIDATE DATAFILE 1 SECTION SIZE 1200M;
三、RESTORE ... VALIDATE 命令
检验是否可以从备份中restore, 只读取backup file，不影响production datafiles,没有生成输出文件。
Validating Backups Before Restoring Them
You can run RESTORE ... VALIDATE to test 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.
RESTORE DATABASE VALIDATE;
RESTORE ARCHIVELOG ALL VALIDATE;
restore spfile validate;
restore controlfile validate;
restore archivelog all validate;
restore archivelog sequence 45 validate;
restore archivelog from time ‘sysdate-1′ validate;
RESTORE DATABASE VALIDATE不能保证可以restore得到archivelog作apply，需要单独对archivelog作RESTORE ARCHIVELOG ... VALIDATE
四、RESTORE ... PREVIEW命令
可以在任何resotre命令后加上preview来进行还原(restore)的预演，这个命令只是从数据字典读出需要的备份的元数据，不进行文件的验证。如果要验证可以用RESTORE ... VALIDATE HEADER命令。
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.
As an alternative to RESTORE ... PREVIEW, you can use the RESTORE ... VALIDATE HEADER command. In addition to listing the files needed for restore and recovery, the RESTORE ... VALIDATE HEADER command validates the backup file headers to determine whether the files on disk or in the media management catalog correspond to the metadata in the RMAN repository.
When planning your restore and recovery operation, use RESTORE ... PREVIEW or RESTORE ... VALIDATE HEADER to ensure that all required backups are available or to identify situations in which you may want to direct RMAN to use or avoid specific backups.
RESTORE DATABASE PREVIEW;
RESTORE ARCHIVELOG FROM TIME 'SYSDATE-7' PREVIEW;
RESTORE DATABASE PREVIEW SUMMARY;
五、RECOVER ... TEST命令
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 corruption, trial recovery and normal recovery can encounter different errors.
RECOVER DATABASE TEST
RECOVER DATABASE USING BACKUP CONTROLFILE UNTIL CANCEL TEST
RECOVER TABLESPACE users TEST
RECOVER DATABASE UNTIL CANCEL TEST
配合validate/backup validate/ restore validate 使用， 在数据和索引通过了物理检查后，进行逻辑检查以发现逻辑错误。
Tests data and index blocks that pass physical corruption checks for logical corruption, for example, corruption of a row piece or index entry. If RMAN finds logical corruption, then it logs the block in the alert log and server session trace file.
If the total number of physical and logical corruptions detected in a file is less than its SET MAXCORRUPT setting, then the RMAN command completes and the database populates the V$DATABASE_BLOCK_CORRUPTION view with corrupt block ranges. If MAXCORRUPT is exceeded, then the command terminates without populating the views.
When restoring a backup datafile, RMAN honors the DB_BLOCK_CHECKSUM initialization parameter setting. RMAN clears the checksum if DB_BLOCK_CHECKSUM is set to false. If set to typical, then RMAN verifies the checksum when restoring from the backup and writing to the datafile. If the initialization parameter DB_BLOCK_CHECKSUM=typical, and if MAXCORRUPT is not set, then specifying CHECK LOGICAL detects all types of corruption that are possible to detect.
Note: The MAXCORRUPT setting represents the total number of physical and logical corruptions permitted on a file.
validate database check logical;
backup validate check logical database archivelog all;
restore database validate check logical;
来自 “ ITPUB博客 ” ，链接：http://blog.itpub.net/22207394/viewspace-1075132/，如需转载，请注明出处，否则将追究法律责任。