Tuesday, August 25, 2015

Recover a corrupted blocks in data file.


1) Corrupted blocks can be identified as follows;

(i) using sql:

SQL> select * from v$database_block_corruption;

FILE# BLOCK# BLOCKS    CORRUPTIO_CANGE# CORRUPTON_TYPE
-----         ------           ------ --         --------------                         --------------
83         147                 2                         0          CORRUPT

SQL>

(ii) using dbv command:

-bash-4.1$ dbv file=/data/oradata/rman_test01.dbf blocksize=8192

DBVERIFY: Release 11.2.0.3.0 - Production on Tue Aug 25 09:07:31 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

DBVERIFY - Verification starting : FILE = /data/oradata/rman_test01.dbf
Page 147 is marked corrupt
Corrupt block relative dba: 0x14c00093 (file 83, block 147)
Bad header found during dbv:
Data in bad block:
 type: 116 format: 5 rdba: 0x20636f75
 last change scn: 0x0a6d.72727074 seq: 0x1 flg: 0x04
 spare1: 0x73 spare2: 0x74 spare3: 0x0
 consistency value in tail: 0x656d0601
 check value in block header: 0x5a9
 computed block checksum: 0x8a4e

Page 148 is marked corrupt
Corrupt block relative dba: 0x14c00094 (file 83, block 148)
Bad header found during dbv:
Data in bad block:
 type: 116 format: 5 rdba: 0x20636f72
 last change scn: 0x2066.72757074 seq: 0x6f flg: 0x72
 spare1: 0x73 spare2: 0x74 spare3: 0x6563
 consistency value in tail: 0x656d0601
 check value in block header: 0x2072
 block checksum disabled


DBVERIFY - Verification complete

Total Pages Examined         : 1280
Total Pages Processed (Data) : 105
Total Pages Failing   (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing   (Index): 0
Total Pages Processed (Other): 144
Total Pages Processed (Seg)  : 0
Total Pages Failing   (Seg)  : 0
Total Pages Empty            : 1029
Total Pages Marked Corrupt   : 2
Total Pages Influx           : 0
Total Pages Encrypted        : 0
Highest block SCN            : 3100913189 (1389.3100913189)
-bash-4.1$


2) Use "block recovery" command as follows;

RMAN> recover datafile 83 block 147 from tag=THUFULL;

Starting recover at 25-AUG-15
using channel ORA_DISK_1

channel ORA_DISK_1: restoring block(s)
channel ORA_DISK_1: specifying block(s) to restore from backup set
restoring blocks of datafile 00083
channel ORA_DISK_1: reading from backup piece /data/backup/TEST/backupset/2015_08_20/o1_mf_nnnd0_THUFULL_bxbzbyvy_.bkp
channel ORA_DISK_1: piece handle=/data/backup/TEST/backupset/2015_08_20/o1_mf_nnnd0_THUFULL_bxbzbyvy_.bkp tag=THUFULL
channel ORA_DISK_1: restored block(s) from backup piece 1
channel ORA_DISK_1: block restore complete, elapsed time: 01:06:35

starting media recovery

archived log for thread 1 with sequence 209 is already on disk as file /data/backup/TEST/archivelog/2015_08_20/o1_mf_1_209_bxccl0w1_.arc
archived log for thread 1 with sequence 210 is already on disk as file /data/backup/TEST/archivelog/2015_08_20/o1_mf_1_210_bxch2v5m_.arc
archived log for thread 1 with sequence 211 is already on disk as file /data/backup/TEST/archivelog/2015_08_20/o1_mf_1_211_bxcp2mkx_.arc
.
.
.

media recovery complete, elapsed time: 00:09:44
Finished recover at 25-AUG-15

RMAN>

RMAN> recover datafile 83 block 148 from tag=THUFULL;


3) Check the corrupted blocks again:

-bash-4.1$ dbv file=/data/oradata/rman_test01.dbf blocksize=8192

DBVERIFY: Release 11.2.0.3.0 - Production on Wed Aug 26 09:38:15 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

DBVERIFY - Verification starting : FILE = /data/oradata/rman_test01.dbf


DBVERIFY - Verification complete

Total Pages Examined         : 1280
Total Pages Processed (Data) : 107
Total Pages Failing   (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing   (Index): 0
Total Pages Processed (Other): 144
Total Pages Processed (Seg)  : 0
Total Pages Failing   (Seg)  : 0
Total Pages Empty            : 1029
Total Pages Marked Corrupt   : 0
Total Pages Influx           : 0
Total Pages Encrypted        : 0
Highest block SCN            : 3100913189 (1389.3100913189)
-bash-4.1$ 


1 comment: