Rman Recovery: Purpose of Complete Database Recovery
Rman Recovery: Purpose of Complete Database Recovery
Rman Recovery: Purpose of Complete Database Recovery
To see the corruption, run the backup validate database command from RMAN and
check the v$database_block_corrupton view.
RMAN> backup validate database;
( easy technique for determining which datafiles are missing is to run a VALIDATE DATABASE command)
SQL>
FILE#
BLOCK#
BLOCKS CORRUPTION_CHANGE# CORRUPTION
---------- ---------- ---------- ------------------ ---------5
13
1
0 CHECKSUM
6
13
1
0 CHECKSUM
4
69
1
0 CHECKSUM
If you are RESTORING SOME DATAFILES TO NEW LOCATIONS, then execute RESTORE
TABLESPACE and RECOVER TABLESPACE in a RUN command. Use the SET NEW_NAME to rename datafiles,
as described in "Restoring Datafiles to a Nondefault Location".
The following example restores the datafiles in tablespaces users to a new location, then performs
recovery. Assume that the Old Datafiles were stored in the /disk1 path and the New Ones will be stored
in the /disk2 path.
RUN
{
# specify the new location for each datafile
SET NEWNAME FOR DATAFILE '/disk1/oracle/dbs/users01.f' TO
'/disk2/users01.f';
SET NEWNAME FOR DATAFILE '/disk1/oracle/dbs/users02.f' TO
'/disk2/users02.f';
SET NEWNAME FOR DATAFILE '/disk1/oracle/dbs/users03.f' TO
'/disk2/users03.f';
RESTORE TABLESPACE users;
SWITCH DATAFILE ALL;
# update control file with new filenames
RECOVER TABLESPACE users;
}
SQL "ALTER TABLESPACE users ONLINE";
target database must run in ARCHIVELOG mode and be open or mounted with a current
control file
RMAN can use only archived redo logs for the recovery.
Obtain the datafile numbers and block numbers of the corrupted blocks
locate trace files and the alert log is to connect SQL*Plus to the target database and execute the following
query:
SELECT NAME, VALUE
FROM
V$DIAG_INFO;
Start RMAN and connect to the target database, which must be mounted or open
Run the SHOW ALL command to make sure that the appropriate channels are preconfigured.
Recovers two blocks.
RECOVER
DATAFILE 8 BLOCK 13
DATAFILE 2 BLOCK 19;
You want to recover data lost after DDL operations that change the structure of tables. You
cannot use Flashback Table to rewind a table to before the point of a structural change such as
a truncate table operation.
You want to recover a table after it has been dropped with the PURGE option.
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
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;
The following example illustrates how you can check individual data blocks within a datafile for
corruption.
RMAN> VALIDATE DATAFILE 1 BLOCK 10;
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;