USING ‘DELAY’ OPTION TO PROTECT LOGICAL/PHYSICAL CORRUPTIONS

You may utilize the delay option (if you have multiple standby sites) to prevent physical/logical corruption of your primary. For instance, your standby #1 may not have ‘Delay’ on to be your disaster recovery standby database. However, you may opt to implement a delay of minutes or hours on your standby #2 to allow recover from a possible physical or logical corruption on your primary database.
SQL> alter database recover managed standby database delay 5 disconnect;

http://www.pafumi.net/Standby_Concepts_Configuration.html

2 – Node RAC Stadby database datafiles recovery from Primary Site

Standby Site Recovery Senario

Environment
2-Node RAC Oracle11g 11.2.0.3.0 with ASM /RHEL 5.6 64bit/ RAC to RAC Data guard configuration

Problem:

Due to miscommunication by Junior engineer who had communication gap with Storage Admin and so Storage Administrator had perform activity for drop the live raw partitions and recreate the same partition again.

I got the call from my client that services is down I checked 360 degree to recover the services first.

–Recover the Database1 – Datafile – webinpwifi
run{
2> set newname for datafile 6 to ‘C:APPMAZARORADATAOWNnew/test01.dbf’;
3> set newname for datafile 7 to ‘C:APPMAZARORADATAOWNnewtest02.dbf’;
4> restore tablespace “TEST”;
5> switch datafile all;
6> recover tablespace “TEST”;
7> alter database open;
8> }

–Recover the Database2 which is standby database in rac mode

--Recover Standby database - ASM Diskgroup
oracleasm listdisks
oracleasm scandisks
/usr/sbin/oracleasm createdisk MYDSK /dev/mapper/MYDSKp1

CREATE DISKGROUP MYDSK EXTERNAL REDUNDANCY
DISK 'ORCL:MYDSK'
ATTRIBUTE 'au_size'='4M',
'compatible.asm' = '11.2.0.0.0',
'compatible.rdbms' = '11.2.0.0.0',
'compatible.advm' = '11.2.0.0.0';

--Recover Standby database datafile from Primary Site
Step-1 connect to the standby server and startup database in mount stage
Standby Node1
sqlplus> STARTUP MOUNT;

Standby Node2
sqlplus> STARTUP MOUNT;

or

srvctl stop database -d stydb
srvctl stop database -d stydb -o mount

Step–2 Using RMAN, connect to primary(ALBARSHA) as target and standby(DUBIOTECH) as auxiliary

rman target / auxiliary sys/*******@duaaa

Step-3 Take image copy backup of example tablespace on primary so that backup file is created on standby
RMAN> backup as copy  tablespace ELITECG auxiliary format '+MYDSK';
inputfile name=x1
outputfile name=x2

RMAN> backup as copy  tablespace ELITEAAAPWIFI auxiliary format '+MYDSK';
inputfile name=y1
outputfile name=y2

Example
=======
-bash-3.2$ rman TARGET / AUXILIARY sys/*******@stydb

Recovery Manager: Release 11.2.0.3.0 - Production on Wed Mar 18 21:17:22 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: DUAAA (DBID=3171721304)
connected to auxiliary database: DUAAA (DBID=3171721304, not open)

RMAN> backup as copy  tablespace ELITECG auxiliary format '+MYDSK';

Starting backup at 18-MAR-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=554 instance=duaaadr2 device type=DISK
channel ORA_DISK_1: starting datafile copy
input datafile file number=00109 name=+MYDSK/duaaadr/datafile/elitecg.256.866041173
output file name=+MYDSK/duaaa/datafile/elitecg.259.874703867 tag=TAG20150318T211745
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 18-MAR-15

RMAN> backup as copy  tablespace ELITEWIFI auxiliary format '+MYDSK';

Starting backup at 18-MAR-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00110 name=+MYDSK/duaaadr/datafile/elitewifi.257.866043479
output file name=+MYDSK/duaaa/datafile/elitewifi.257.874703897 tag=TAG20150318T211817
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 18-MAR-15

Step3 — Connect to standby database(DU BIOTECH)

rman target
RMAN > report schemas;

109 x1
110 y1

run
{
set newname for datafile 109 to x2;
switch datafile 109;
}

run
{
set newname for datafile 110 to y2;
switch datafile 110;
}

Example
=======
catalog datafilecopy '+MYDSK/duaaa/datafile/elitecg.259.874703867';
catalog datafilecopy '+MYDSK/duaaa/datafile/elitewifi.257.874703897';

run {
set newname for datafile 109 to '+MYDSK/duaaa/datafile/elitecg.259.874703867';
switch datafile 109;
}

run {
set newname for datafile 110 to '+MYDSK/duaaa/datafile/elitewifi.257.874703897';
switch datafile 110;
}

Step-4 — Wait some time and check the alert logs of standby database

archive log list
confirm the generated and apply archive of primary and standby site

Step-5 — Standby Node1

ALTER DATABASE OPEN READ ONLY;

Step-6 -- Standby Node2
ALTER DATABASE OPEN READ ONLY;

Step-7 — Only from Standby Node1

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;

Reference
http://oracleinaction.com/recover-standby-datafile-primary/
http://www.oraclecommunity.net/profiles/blogs/rmanrestore-datafiles-to
http://www.thesqlreport.com/?p=728
http://www.oracle-wiki.net/startdocshowtomoveanasmdatafilediskgrp
https://aprakash.wordpress.com/2011/05/29/moving-datafiles-using-asmcmd-11gr2/