How To Switch Over

What is it ?

It consist to switch the primary database to a standby database, and of course switch the standby database to be the primary database.

  • Primary database : is the one that user connect to, and do his request.
  • Standby database : is the one that is used in case the primary database crash.

How to enable it ?

I suppose, of course, that your dataguard is running properly before doing this switch over. If you are not sure if your dataguard is running properly, see this link.
It's very easy, you only have to follow some step. Here is the step :

Step 1 : Check if we can switch the primary database to a standby database

You have to execute the following query with sysdba privlege

select switchover_status from v$database;

if you see this output :


You can go directly at step 2. (If anyone has an explanation how to have this output…)

You won't probably see the last output, as you are in sqlplus, and of course, use a session, so, you will probably see this :


you now have to determine if there is any other user connected to the database, if yes, you have to kick them off the database.

Step 2 : Switch the primary database to be a physical standby one.

  • Launch this query with sysdba privilege :

alter database commit to switchover to physical standby;

Wait a moment, as there is some work to be done…

  • Shutdown the database ( a physical standby database need only to be in mount mode)

shutdown immediate;

  • Mount the database :

startup mount;

You can now check if the next switch will enable the database to be in primary mode, by executing this query :

select switchover_status from v$database;

and you have to see this output :


Step 3 : Switch the physical standby database to be a primary one

Execute this query with sysdba privilege :

alter database commit to switchover to primary;

this query can only be execute if the physical standby database is in

  • open read only mode


  • recovery mode

You still have to do something, but now it depends in which mode you were when executing the last command, so click on the tab that correponds to your needs :

Execute these command :

  1. shutdown immediate;
  2. startup;

That's it !! You done a switchover, really easy, isn't it ?!?

Of course, if you want to reverse all this procedure. Put back the physical standby database in primary mode, you have to do all this procedure in reverse order.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License