Saturday, September 1, 2012

Snapshot Standy clone Process:

Note : Check before performing this  both Prod and DR must be in sync ,then only go ahead
Sync Database from EBS DR Host

.E.g . Here both PROD and DR in complete Sync
SQL> select max(sequence#) from v$archived_log where applied='YES';
MAX(SEQUENCE#)
--------------
         35178
SQL> select max(sequence#) from v$archived_log ;
MAX(SEQUENCE#)
--------------
         35178
Cancel the recovery  from DR:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
Database altered.
SQL> select log_mode,flashback_on from v$database;
LOG_MODE     FLASHBACK_ON
------------ ------------------
ARCHIVELOG   NO
SQL> alter database flashback on;
Database altered.
CREATE RESTORE POINT SAFE_PROD_TO_SUPT_POINT GUARANTEE FLASHBACK DATABASE;

SQL> select log_mode,flashback_on from v$database;
LOG_MODE     FLASHBACK_ON
------------ ------------------
ARCHIVELOG   YES

convert the physical standby database into Snapshot standby database :
SQL> ALTER DATABASE CONVERT TO SNAPSHOT STANDBY;
Database altered.
Shut the DRDB now  :
SQL> shut immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
Start the database :
SQL> startup
ORACLE instance started.
Total System Global Area 5344731136 bytes
Fixed Size                  2159472 bytes
Variable Size            1073745040 bytes
Database Buffers         4227858432 bytes
Redo Buffers               40968192 bytes
Database mounted.
Database opened.
SQL> select FLASHBACK_ON,open_mode from v$database;
FLASHBACK_ON       OPEN_MODE
------------------ ----------
YES                READ WRITE

Switch the log file in DR side and shut down the database.
SQL>alter system switch logfile;
          stystem altered.
SQL> select DATABASE_ROLE,name from v$database;
 DATABASE_ROLE         NAME
---------------------------           -------------
SNAPSHOT STANDBY     PROD

Shut down the all the services on target (TARGET) side and drop the DB.
SQL> shut immediate;
SQL>startup mount restrict;
SQL> select name,open_mode from v$database;
SQL> drop database;
Copy the files from DR to TARGET using Rman script.
Once Copy  got completed  in DR side perform the following  :
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 5344731136 bytes
Fixed Size                  2159472 bytes
Variable Size            1140853904 bytes
Database Buffers         4160749568 bytes
Redo Buffers               40968192 bytes
SQL> alter database mount;
Database altered.
SQL> ALTER DATABASE CONVERT TO PHYSICAL STANDBY;
Database altered.
Need to shut the database here
SQL> shut immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
Start the database in  no mount state  and mount the as standby and again start the recovery
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 5344731136 bytes
Fixed Size                  2159472 bytes
Variable Size            1140853904 bytes
Database Buffers         4160749568 bytes
Redo Buffers               40968192 bytes
SQL> alter database mount standby database;
Database altered.

SQL> Alter database recover managed standby database disconnect from session;
Database altered.
SQL> alter database flashback off;
SQL> select FLASHBACK_ON,open_mode from v$database;
FLASHBACK_ON       OPEN_MODE
------------------                ----------------------
NO                                 READ WRITE

Verify from the DR alert log that recovery is happening, you must see like below:
[oracle@DRdbnode]$ tail -f ./admin/DR_dbnodedr01/diag/rdbms/drdb/DRDB/trace/alert_DRDB.log
Primary database is in MAXIMUM PERFORMANCE mode
Thu Aug 12 08:50:16 2012
Media Recovery Log /archivelogs/DRSB/DRDB_1_35180_752148892.arc
Thu Aug 12 08:50:50 2012
Redo Shipping Client Connected as PUBLIC
-- Connected User is Valid
RFS[1642]: Assigned to RFS process 29995
RFS[1642]: Identified database type as 'physical standby'
Thu Aug 12 08:52:06 2012
Media Recovery Waiting for thread 1 sequence 35181 (in transit)
Thu Aug 12 09:00:37 2012

No comments:

Post a Comment