viernes, 25 de septiembre de 2009

RMAN CREATING AND FIXING BLOCK CORRUPTION

CREATING AND FIXING BLOCK CORRUPTION

The purpose of this sidebar is to show you how to corrupt a block so that you can test recovering at the block
level. Do not perform this test exercise in a production environment.
In a Unix environment, you can corrupt a specific block in a datafile using the dd command. For example, the following dd command populates the 20th block of the tools01.dbf datafile with zeros:

$ dd if=/dev/zero of=tools01.dbf bs=8k conv=notrunc seek=20 count=1
Now if we attempt to back up the tools tablespace using RMAN, we receive an error indicating there is a
corrupt block:

RMAN> backup tablespace tools;

RMAN-03009: failure of backup command on ORA_DISK_1 channel
ORA-19566: exceeded limit of 0 corrupt blocks for file /ora01/BRDSTN/tools01.dbf
We additionally use the dbverify utility to validate that the tools01.dbf datafile has a corrupt block:

$ dbv file=/ora01/BRDSTN/tools01.dbf blocksize=8192
Here is the partial output of the dbverify command:

DBVERIFY - Verification starting : FILE = tools01.dbf
Page 20 is marked corrupt

Corrupt block relative dba: 0x01400014 (file 5, block 20)
The dbverify utility indicates that block 20 in file 5 is corrupt.We can corroborate this by viewing the
contents of V$DATABASE_BLOCK_CORRUPTION, as shown here:

SQL> select * from v$database_block_corruption;
FILE# BLOCK# BLOCKS CORRUPTION_CHANGE# CORRUPTIO
---------- ---------- ---------- ------------------ ---------
5 20 1 0 ALL ZERO

We can now use the RMAN recover command to restore block 20 in datafile 5, as shown here (if
you’re using Oracle Database 10g or Oracle9i, then use the RMAN blockrecover command):

RMAN> recover datafile 5 block 20;

No hay comentarios: