Wednesday, December 30, 2015

Performing Rman Block-Level Recovery

In this post I want to explain how to do Block level recovery when we have a corrupt block in a datafile.

For performing Block recovery you should have the following conditions:

1.       We have online redo log files.
2.       We have a healthy backup.
3.       We have all archived redo logfiles.

Now we do recovery steps:

    1.       Identifying corrupt blocks:
you can see error in alert logfile and v$DATABASE_BLOCK_CORRUPTION

SQL> SELECT FILE#, BLOCK# FROM v$DATABASE_BLOCK_CORRUPTION;
FILE#    BLOCK#
------       -------
16           2532

2.       Recover the corrupt block:

RMAN> recover datafile 16 block 2532;
Or
RMAN>recover corruption list;


Block level corruption is uncommon and caused by some I/O error and It’s helpful when we have block corruption in few number of block are corrupt in a datafile.

With Backup Validate command Rman detect corruption in the blocks.

To validate the tablespace, use the following command: 
RMAN> backup validate tablespace tbs_test;

To validate a specific datafile, use the following command:
RMAN> backup validate datafile 8;
RMAN> VALIDATE DATAFILE 1 BLOCK 10;

To check the whole database, use the following command:
RMAN> backup validate database;

To check all archived redo logfiles, use the following command:
RMAN> backup validate archivelog all;

To check all archived redo log files and database:
RMAN>BACKUP VALIDATE DATABASE ARCHIVELOG ALL;

To check for logical corruptions in addition to physical corruptions:
RMAN>BACKUP VALIDATE CHECK LOGICAL DATABASE ARCHIVELOG ALL;

To check the spfile, use the following command:
RMAN> backup validate spfile;

To check the current control file, use the following command:
RMAN> backup validate current control file;

And also to check if a backup is valid and available for a restore operation we can use of following commands:

To check backup of the control file, use the following command:
RMAN> restore control file validate;

To check backup of the spfile, use the following command:
RMAN> restore spfile validate;

To check backup of tablespace users, use the following command:
RMAN> restore tablespace users validate;

To check backup of a datafile, use the following command:
RMAN> restore datafile 4 validate;

To check backup of all archived redo log files, use the following command:
RMAN> restore archivelog all validate;

To check backup of the whole database, use the following command:

RMAN> restore database validate;

No comments:

Post a Comment