Home » Oracle » How to recover the datafile in Dataguard Environment

How to recover the datafile in Dataguard Environment

In this Oracle tutorial, we will provide information on how to recover the datafile in Dataguard environment

We have a Oracle Production env TSPRD which is having the Standby Database TSSTD

CaseStudy 1:
Suppose one of the file(For example file# 11) on the primary side(TSPRD) got corrupted
The only solution is to restore the file and recover it
Instead of restoring it from datafile from backup ,we can restore it from standby side

Steps to recover the primary database’s datafile using a copy of a standby database’s datafile.

This procedure will work for all file systems including raw or ASM.
(1) On standby database, copy datafile from ASM to a file system

RMAN> backup as copy datafile 11 format '/tmp/df11.dbf';

(2) transfer the datafile copy from the standby to the primary host using scp.

On primary database

(3) Place the datafile to recover offline.

alter database datafile 11 offline;

(4) catalog this datafile copy using rman

catalog datafilecopy '/tmp/df11.dbf';

(5) Confirm that datafile exists using rman

list copy of datafile 11;

(6) Restore the datafile using rman

restore datafile 11;

(7) Recover the datafile using rman

recover datafile 11;

(8) Place the datafile online:

alter database datafile 11 online;

CaseStudy 2:
Suppose one of the file(For example file# 11) on the Standby side(TSSTD) got corrupted.
The only solution is to restore the file and recover it
Instead of restoring it from datafile from backup ,we can restore it from Primary side

Steps to recover the standby database’s datafile using a copy of a primary database’s datafile.

This procedure will work for all file systems including raw or ASM.

See also  How to purge SYS.AUD$ table in Oracle

(1) Backup the primary database’s datafile using rman

backup as copy datafile 11 format '/tmp/df11.dbf'; 

(2) transfer the file to the standby site using an operating system utility such as scp.

(3) catalog the datafile copy on the standby site using rman

catalog datafilecopy '/tmp/df11.dbf';

(4) stop redo apply on the physical standby database.

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

(5) on the standby site restore the datafile copy.

restore datafile 11;

(6) restart redo apply on the physical standby database.

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;

Hope you like this article on how to recover the datafile in Dataguard.Please do provide feedback.

Also Reads
RMAN Backup Commands :Check out the RMAN Backup commands in this post. This is going to be very helpful for the person who is involved in backup and recovery
Oracle RMAN interview questions : Oracle RMAN Interview Questions are must for Oracle DBA’s looking for change. Oracle Backup and recovery is one of the essential duties of Oracle DBA
oracle dba interview questions for experienced professionals : check out awesome oracle dba interview questions and answers to succeed in any oracle database interviews . This will test your knowledge on various fronts
RMAN-06059 : Check out how to resolve the RMAN-06059: expected archived log not found, lost of archived log compromises recoverability
RMAN-20004 : RMAN-20004 happens when a Database has been cloned and a connection made from the clone to Catalog using rman with out changing the DBID of the clone,
https://docs.oracle.com/cd/B19306_01/backup.102/b14192/bkup007.htm

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top