RMAN offers a blockrecover command to recover from a block corruption.Otherwise we would have to restore the entire datafile and thereby recover it.
Lets simulate block media recovery
1) Corrupt datafile users.dbf for instance
2) verify the block corruption using dbverify utility:
Block 20 of datafile 4 is corrupted.
3) Lets do RMAN block recovery using blockrecover command.
Lets simulate block media recovery
1) Corrupt datafile users.dbf for instance
$ dd if=/dev/zero of=/u/oracle/oradata/test/users.dbf bs=8k conv=notrunc seek=20 count=1
2) verify the block corruption using dbverify utility:
$dbv file=/u/oracle/oradata/test/users.dbf blocksize=8192
DBVERIFY: Release 10.2.0.1.0 - Production on Tue Jul 20 16:21:06 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
DBVERIFY - Verification starting : FILE = /u/oracle/oradata/test/users.dbf
Page 20 is marked corrupt
Corrupt block relative dba: 0x01000014 (file 4, block 20)
Completely zero block found during dbv:
DBVERIFY - Verification complete
Total Pages Examined : 131072
Total Pages Processed (Data) : 87614
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 5449
Total Pages Failing (Index): 0
Total Pages Processed (Other): 1449
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 36559
Total Pages Marked Corrupt : 1
Total Pages Influx : 0
Highest block SCN : 301640 (0.301640)
Block 20 of datafile 4 is corrupted.
3) Lets do RMAN block recovery using blockrecover command.
RMAN> blockrecover datafile 4 block 20;
Starting blockrecover at 20-JUL-10
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 00004
channel ORA_DISK_1: reading from backup piece /u1/flash_recovery_area/test/backupset/2010_07_16/o1_mf_nnndf_TAG20100716T181457_640o2b16_.bkp
channel ORA_DISK_1: restored block(s) from backup piece 1
piece handle=/u1/flash_recovery_area/test/backupset/2010_07_16/o1_mf_nnndf_TAG20100716T181457_640o2b16_.bkp tag=TAG20100716T181457
channel ORA_DISK_1: block restore complete, elapsed time: 00:00:45
starting media recovery
archive log thread 1 sequence 17 is already on disk as file /u1/flash_recovery_area/test/archivelog/2010_07_17/o1_mf_1_17_642q4zbv_.arc
archive log thread 1 sequence 18 is already on disk as file /u1/flash_recovery_area/test/archivelog/2010_07_19/o1_mf_1_18_647vt1ps_.arc
archive log thread 1 sequence 19 is already on disk as file /u1/flash_recovery_area/test/archivelog/2010_07_19/o1_mf_1_19_647vvqrz_.arc
archive log thread 1 sequence 20 is already on disk as file /u1/flash_recovery_area/test/archivelog/2010_07_20/o1_mf_1_20_64byfgff_.arc
archive log thread 1 sequence 21 is already on disk as file /u1/flash_recovery_area/test/archivelog/2010_07_20/o1_mf_1_21_64byfgjf_.arc
archive log thread 1 sequence 22 is already on disk as file /u1/flash_recovery_area/test/archivelog/2010_07_20/o1_mf_1_22_64byfg8f_.arc
media recovery complete, elapsed time: 00:00:05
Finished blockrecover at 20-JUL-10
No comments:
Post a Comment