You are on page 1of 3

Manual Switch Over

Important points to consider before switchover

1. Verify that there is network connectivity between the primary and standby locations.

2. Each location in the Data Guard configuration should have connectivity through Oracle
Net to the primary database and to all associated standby databases.

3. Verify that there are no active users connected to the databases.

4. For switchover operations involving a physical standby database, the primary database instance
is open and the standby database instance is mounted.

5. The standby database that you plan to transition to the primary role must be mounted before you
begin the switchover operation. Ideally, the physical standby database will also be actively
recovering archived redo logs when the database roles are switched. If the physical standby
database is open for read-only access, the switchover operation still will take place, but will require
additional time.

6. Place the standby database that will become the new primary database in
ARCHIVELOG mode.

7. Remove any redo data application delay in effect on the standby database.

8. Verify that the Standby Database is not in delayed recovery mode. Change the recovery mode to
no delay before switchover/switchback.

Steps to perform switchover with Physical Standby databases:

1. Verify that it is possible to perform a switchover operation. On the primary query the
.
switchover_status column of v$database to verify that switchover to standby is possible
sql> select switchover_status from v$database;

SWITCHOVER_STATUS
------------------

TO STANDBY

In order to perform a switchover all sessions to the database need to be disconnected. If


SWITCHOVER_STATUS returns SESSIONS ACTIVE then you should either disconnect all
sessions manually or you should append the “with session shutdown” clause. For example:

sql> alter database commit to switchover to standby with session shutdown;


Note that the clause also works with the switchover to primary command.

The SWITCHOVER_STATUS column of v$database can have the following values:

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.

(During normal operations it is acceptable to see the following values for


SWITCHOVER_STATUS on the primary to be SESSIONS ACTIVE or TO STANDBY.
During normal operations on the standby it is acceptable to see the values of NOT ALLOWED or
SESSIONS ACTIVE)

2. Convert the primary database to the new standby:

sql> alter database commit to switchover to physical standby;


Database altered.

3. Shutdown the former primary and mount as a standby database:


sql> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
sql> startup nomount
ORACLE instance started.
Total System Global Area 85020944 bytes Fixed Size
454928 bytes Variable Size 71303168 bytes Database Buffers
12582912 bytes Redo Buffers 679936 bytes
sql> alter database mount standby database;
Database altered.
4. Verify that the physical standby can be converted to the new primary:

sql> select switchover_status from v$database;


SWITCHOVER_STATUS
------------------
SWITCHOVER PENDING

Note that if the status returns SESSIONS ACTIVE then you should append the with session
shutdown clause to the command in step 5.

5. Convert the physical standby to the new primary:

sql> alter database commit to switchover to primary;


Database altered.
If the physical standby database has not been opened in read-only mode since the last
time it was started, issue the SQL ALTER DATABASE OPEN statement to open the
new primary database
If the physical standby database has been opened in read-only mode since the last time it
was started, you must shut down the target standby database and restart it:

6. Shutdown and startup the new primary:

sql> shutdown immediate


ORA-01507: database not mounted
ORACLE instance shut down.
sql> startup
ORACLE instance started.
Total System Global Area 85020944 bytes Fixed Size
454928 bytes Variable Size 71303168 bytes Database
Buffers 12582912 bytes Redo Buffers
679936 bytes Database mounted.
Database opened.

9. Start managed recover on the new standby database:


sql> recover managed standby database disconnect;
Media recovery complete.

Note :- Shutdown standby database Procedure.

sql> recover managed standby database cancel;


sql> shutdown immediate;

You might also like