Tuesday, August 28, 2012

Recover the Primary Database's datafile using a copy of a Physical Standby Database's Datafile

Recover the Primary Database's datafile using a copy of a Physical Standby Database's Datafile

Before replacing a datafile with a copy from either production or standby, please confirm that all archivelogs are available for full recovery of this datafile.

Check the following before replacing :

a). dbv must return with zero corrupted pages
$ dbv file=<full path filename> blocksize=<tablespace blocksize> logfile=<output log>

b). rman validate:  
RMAN> backup validate check logical datafile n;   (n is datafile number)

c). Once RMAN is completed, this view must return zero rows:
SQL> select * from v$database_block_corruption;

Recovering the Primary's Datafile :

1). In the Physical standby database, backup the datafile to a cooked file system:
RMAN> backup datafile 5 format '/tmp/df5_st.bk';

2). Transfer the backuppiece from the standby to the primary host using scp, ftp, nfs etc

3). In the primary database, do the following:

a). Catalog this backuppiece and confirm that it is available for use:
RMAN> catalog backuppiece '/tmp/df5_st.bk';
RMAN> list backuppiece '/tmp/df5_st.bk'
RMAN> list backup of datafile 5;

b). Restore the datafile:
SQL>  alter database datafile 5 offline;
RMAN> restore datafile 5;

c). Recover the datafile:
RMAN> recover datafile 5;

d). Place the datafile online:
SQL> alter database datafile 5 online;


e). Check the datafile status:
SQL> select file_name from dba_data_files

No comments:

Post a Comment