- Step 1 Verify that the primary database can be switched to the standby role.
- Query the
SWITCHOVER_STATUScolumn of theV$DATABASEview on the primary database.For example:
SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE; SWITCHOVER_STATUS ----------------- TO STANDBY 1 row selectedA value ofTO STANDBYorSESSIONS ACTIVEindicates that the primary database can be switched to the standby role. If neither of these values is returned, a switchover is not possible because redo transport is either misconfigured or is not functioning properly. - Step 2 Initiate the switchover on the primary database.
- Issue the following SQL statement on the primary database to switch it to the standby role:
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITHSESSION SHUTDOWN;This statement converts the primary database into a physical standby database. The current control file is backed up to the current SQL session trace file before the switchover. This makes it possible to reconstruct a current control file, if necessary.
Note:
TheWITH SESSION SHUTDOWNclause can be omitted from the switchover statement if the query performed in the previous step returned a value ofTO STANDBY. - Step 3 Shut down and then mount the former primary database.
SQL> SHUTDOWN ABORT; SQL> STARTUP MOUNT;At this point in the switchover process, the original primary database is a physical standby database- Step 4 Verify that the switchover target is ready to be switched to the primary role.
- Query the
SWITCHOVER_STATUScolumn of theV$DATABASEview on the standby database. For example:
SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE; SWITCHOVER_STATUS ----------------- TO_PRIMARY 1 row selectedA value ofTO PRIMARYorSESSIONS ACTIVEindicates that the standby database is ready to be switched to the primary role. If neither of these values is returned, verify that Redo Apply is active and that redo transport is configured and working properly. Continue to query this column until the value returned is eitherTO PRIMARYorSESSIONS ACTIVE. - Step 5 Switch the target physical standby database role to the primary role.
- Issue the following SQL statement on the target physical standby database:
SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARYWITH SESSION SHUTDOWN;Note:TheWITH SESSION SHUTDOWNclause can be omitted from the switchover statement if the query performed in the previous step returned a value ofTO PRIMARY. - Step 6 Open the new primary database.
SQL> ALTER DATABASE OPEN;- Step 7 Start Redo Apply on the new physical standby database.
- For example:
SQL> ALTER DATABASE RECOVER MANAGED STANDBYDATABASE DISCONNECT FROM SESSION;Now enjoy with New Primary database....
Tuesday, 28 January 2014
Steps to switch Primary to Standby
Labels:
Data Guard
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment