Friday, May 06, 2011

Steps for Switch Over - 10g Dataguard

A switchover must be initiated on the current primary database and completed on the target standby database.

Step 1 Verify it is possible to perform a switchover.

SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;
SWITCHOVER_STATUS
-----------------
TO STANDBY
1 row selected

If the SWITCHOVER_STATUS column still displays SESSIONS ACTIVE, you can successfully perform a switchover by appending the WITH SESSION SHUTDOWN clause to the ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY statement

Step 2 Initiate the switchover on the primary database.

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY;


SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP MOUNT;

Step 4 Verify the switchover status in the V$DATABASE view.

SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;
SWITCHOVER_STATUS
-----------------
TO_PRIMARY
1 row selected

Step 5 Switch the target physical standby database role to the primary role.

You can switch a physical standby database from the standby role to the primary role
when the standby database instance is either mounted in Redo Apply mode or open
for read-only access

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;


Step 6 Finish the transition of the standby database to the primary role.

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:

SQL> ALTER DATABASE OPEN;

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:

SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP;

Note: There is no need to shut down and restart other standby databases (not involved in the switchover) that are online at the time of the switchover. These standby databases will continue to
function normally after the switchover completes.

Step 7 If necessary, restart log apply services on the standby databases.
We have to issue the comman fro redo apply as:
SQL> alter database recover managed standby database disconnect from session;
or
And to stop redo apply give
SQL> alter database recover managed standby database cancel;

Step 3 Shut down and restart the former primary instance.


SQL> SELECT OPEN_MODE FROM V$DATABASE;
// return the open mode like read write or mounted


you can enable .real-time apply, which allows Data Guard to recover redo data from the current standby redo log file as it is being filled up by the RFS process.
■ For physical standby databases, issue the
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE statement


Note: some time there will be mismatch in sequence no while ARCHIVE LOG LIST command , this we can solve by adding one more group to the exact directory.. every time the standby redolog group is primary redolog group plus one inorder to maintane the performance and to apply the redologs. So while we are adding we must stop the redo apply by the above command and after adding dont forget to restart redo apply.

Step 8 Begin sending redo data to the standby databases.

Issue the following statement on the new primary database:SQL> ALTER SYSTEM SWITCH LOGFILE;


Step 9 Verify the sync between primary and standby:

From primary
SQL > select thread#,max(sequence#) from v$archived_log where archived='YES' group by thread#;

From Standby
SQL > select thread#,max(sequence#) from v$archived_log where applied ='YES' group by thread#;

Shut down the former primary instance, and restart and mount the database:



Regards,
Sukhwinder Singh

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

There was an error in this gadget