RMAN can perform block media recovery rather than a full datafile recovery. While block media recovery is in progress, the affected datafiles can remain online and available to users.
There are a number of ways in which block corruption is detected. During a read or write operation from an insert or select statement, Oracle may detect a block is corrupt, write an error in a user trace file, and abort the transaction.
An RMAN backup or backup validate command can record corrupted blocks in the dynamic performance view V$DATABASE_BLOCK_CORRUPTION.
In addition, the SQL commands analyze table and analyze index could uncover corrupted blocks.
To recover one or more data blocks, RMAN must know the datafile number and block number within the datafile. This information is available in a user trace file, as in the following example:
ORA-01578: ORACLE DATA BLOCK CORRUPTED (FILE # 6, BLOCK # 403)
ORA-01110: DATA FILE 6: '/U09/ORADATA/ORD/OE_TRANS01.DBF'
RMAN> RECOVER DATAFILE 6 BLOCK 403;
# to recover all corrupted blocks
RMAN> BLOCKRECOVER CORRUPTION LIST;
# You can also recover individual blocks
RMAN> BLOCKRECOVER DATAFILE 7 BLOCK 233,235 DATAFILE 4 BLOCK 101
NOTE: The blockrecover command, available in previous releases of RMAN, has been deprecated in Oracle Database 11g in favor of the recover command; the syntax of the command is otherwise the same.