We're here to help!

Replace Corrupted/damaged Primary Datafile with Copy from the Standby Database



There are times when the primary databases's datafiles get corrupted and we may have to do a recovery from the standby database. The below article provides detailed steps on how to do it. 

But before that we have to be sure that the standby database is in sync with the primary database by running a log gap report.

dbvisit -i <DDC> (For Version 7.0)
dbvctl -d <DDC> -i (For Version 8.0)

You can find the datafile which is corrupted by running the below query in sqlplus 

  select * from v$database_block_corruption;

 Steps Performed

1. Go to standby server and connect to standby database using RMAN and take the backup of the datafile which is corrupted in the primary

     backup as copy datafile 5 format '/u01/backup/Users_05.dbf';

2. Transfer the file from the standby location to the primary database server(Use any copy tool like scp,sftp).

3. Go to the primary server and connect to the database using sqlplus "/ as sysdba" and issue

     alter database datafile 5 offline;

4. catalog the backup copy file so that the controlfile gets the updated information about this copy using RMAN (RMAN target =/)

     catalog datafilecopy '/u03/backup/Users_05.dbf'';

5. Restore the datafile using RMAN.

    restore datafile 5;

6. Recover the datafile using RMAN.

    recover datafile 5;

7. Bring the datafile online.

    Alter database datafile 5 online;


After the above steps have been completed, try sending and applying the archivelogs using dbvisit commands.

dbvisit <DDC> (For Version 7.0)
dbvctl -d <DDC> (For Version 8.0
Have more questions? Submit a request


  • Avatar
    Pune Peoples Co op Bank Ltd

    standby server database down