John’s Oracle Experiences

My everyday experiences with Oracle products

Archive for January 12th, 2009

Switch Stand-by database to Primary Database role

Posted by John Paul van Helvoort on January 12, 2009

Not long ago i had to switch a standby database to a primary database role. This was necessary when the primary database was lost as a result of disk corruption.
Luckily we setup a standby database to overcome this tragedy and as it seemed , this can be done in just 2 steps.

The statements i used to switch this standby database to a primary database are

First get your standby database to understand it should stop recovering by archives.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;

( with stand-by redologs )

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH SKIP STANDBY LOGFILE;

( without stand-by redologs )

Now to make the actual switch :

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;

After this , you cannot use this database as a stand-by database anymore.
You will need to create a new standby database as a replica of this new primary database.

Posted in Database | Leave a Comment »