automatic block repair

6
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

Upload: doyenblog

Post on 02-Oct-2015

134 views

Category:

Documents


3 download

DESCRIPTION

11g R2 New Feature is Automatic block Repair. if your primary have the active standby configuration then the block corruption at the primary automatically recovered from standby database.

TRANSCRIPT

11gR2 AUTOMATIC BLOCK REPAIR

Content:1. Enabling the real time apply2. Create test table in Primary3. 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 database8. Check for corrupt blocks using dbv9. 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 ProductionWith 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_MODEREAD 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. All rights reserved.

DBVERIFY - Verification starting : FILE = /u01/app/oracle/oradata/testdb/users01.dbf

DBVERIFY - Verification complete

Total Pages Examined : 640000Total Pages Processed (Data) : 190021Total Pages Failing (Data) : 0Total Pages Processed (Index): 444769Total Pages Failing (Index): 0Total Pages Processed (Other): 5209Total Pages Processed (Seg) : 0Total Pages Failing (Seg) : 0Total Pages Empty : 1Total Pages Marked Corrupt : 0Total Pages Influx : 0Total Pages Encrypted : 0Highest 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.shdd 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. All rights reserved.

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-09using target database control file instead of recovery catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=138 device type=DISKchannel ORA_DISK_1: starting full datafile backup setchannel ORA_DISK_1: specifying datafile(s) in backup setinput datafile file number=00005 name=/u01/app/oracle/oradata/testdb/users01.dbfchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:01List of Datafiles=================File Status Marked Corrupt Empty Blocks Blocks Examined High SCN- -5 FAILED 0 1134 1280 1374339File Name: /u01/app/oracle/oradata/testdb/users01.dbfBlock Type Blocks Failing Blocks Processed- -Data 0 11Index 0 0Other 2 135validate found one or more corrupt blocksSee trace file /u01/app/oracle/diag/rdbms/testdb/testdb/trace/testdb_ora_17914.trc for detailsFinished backup at 24-DEC-09Backup 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 ZEROSQL>

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 non-corrupt block from the standby database and restore and recover this block.

Check of alert log on PRIMARY database Thu Dec 24 10:30:52 2009Hex dump of (file 5, block 139) in trace file /u01/app/oracle/diag/rdbms/testdb/testdb/trace/testdb_ora_17914.trcCorrupt block relative dba: 0x0140008b (file 5, block 139)Completely zero block found during validationReread of blocknum=139, file=/u01/app/oracle/oradata/testdb/users01.dbf. found same corrupt dataReread of blocknum=139, file=/u01/app/oracle/oradata/testdb/users01.dbf. found same corrupt dataReread of blocknum=139, file=/u01/app/oracle/oradata/testdb/users01.dbf. found same corrupt dataReread of blocknum=139, file=/u01/app/oracle/oradata/testdb/users01.dbf. found same corrupt dataReread of blocknum=139, file=/u01/app/oracle/oradata/testdb/users01.dbf. found same corrupt dataHex dump of (file 5, block 140) in trace file /u01/app/oracle/diag/rdbms/testdb/testdb/trace/testdb_ora_17914.trcCorrupt block relative dba: 0x0140008c (file 5, block 140)Completely zero block found during validationReread of blocknum=140, file=/u01/app/oracle/oradata/testdb/users01.dbf. found same corrupt dataReread of blocknum=140, file=/u01/app/oracle/oradata/testdb/users01.dbf. found same corrupt dataReread of blocknum=140, file=/u01/app/oracle/oradata/testdb/users01.dbf. found same corrupt dataReread of blocknum=140, file=/u01/app/oracle/oradata/testdb/users01.dbf. found same corrupt dataReread of blocknum=140, file=/u01/app/oracle/oradata/testdb/users01.dbf. found same corrupt dataHex dump of (file 5, block 139) in trace file /u01/app/oracle/diag/rdbms/testdb/testdb/trace/testdb_ora_19540.trcCorrupt block relative dba: 0x0140008b (file 5, block 139)Completely zero block found during multiblock buffer readReading 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 dataStarting background process ABMRThu Dec 24 11:17:55 2009ABMR started with pid=36, OS id=19550Auto 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.trcCorrupt block relative dba: 0x0140008c (file 5, block 140)Completely zero block found during multiblock buffer readReading 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 dataRequesting Auto BMR for (file# 5, block# 140)Waiting Auto BMR response for (file# 5, block# 139)Auto BMR successfulWaiting Auto BMR response for (file# 5, block# 140)Auto BMR response already receivedAuto 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