Enhanced Block Media Recovery . - Oracle 11g

Block media recovery, which enables you to recover corrupt blocks in a datafile,was available in prior versions of the Oracle database.Random IO errors,as well as memory corruptions that are written to disk,are usually responsible for data block corruption.Block media recovery,by letting you restore and recover only the corrupted blocks in a datafile,enhances database availability.

The affected datafiles can remain online while you’re fixing the corrupt blocks.Block media recovery is an ideal solution for repairing physical corruption in a limited number of known data blocks and lets you avoid the costly alternative of a complete restore and recovery of the affected datafile.

During a block media recovery,RMAN searches the databasebackups for a good version of the corrupted data blocks.It first restores the good data blocks and then performs a recovery by using archived redo logs,just as it does in the case of a complete datafile recovery.Of course,the restore and recovery are way faster in a block media recovery operation, since you arerecovering only a limited number of data blocks,instead of recovering the entire datafile.

Before the Oracle Database 11g release, you used the block recover command to perform block media recovery.Using this command,you could specify a datafile (or a tablespace) and the data block numbers you wanted to recover In Oracle Database 11g, there is a new command to perform block media recovery, named the recover ...block command.The recover ... block command replaces the block recover command, which isn’t available in Oracle Database 11g.

The new recover ... block command is more powerful and efficient than the old blockrecover command,since it searches the flashback logs first before searching backups for the necessary good data blocks during data block corruption fixes.Searching the flashback logs is a whole lot quicker than searching the database backups for those same data blocks. Of course,RMAN will search the flashback logs for older uncorrupted versions of the corrupt blocks only if you happen to be using the flashback database feature and have enabled flashback logging.This is one more reason for you to implement the flashback database feature.

While the block media recovery is going on,any attempt by users to access data in the corrupt blocks will result in an errormessage, telling the user that the data block is corrupt.

Preconditions for Using the recover … block Command

To use the recover ... block command, you must meet the follow ing prerequisites:

  • The database must be mounted or open.
  • You must enable flashback logs if you want RMAN to first search the flashback logs for good versions of the corrupt blocks.
  • The database must be in archivelog mode, since RMAN needs the archived redo logs to perform the block recovery.
  • You can use only full or level 0 backups of the relevant datafiles, not proxy copies.

During a block media recovery,RMAN searches the flash back logs for good versions of the corrupted data blocks.Once it finds them,it’ll first restore the blocks and then perform a media recovery on those blocks,using archived redo logs for the recovery.Thus,archived redo logs are essential for the blockmedia recovery process to work.

If some redo records are missing,it’s possible that RMAN may still be able to recover the necessary block information from the archived redo logs. However if you have lost or can’t access an entire redo log file,block media recovery will fail.

Identifying the Corrupt Blocks

There are basically two types of data corruption: physical ormedia corru ption,where the database fails to recognize the corr upted data block,and logical corruption,where the database recogn izes the data block but the block’s contents are logically inconsi stent.Block media recovery can repair only the first kind of block corruption,in other words,physical corruption.

The V$DATABASE_BLOCK_CORRUPTION view always recordsinformation about the corrupt blocks when the databaseencounters one.The following commands will reveal corrupt data blocks and record that information in the V$DATABASE_BLOCK_CORRUPTION view:

  • analyze table and analyze index
  • list failure
  • validate
  • backup ... validate

Identifying the Corrupt Blocks

In addition,the dbverify utility will also reveal block corruption.The alert log as well as the user trace files will record the corruption messages.A typical block corruption message would look like this:

Once you see error messages such as this, it’s time to go work with the recover...block command to recover the corrupted data blocks, as we explain in the next section.

Using the recover … block Command

Once you identify corrupt data blocks, start RMAN,and issue the recover ... block command to fix the corrupted blocks. RMAN will automatically look in the flashback logs first before looking in the backups for a good version of the corrupted blocks.You can choose to fix only selected corrupt blocks or all corrupted blocks in one step. We show both methods in the following sections.

Recovering Specific Data Blocks

You can use the recover ... block command to recover one or a set of corrupt data blocks.You must specify the datafile number and the affected data blocks, as shown here:

You can specify various options such as the from backupset option,which specifies a certain backup set,or the from tag option, which specifies that RMAN must recover the corrupt data blocks from a backup with a specific tag. Here’s an example of how you can specify the from tag option:

You can,if you want, recover all corrupt blocks at once, as explained in the following section.

Recovering All Corrupt Data Blocks

Use the recover corruption list command to recover all corrupted data blocks that are listed in the V$DATABASE_BLOCK_CORRUPTION view.First, execute the validate database command to populate the V$DATABASE_BLOCK_CORRUPTION view with information about all physically corrupted data blocks in the database.Then run the recover corruption list command to recover all the corrupted blocks.

Let’s use a simple example to show how to recover all corrupt data blocks with the recover corruption list command. First issue the validate database command to see whether there are any corrupt data blocks in the database:

The output of the validate database command reveals that there are corrupt data blocks in some datafiles.You can also query the V$DATABASE_BLOCK_CORRUPTION view at this point to see whether corrupt data blocks exist.You can do this because the V$DATABASE_BLOCK_CORRUPTION view stores all the blocks marked corrupt by the validate database command.Issue recover corruption list to recover all the blocks marked corrupt in the V$DATABASE_BLOCK_CORRUPTION view.

once the database recovers all the physically corrupted data blocks, it removes the information about the previously corrupted data blocks from theV$DATABASE_ BLOCK_CORRUPTION view.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Oracle 11g Topics