Opening a DR database in read write mode
Objective of this document is to convert the DR database (Mount state) into Read Write mode temporarily and restoring it back to sync it up with the PRIMARY database.
DR Environment
For example take a two node clustered DR database as follows,
NAME DB_UNIQUE_NAME OPEN_MODE
--------- ------------------------------ --------------------
I****01 DRI****01 MOUNTED
I****01 DRI****01 MOUNTED
INSTANCE_NAME STATUS HOST_NAME
---------------- ------------ --------------------------------
I****011 MOUNTED of90.egan.server.com
I****012 MOUNTED of91.egan.server.com
If the flashback mode is disabled in the database.
The Flashback mode has to be enabled to restore the DR after application installation.
Steps to enable the flashback mode in both the Primary and DR I****01 database.
1. Enabling Flashback in DR database.
a. Cancel the recovery in the standby database.
STANDBY>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
b. Then activate the FLASHBACK on the standby database.
STANDBY> alter system set db_flashback_retention_target=1440 scope=both; #### retention value varies depending on the requirement.
STANDBY>ALTER DATABASE FLASHBACK ON;
c. Verify the flashback mode,
SQL> select flashback_on from v$database;
2. Enabling Flashback in the Primary database.
a. Activate the FLASHBACK on the PRIMARY database.
PRIMARY> alter system set db_flashback_retention_target=1440 scope=both;#### retention value varies depending on the requirement.
PRIMARY> alter database flashback on;
b. Verify the flashback mode,
SQL> select flashback_on from v$database;
Once the flashback mode is enabled, we shall go ahead and bring the DR in the read write mode.
Steps to open the DR database in Read/Write mode
a. Stop the recovery in the DR database.
STANDBY>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
b. Check The MRP status,
STANDBY>select PROCESS,CLIENT_PROCESS,THREAD#,SEQUENCE#,BLOCK# from v$managed_standby where process = 'MRP0' or client_process='LGWR';
(or)
host# ps –ef|grep –imrp
c. Creating a restore point to flashback the DR DB to the old stage & this will help us to bring back as a standby database.
STANDBY> CREATE RESTORE POINT stby_fb_dri****01 GUARANTEE FLASHBACK DATABASE;## stby_fb_dri****01 is the restore point name
d. Check the SCN and restore point details in the DR database,
STANDBY> select NAME,SCN,TIME from v$restore_point;
e. In the Primary database defer the log shipping to the DR,
PRIMARY> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=DEFER;
f. Activate the DR physical standby database and open it in Read/Write mode,
STANDBY>alter database activate standby database;
g. Check the status of the controlfile_type after changing the DR database in Read/Write
STANDBY>select CONTROLFILE_TYPE from v$database;
h. Open the DR database in Read/Write mode,
STANDBY> ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE;
STANDBY> ALTER DATABASE OPEN;
i. Opening the DR in node two is optional, if you would like to open it,
NODE 2 STANDBY>ALTER DATABASE OPEN;
Steps to restore the DR
a. Stop the DR database completely.
srvctl stop database –d I****01
b. Start one instance to restore the DR to its old state,
STANDBY>startup mount
STANDBY> FLASHBACK DATABASE TO RESTORE POINT stby_fb_dri****01;
c. Check the controlfile_type of the DR database,
STANDBY> select controlfile_type from v$database;
d. Change back the DR to Physical Standby database,
STANDBY> ALTER DATABASE CONVERT TO PHYSICAL STANDBY;
e. Bounce the DR database and bring them to mount,
STANDBY>shutdown immediate
STANDBY>startup mount
f. Enable the log shipping in the primary database,
PRIMARY> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE;
g. Drop the restore point on the standby database,
STANDBY> DROP RESTORE POINT stby_fb_dri****01;
h. Start the MRP in the DR database,
STANDBY>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;