Anda di halaman 1dari 5

11gR2 AUTOMATIC BLOCK REPAIR

Content:
1. Enabling the real time apply
2. Create test table in Primary
3. check the file users01.dbf for any corruption.
4. Corrupt the Block using the following command.
5. Check the block corruption using rman backup.
6. Check the Block corruption with the following view.
7. Check of alert log on PRIMARY database
8. Check for corrupt blocks using dbv
9. Check the Corruption in database level.

Enabling the real time apply


On Standby:
[oracle@fhpasadbdr01 datafile]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Apr 1 13:41:38 2015
Copyright (c) 1982, 2013, Oracle.

All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit
Production
With the Partitioning, OLAP, Data Mining and Real Application
Testing options
SQL> alter database recover managed standby database cancel;
SQL> alter database open read only;
SQL> alter database recover managed standby database using current
logfile disconnect;
SQL> exit;
a. Confirm that standby database is open
SQL> select file_name from dba_data_files;
FILE_NAME
FILE_NAME

/u01/app/oracle/oradata/teststby/users01.dbf
/u01/app/oracle/oradata/teststby/undotbs01.dbf
/u01/app/oracle/oradata/teststby/sysaux01.dbf
/u01/app/oracle/oradata/teststby/system01.dbf
SQL> select open_mode from v$database;
OPEN_MODE


READ ONLY WITH APPLY
SQL>

Create test table in Primary:


SQL> create table test (col_1 number(10));
Table created.
SQL>

Test the table availability on both primary and standby


Primary and standby
Conform the table receive status test;
SQL> select * from test;
no row selected.
SQL>

Note: While the standby database is open in READ ONLY mode, media
recovery is still in progress.
Check the file users01.dbf for any corruption
cd /u01/app/oracle/oradata/testdb
[oracle@testdb datafile]$ dbv file=users01.dbf
DBVERIFY: Release 11.2.0.4.0 - Production on Wed Apr 1 12:40:52 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.
reserved.
DBVERIFY - Verification starting : FILE =
/u01/app/oracle/oradata/testdb/users01.dbf
DBVERIFY - Verification complete
Total
Total
Total
Total
Total
Total
Total
Total
Total

Pages
Pages
Pages
Pages
Pages
Pages
Pages
Pages
Pages

Examined
Processed
Failing
Processed
Failing
Processed
Processed
Failing
Empty

:
(Data) :
(Data) :
(Index):
(Index):
(Other):
(Seg) :
(Seg) :
:

640000
190021
0
444769
0
5209
0
0
1

All rights

Total Pages Marked Corrupt


: 0
Total Pages Influx
: 0
Total Pages Encrypted
: 0
Highest block SCN
: 2899965621 (8.2899965621)
You have new mail in /var/spool/mail/oracle

Corrupt the Block using the following command.


[oracle@testdb datafile]$ cat corrupt.sh
dd if=/dev/zero of=/u01/app/oracle/oradata/testdb/users01.dbf
bs=8192 seek=139 count=2 conv=notrunc
[oracle@testdb ~]$sh corrupt.sh

Check the block corruption using rman backup:


[oracle@testdb ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Wed Apr 1
12:24:01 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.
reserved.

All rights

connected to target database: TESTDB (DBID=3871914574)


RMAN> backup validate tablespace users format
/u01/app/oracle/oradata/testdb/%U%s%d%t';
Starting backup at 24-DEC-09
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=138 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00005
name=/u01/app/oracle/oradata/testdb/users01.dbf
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
- 5 FAILED 0 1134 1280 1374339
File Name: /u01/app/oracle/oradata/testdb/users01.dbf
Block Type Blocks Failing Blocks Processed
- Data 0 11
Index 0 0
Other 2 135

validate found one or more corrupt blocks


See trace file
/u01/app/oracle/diag/rdbms/testdb/testdb/trace/testdb_ora_17914.trc
for details
Finished backup at 24-DEC-09
Backup validate proves block corruption.

Check the Block corruption with the following view:


SQL> select * from V$DATABASE_BLOCK_CORRUPTION ;
FILE# BLOCK# BLOCKS CORRUPTION_CHANGE# CORRUPTIO
- - -
5 139 2 0 ALL ZERO
SQL>

Now since this database is a primary database in a dataguard


configuration with active dataguard in place, AUTO BMR( Block Media
Recovery) will kick in on the primary database box and fetch a noncorrupt block from the standby database and restore and recover this
block.
Check of alert log on PRIMARY database
Thu Dec 24 10:30:52 2009
Hex dump of (file 5, block 139) in trace file
/u01/app/oracle/diag/rdbms/testdb/testdb/trace/testdb_ora_17914.trc
Corrupt block relative dba: 0x0140008b (file 5, block 139)
Completely zero block found during validation
Reread of blocknum=139,
file=/u01/app/oracle/oradata/testdb/users01.dbf. found same corrupt
data
Reread of blocknum=139,
file=/u01/app/oracle/oradata/testdb/users01.dbf. found same corrupt
data
Reread of blocknum=139,
file=/u01/app/oracle/oradata/testdb/users01.dbf. found same corrupt
data
Reread of blocknum=139,
file=/u01/app/oracle/oradata/testdb/users01.dbf. found same corrupt
data
Reread of blocknum=139,
file=/u01/app/oracle/oradata/testdb/users01.dbf. found same corrupt
data
Hex dump of (file 5, block 140) in trace file
/u01/app/oracle/diag/rdbms/testdb/testdb/trace/testdb_ora_17914.trc
Corrupt block relative dba: 0x0140008c (file 5, block 140)
Completely zero block found during validation
Reread of blocknum=140,
file=/u01/app/oracle/oradata/testdb/users01.dbf. found same corrupt
data
Reread of blocknum=140,
file=/u01/app/oracle/oradata/testdb/users01.dbf. found same corrupt
data
Reread of blocknum=140,
file=/u01/app/oracle/oradata/testdb/users01.dbf. found same corrupt
data
Reread of blocknum=140,
file=/u01/app/oracle/oradata/testdb/users01.dbf. found same corrupt
data

Reread of blocknum=140,
file=/u01/app/oracle/oradata/testdb/users01.dbf. found same corrupt
data
Hex dump of (file 5, block 139) in trace file
/u01/app/oracle/diag/rdbms/testdb/testdb/trace/testdb_ora_19540.trc
Corrupt block relative dba: 0x0140008b (file 5, block 139)
Completely zero block found during multiblock buffer read
Reading datafile /u01/app/oracle/oradata/testdb/users01.dbf for
corruption at rdba: 0x0140008b (file 5, block 139)
Reread (file 5, block 139) found same corrupt data
Starting background process ABMR
Thu Dec 24 11:17:55 2009
ABMR started with pid=36, OS id=19550
Auto BMR service is active.
Requesting Auto BMR for (file# 5, block# 139)
Hex dump of (file 5, block 140) in trace file
/u01/app/oracle/diag/rdbms/testdb/testdb/trace/testdb_ora_19540.trc
Corrupt block relative dba: 0x0140008c (file 5, block 140)
Completely zero block found during multiblock buffer read
Reading datafile /u01/app/oracle/oradata/testdb/users01.dbf for
corruption at rdba: 0x0140008c (file 5, block 140)
Reread (file 5, block 140) found same corrupt data
Requesting Auto BMR for (file# 5, block# 140)
Waiting Auto BMR response for (file# 5, block# 139)
Auto BMR successful
Waiting Auto BMR response for (file# 5, block# 140)
Auto BMR response already received
Auto BMR successful

Check for corrupt blocks using dbv.


cd /u01/app/oracle/oradata/testdb
dbv file=users01.dbf

Check the corruption at the database level.


SQL> select * from V$DATABASE_BLOCK_CORRUPTION ;
no row selected

Anda mungkin juga menyukai