Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Saturday, July 15, 2017

Switchover on Oracle Standby Database

A switchover consists of the change of roles between the primary and standby database. After the switch, the primary will turn into the standby database and the standby into the primary.
 To do switchover ensure standby database working properly, receiving and applying the redologs from the primary database.The primary db must be in open status and the standby in mounted mode.

To check the database open mode:
select open_mode from v$database;

Check the Switchover Status for both databases.
select switchover_status from v$database;
It’s ok to perform the switchover if the primary database has the status of “SESSIONS ACTIVE” or “TO STANDBY” and for the standby database the status “SESSIONS ACTIVE” or “NOT ALLOWED”.

SWITCHOVER_STATUS column details:
NOT ALLOWED –>Either this is a standby database and the primary database has not been switched first, or this is a primary database and there are no standby databases.
SESSIONS ACTIVE –> Indicates that there are active SQL sessions attached to the primary or standby database that need to be disconnected before the switchover operation is permitted.
SWITCHOVER PENDING –> This is a standby database and the primary database switchover request has been received but not processed.
SWITCHOVER LATENT –> The switchover was in pending mode, but did not complete and went back to the primary database.
TO PRIMARY –> This is a standby database, with no active sessions, that is allowed to switch over to a primary database.
TO STANDBY –> This is a primary database, with no active sessions, that is allowed to switch over to a standby database.
RECOVERY NEEDED –> This is a standby database that has not received the switchover request.

Swtichover steps:

1.Make the primary db the standby db (Do that on the primary database)
alter database commit to switchover to standby with session shutdown;

2.Shutdown and start the former primary database in standby mode.
shutdown immediate;
startup nomount;
alter database mount standby database;

3.Turn the standby database into the new primary;
alter database commit to switchover to primary;

4.Shutdown and startup open the new primary database
shutdown immediate;
startup;

5.On the new standby database, start the redo log application
recover managed standby database disconnect from session;

Once done switchover_status column from v$database must be in one of the acceptable status as mentioned earlier.Check if the archive is being applied correctly:
select sequence#, applied from v$archived_log order by sequence#;

No comments:

Post a Comment