Total Pageviews

Wednesday, January 4, 2017

If dbf file deleted from the primary recovery from standby backup datafile

Primary:orcl

Standby:stby

πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡πŸ‘‡
On primary
1)Report Schema
report schema;

Report of database schema for database with db_unique_name ORCL

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    700      SYSTEM               YES     /home/cybage/app/cybage/oradata/orcl/system01.dbf
2    480      SYSAUX               NO      /home/cybage/app/cybage/oradata/orcl/sysaux01.dbf
3    40       UNDOTBS1             YES     /home/cybage/app/cybage/oradata/orcl/undotbs01.dbf
4    11       USERS                NO      /home/cybage/app/cybage/oradata/orcl/users01.dbf
5    100      EXAMPLE              NO      /home/cybage/app/cybage/oradata/orcl/example01.dbf
6    50       NEW                  NO      /home/cybage/app/cybage/oradata/orcl/new.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    20       TEMP                 32767       /home/cybage/app/cybage/oradata/orcl/temp01.dbf

RMAN> exit


2)Datafile removed from primary
rm /home/cybage/app/cybage/oradata/orcl/new.dbf

On stand by
3)connect to rman of stand by and auxiliary as pri DB
rman target / auxiliary=sys/oracle@orcl

4)restored from stand by
backup as copy datafile 6 auxiliary format '/home/cybage/app/cybage/oradata/orcl/new.dbf';

on primary
5)rman target /
connect catalog rc/rc

6)to offline the datafile
sql 'alter database datafile 6 offline';
ALTER DATABASE DATAFILE '/home/cybage/app/cybage/oradata/orcl/new.dbf' OFFLINE immediate;

7)to register in catalog
catalog datafilecopy '/home/cybage/app/cybage/oradata/orcl/new.dbf';

8)Switch to datafile so controlfile updated
run {
 set newname for datafile 6 to '/home/cybage/app/cybage/oradata/orcl/new.dbf';
 switch datafile 6;
 }

9)recover datafile for primary
recover datafile 6;

No comments:

Post a Comment