Tuesday, October 6, 2009

RMAN (9i onwards) ONLINE BLOCK CORRUPTION FIX

From 9i onwards you can use RMAN to recover only blocks while database is up and running.

This could possibly save hours and hours of recovery time as a full database restore is not necessary.

Error reported by user pointing to block corruption.

An error encountered in Populate MACS DATA process.
The Error - Source : POPULATE_MACSDATA - ORA-01578: ORACLE data block corrupted (file # 48, block # 142713)
ORA-01110: data file 48: '/hqlinux08db06/ORACLE/macsl/MACSDAT_2006_06.dbf'
ORA-02063: preceding 2 lines from MODSL_MACSL_LINK
File name : /hqlinux08db06/ORACLE/macsl/MACSDAT_2006_06.dbf

Check first if the there is only one(few) blocks corrupted or most of the blocks are corrupted.

macsl:/opt/oracle/admin/macsl/bdump>

Issue command below at UNIX prompt.

dbv file=/hqlinux08db06/ORACLE/macsl/MACSDAT_2006_06.dbf BLOCKSIZE=8192 LOGFILE=test.log

DBVERIFY: Release 10.2.0.1.0 - Production on Wed Oct 4 14:28:37 2006
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
DBV-00200: Block, dba 201469305, already marked corrupted

macsl:/opt/oracle/admin/macsl/bdump> vi test.log
DBVERIFY: Release 10.2.0.1.0 - Production on Wed Oct 4 14:28:37 2006
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
DBVERIFY - Verification starting : FILE = /hqlinux08db06/ORACLE/macsl/MACSDAT_2006_06.dbf
DBVERIFY - Verification complete
Total Pages Examined         : 262144
Total Pages Processed (Data) : 218615
Total Pages Failing   (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing   (Index): 0
Total Pages Processed (Other): 22422
Total Pages Processed (Seg)  : 0
Total Pages Failing   (Seg)  : 0
Total Pages Empty            : 21107
Total Pages Marked Corrupt   : 1
Total Pages Influx           : 0
Highest block SCN            : 2550111754 (1040.2550111754)

You can get the list of corrupted blocks from  v$database_block_corruption

Select * from v$database_block_corruption;

You will get block number corrupt.
Ex: block 142713.

After that LOGIN TO RMAN.

macsl:/opt/oracle/admin/macsl/bdump> rman target / catalog rman10/rman10@rman10p
Recovery Manager: Release 10.2.0.1.0 - Production on Wed Oct 4 14:33:26 2006
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
connected to target database: MACSL (DBID=1125502194)
connected to recovery catalog database

RMAN> blockrecover datafile 48 block 142713;

Starting blockrecover at 04-OCT-06
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: sid=119 devtype=SBT_TAPE
channel ORA_SBT_TAPE_1: Tivoli Data Protection for Oracle: version 5.2.0.0
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=131 devtype=DISK

channel ORA_SBT_TAPE_1: restoring block(s)
channel ORA_SBT_TAPE_1: specifying block(s) to restore from backup set
restoring blocks of datafile 00048
channel ORA_SBT_TAPE_1: reading from backup piece MACSL.20061004.7379.1.1.602899473
channel ORA_SBT_TAPE_1: restored block(s) from backup piece 1
piece handle=MACSL.20061004.7379.1.1.602899473 tag=TAG20061003T222108
channel ORA_SBT_TAPE_1: reading from backup piece MACSL.20061004.7379.2.1.602899473
channel ORA_SBT_TAPE_1: restored block(s) from backup piece 2
piece handle=MACSL.20061004.7379.2.1.602899473 tag=TAG20061003T222108
channel ORA_SBT_TAPE_1: block restore complete, elapsed time: 00:04:01

starting media recovery
media recovery complete, elapsed time: 00:00:46

Finished blockrecover at 04-OCT-06

Additional information:

V$database_block_corruption is the view to check the list of corrupted blocks.

If you have multiple block list as corrupt, You can use single command to recover them.

RMAN> BLOCKRECOVER corruption list;

No comments:

Post a Comment