Recovery of DataFile from Block Corruption



Being Oracle Administrator, we must exercise on the worst-case occurrences and be ready to handle situations proactively. The below post is one of the worst-case scenarios, deals with the necessary steps to be followed when the datafile gets corrupted. This has divided into two parts, 

1. Simulate corruption(just for this scenario :-) ) 
2. Recover the corrupted file. 


PART1: corrupting datafile

  • In order to simulate this scenario, we just create a tablespace called test_ts , user called test and appropriate permission specified as below,

Create tablespace,
  • Create table and insert 1000 records as follows,
NOTE: Take the full backup of your database before proceeds next. 

  • Purposely corrupt the data file,
  • Using dbv utility, check the corrupted file and block,
Dbv file=/u01/……test_ts.dbf,

  • Run the following command in RMAN and check the corrupted block consecutively,
RMAN>Backup validate database; 

  • Now, select the table. Data will come so we need to flush the buffer cache which holds it temporarily,

Part2: Recovering the corrupted file using RMAN 
There are three consecutive chained steps needs to performed to recover the datafile block namly,
  1. List failure – list the number of failures.
  2. Advise failure – script out the failures specified in list failure.
  3. Repair failure – run the scripts generated in advise failure.

List failure
Advise failure,
Repair failure,

That is it. We have successfully recovered the corrupted datafile using the RMAN mechanism.!  


Recent Posts

  • Cloud SQL
    What is Cloud SQL  It is a fully managed relational database service for PostgreSQL and MySQL database in the GCP. MySQL instance can be...
    May 17 2020 | Read more
  • Deploy an application to Google Kubernetes Engine
    Welcome back, this is the continuation post of the previous article, where we have discussed the Kubernetes and its concepts in detail. In this...
    May 13 2020 | Read more
  • Google Kubernetes Engine
    What is GKE? GKE is a managed, production-ready environment for deploying containerized applications. It is like a managed cargo container in...
    May 13 2020 | Read more
  • Google App Engine – Flexible
    In the previous article, we have discussed what is google app engine and how to deploy the application in the Google app engine – Standard. In...
    May 10 2020 | Read more