Wednesday, April 23, 2008

Use RMAN to Validate Before and After taking backup

If you want to verify whether there any physical or logical corruptions in database file before taking backup you can use the VALIDATE option of the BACKUP command.When performing a BACKUP... VALIDATE, RMAN reads the files to be backed up in their entirety, as it would during a real backup. It does not, however, actually produce any backup sets or image copies.

If the backup validation discovers corrupt blocks, then RMAN updates the V$DATABASE_BLOCK_CORRUPTION view with rows describing the corruptions.

Also with RMAN RESTORE ... VALIDATE before restore database or any datafile you can verify whether database can successfully restored or not.

An example:Before Performing Backup Check Any Physical or Logical Corruption:
SQL> !rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Apr 23 17:15:24 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database: DATA1 (DBID=2547250380)
RMAN> backup validate database;

Starting backup at 23-APR-08
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
.
.
.
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 23-APR-08

After Backup Check if they can be Restored Successfully Using Validate BackupSet

RMAN> validate backupset 4;

using channel ORA_DISK_1
channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece /oracle/app/oracle/product/10.2.0/db_1/dbs/05jei8qh_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/oracle/app/oracle/product/10.2.0/db_1/dbs/05jei8qh_1_1 tag=TAG20080423T165857
channel ORA_DISK_1: validation complete, elapsed time: 00:00:25

Using RESTORE .. VALIDATE
RMAN> restore database validate;

Starting restore at 23-APR-08
using channel ORA_DISK_1

channel ORA_DISK_1: starting validation of datafile backupset
channel ORA_DISK_1: reading from backup piece /oracle/app/oracle/product/10.2.0/db_1/dbs/0bjeiams_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/oracle/app/oracle/product/10.2.0/db_1/dbs/0bjeiams_1_1 tag=TAG20080423T173108
channel ORA_DISK_1: validation complete, elapsed time: 00:00:04
Finished restore at 23-APR-08

You can also validate single tablespace or datafile or any other like,
RMAN> restore datafile 1 validate;
RMAN> restore tablespace system validate;
RMAN> restore controlfile validate;
RMAN> restore spfile validate;


Related Documents:
Verify Physical Data Structure

No comments:

Post a Comment