Data Guard: Switchover to a Physical Standby Database




(Step 1) Verify that the primary database can be switched to a physical standby database

  • A value of TO STANDBY or SESSIONS ACTIVE indicates that the primary can be switched to a standby role.
SQL> select name, db_unique_name, switchover_status from v$database;

NAME   DB_UNIQUE_NAME   SWITCHOVER_STATUS
--------- ------------------------------ --------------------
DG11G   atlanta    TO STANDBY


(Step 2) Initiate the switchover of the primary database to a physical standby database

  • After completion of this statement, the Data Guard configuration will have two physical standby databases and no primary.
SQL> alter database commit to switchover to physical standby with session shutdown;

Database altered.


(Step 3) Shutdown and then mount the former primary database

  • After completion of this statement, the original primary is a standby database.
  • You can see a graphical view of the switchover process here.
SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
...
Database mounted.

SQL> select name, db_unique_name, switchover_status, database_role from v$database;

NAME   DB_UNIQUE_NAME   SWITCHOVER_STATUS    DATABASE_ROLE
--------- ------------------------------ -------------------- ----------------
DG11G   atlanta    TO PRIMARY       PHYSICAL STANDBY


(Step 4) Check that the switchover target is ready to be switched to the primary role

  • After completion of this statement, the original standby is a primary database.
SQL> select name, db_unique_name, switchover_status, database_role from v$database;


NAME   DB_UNIQUE_NAME   SWITCHOVER_STATUS    DATABASE_ROLE
--------- ------------------------------ -------------------- ----------------
DG11G   fresno    TO PRIMARY       PHYSICAL STANDBY


(Step 5) Switch the target physical standby database role to the primary role

SQL> alter database commit to switchover to primary with session shutdown;

Database altered.

SQL> select name, db_unique_name, switchover_status, database_role from v$database;

NAME   DB_UNIQUE_NAME   SWITCHOVER_STATUS    DATABASE_ROLE
--------- ------------------------------ -------------------- ----------------
DG11G   fresno    NOT ALLOWED       PRIMARY


(Step 6) Open the new primary database

SQL> alter database open;

Database altered.


(Step 7) Start Redo Apply on the new physical standby database

  • You can see a graphical view of the switchover process here.
SQL> select name, db_unique_name, switchover_status, database_role from v$database;

NAME   DB_UNIQUE_NAME   SWITCHOVER_STATUS    DATABASE_ROLE
--------- ------------------------------ -------------------- ----------------
DG11G   atlanta    RECOVERY NEEDED      PHYSICAL STANDBY


SQL> alter database recover managed standby database using current logfile disconnect from session;

Database altered.



No comments:

Post a Comment