Dealing with block corruption

September 17th, 2010 | Posted in block corruption, Blog | 2 Comments
Tags: ,



Introduction :

Oracle provides different tools to detect, fix corrupted blocks.
Corruption can be caused by a software bug or a media failure or a human error.
In this note, we are going to simulate a block corruption in Oracle 11gR2 database, and we will go through the process of detecting the corruption, analyzing the corruption and finally fixing it.

Applies to :

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0.
Information in this document applies to any platform.

Environment test details :

Operating system: Windows XP service pack 2
Database Version: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 (32 bit)

Demonstration :

First let ‘s create a new tablepsace with a new datafile; Then a new table named TEST_CORRUPT belongs to this tablepspace TST_CORRUPT.

We backup the database :


Shutdown the database and simulate a corruption by modifying the datafile. I am going to modify the blocks presented in the middle of the datafile. This will help me then to open the database. If you modify the header of the datafile , you will may recieve an error opening the database.
(Be careful to do it in your test database because will be really dangerous to simulate it in a production database).


Startup the database, the database is opened without problems ;

Detect the block corruption, with the ANALYZE statement;

Now, let’s collect more details about the corrupted blocks; for this we are going to use the DBMS_REPAIR package to create an admin table named “REPAIR_TABLE”.

Assure that the table “REPAIR_TABLE” is create in Sys schema ;

Run the DBMS_REPAIR package with the check_object procedure to populate the “REPAIR_TABLE” table with information about the corrupted block;


We have now details about the file ID and the block ID, so let ‘s fix the block using RMAN ;


Conclusion :

The block corruption detection and fix is a straightforward process. You make sure of adjusting and following some steps and most of times the corruption is fixed using RMAN block recovery.

Nice reading,
Wissem

Scridb filter


2 Comments to “Dealing with block corruption”

  1. uppi says:

    Hi,
    which editor that you used to corrupt the blocks….i am trying to edit using with ultraedit ,after editing, i am trying to put tablespace online. it throwing following error..

    ERROR at line 1:
    ORA-01113: file 7 needs media recovery
    ORA-01110: data file 7: ‘D:\ORADATA\DB101\TEST_CORR.DBF’

    but in original location i have my datafile…please help me
    thanks in advance….


Leave a Comment





Subscribe


Polls

which oracle topic interests you most?

View Results

Loading ... Loading ...


Oracle Class Tweets


Recent Posts


Recent Comments

  • Jaspreet: Brilliant explanation.
  • Yousuf: Very Nice… Just wanted to check you have done all patching at Node 1 only.. is there any thing need to...
  • Yousuf: Very Nice.. Thanks for sharing.. Once question.. You have executed all commands on Node 1 only.. Is there any...
  • Emir: Thanks… Great article
  • borse firmate: Thank you for another informative blog. The place else may just I am getting that kind of information...
  • leandro: why this parameter is systemwide? could you read from a asm instance from one failure group and from the...
  • Mohammad: paul, we create pfile from target database to source database and later we change database name, and...
  • Muhammad Ikram: Thanks Brother for sharing pearls of knowledge. May ALLAH reward you for this both here and...
  • rgrover: Thanks for the POST. I recently encounter similar issue. Your POST helped.
  • gopalredy: really its very use full to dbas
  • Vivian: This is awesome! Thank you so much!
  • henry zhong: CDB=DB, and PDB=SCHEMA but in a sub dictionary?
  • Dehbashee: Salam Brother, Thanx for sharing, however, i would be interested in chaging the password for the grid user...
  • wissem: No we don’t need that :) Just the scripts I posted above
  • Md. Tanweer: Thanks for posting the material. I really appreciate if you can send me, if you have tutorial for 11g...
  • christiaan: Thanks!! This has been bugging the hell out of me for so long.
  • Rajasekhar: Thank you
  • Samarjit Panigrahy: Very Nice and Simple Demo… Cool :)
  • cq: Any reason not to use auto patch for both CRS and RAC homes with one command? Or use opatch auto for RAC home as...
  • Hitesh: Hi, Can we use this RACcheck tool on oracle SE version ? Thanks