About Me

My photo
Bangalore, India
I am an Oracle Certified Professional working in SAP Labs. Everything written on my blog has been tested on my local environment, Please test before implementing or running in production. You can contact me at amit.rath0708@gmail.com.

Friday, July 26, 2013

Failover of Primary database in Oracle Data Gaurd

If by some how Primary database is not available then we can activate or configure standby database as a Primary database. When we activate standby database as primary , then we can have data in our new primary upto the last redo transmitted and applied.

If possible your old primary is accessible then try to perform a switchover

PFB steps to activate standby database as new primary :-

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;

Database altered.

SQL> ALTER DATABASE ACTIVATE STANDBY DATABASE;

Database altered.

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
MOUNTED

SQL> alter database open;

Database altered.

SQL> select open_mode from v$database;

OPEN_MODE
--------------------
READ WRITE

Our new primary database is ready to be use. Take a RMAN Backup of new primary database immediately to be on Safer side.

Switchover/switchback are safe for both primary and standby database, but failover makes the Original primary database useless for converting to a standby database . If flashback database is not enabled then Original Primary must be restored from a previous backup and then recreated as a standby database.

--NOTE :- Always have your Primary database and standby database configured with FLASHBACK, so that in event of failover , original primary can be flashed back to the time before failover and can be easily converted to standby.

Find out the scn at which this standby database become primary , this SCN can be used to flashback or recover your original primary as a standby database.

SQL> SELECT TO_CHAR(STANDBY_BECAME_PRIMARY_SCN) FROM V$DATABASE;

TO_CHAR(STANDBY_BECAME_PRIMARY_SCN)
----------------------------------------
1120211

PFB link to Convert a Failed Primary Into a Physical Standby Database Using Flashback Database.

PFB link to Convert a Failed Primary into a Physical Standby Database Using RMAN Backups.

I hope this article helped you.

Regards,
Amit Rath


No comments:

Post a Comment