1.

STEPS for switchover from primary to standby database: This document only talks about switchover involving physical standby database. In this example, the original primary data is called PRIM and the original standby database is called STBY. I. Checks before Switchover: 1. Verify the primary database instance is open and the standby database instance is mounted. 2. Verify there are no active users connected to the databases. 3. Make sure the last redo data transmitted from the Primary database was applied on the standby database. Issue the following commands on Primary database and Standby database to find out: SQL>select sequence#, applied from v$archvied_log; Perform SWITCH LOGFILE if necessary. In order to apply redo data to the standby database as soon as it is received, use Real-time apply. II. Quick Switchover Steps 1. Initiate the switchover on the primary database PRIM: SQL>connect /@PRIM as sysdba SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN; 2. After step 1 finishes, Switch the original physical standby db STBY to primary role; Open another prompt and connect to SQLPLUS: SQL>connect /@STBY as sysdba SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY; 3. Immediately after issuing command in step 2, shut down and restart the former primary instance PRIM: SQL>SHUTDOWN IMMEDIATE; SQL>STARTUP MOUNT;

shut down and restart the former primary instance PRIM: .If you are using Oracle Database 10g release 1..If you are using Oracle Database 10g release 2. first connect to your standby database and execute the following command.. On the new primary database STBY. 3. SQL>STARTUP. After that. SQL>ALTER SYSTEM SWITCH LOGFILE. STBY is now transitioned to the primary database role.. you will have to Shut down and restart the new primary database STBY. you can open the new Primary database STBY: SQL>ALTER DATABASE OPEN. Switch the original physical standby db to primary role. No one should be connected to the database. Immediately after issuing command in step 2.. perform a SWITCH LOGFILE to start sending redo data to the standby database PRIM. . Check the primary database instance must be open and the standby database instance is mounted.. SQL>SHUTDOWN IMMEDIATE. After step 3 completes: . You can use the below command to check...4.. 5..max(sequence#) from v$archived_log where applied='YES' SQL>connect /@PRIM as sysdba SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN... SQL> select thread#. Check the current archived log and last archived log on both primary and standby databases. SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY.

If the SWITCHOVER_STATUS column in step 1 returned SESSION ACTIVE. SQL> startup mount. SQL>ALTER SYSTEM SWITCH LOGFILE. everything is good. 4.SQL>SHUTDOWN IMMEDIATE. Step 3: Shut down and restart the old primary as a new standby. perform a SWITCH LOG FILE to start sending redo data to the standby database PRIM . you should perform the SWITCHOVER command with the SESSION SHUTDOWN clause. SQL>alter database commit to switchover to physical standby. . you must shut down all instances but one. If the query returns SESSION ACTIV. SQL>STARTUP MOUNT. After step 3 completes: Now open the new Primary database SQL>ALTER DATABASE OPEN. On the new primary database STANDBY. SQL> select switchover_status from v$database. ========= MANUAL SWITCHOVER============== If the primary is a RAC database. query the V$database view to verify that the SWITCHOVER_STATUS column indicates that a switchover is possible. STANDBY is now transitioned to the primary database role. Step 2: Convert the primary database into a physical standby. Step 1: On the primary database. SQL> shutdown immediate. issue the following command: SQL> alter database commit to switchover to physical standby with session shutdown. If SWITCHOVER_STATUS returns a value of TO_STANDBY. 5.

SQL> shutdown immediate. Query the SWITCHOVER_STATUS column of V$DATABASE on the standby to ensure that the marker has been recovered and it is ready for the switchover to primary. Suppose we want to switchover to LSD site. execute following. If the status is SESSION ACTIVE. SQL> alter database commit to switchover to primary with session shutdown. If SWITCHOVER_STATUS returns TO_PRIMARY. If primary server is in maximum protection or maximum availability mode. it is eligible to become a primary database. if the SWITCHVOER_STATUS returned SESSION ACTIVE. the market has not been received and recovered bye the standby. DGMGRL> SHOW DATABASE VERBOSE 'orc1 . Or.Step 4: When we converted the primary to a standby. the marker has been recovered and you can proceed with the SWITCHOVER TO PRIMARY command. If the status states NOT ALLOWED. Step 6: Shut down and restart the new primary database. SQL> alter database commit to switchover to primary. you should either disconnect active sessions or issue the SWITCHOVER command with the SESSION SHUTDOWN clause. The market states that no more redo has been generated. DGMGRL>EDIT DATABASE 'LSD SET PROPERTY 'LogXptMode'='SYNC'. we generated a marker in the redo stream and sent that market to the standby. Step 2: Check the primary database. Step 3: Check the standby database that is the target of the switchover. . SQL> startup. As soon as the standby receives and recovers that marker.and switchover cannot proceed. SQL>select switchover_status from v$database. Step 5: Convert the standby to a primary database. Property "LogXptMode" updated. =====SWITCHOVER USING DATAGUARD BROKER========= Step 1: Set the LogXptMode property appropriately.

value from v$parameter where name in ('log_archive_dest_1'.'log_archive_dest _state_3). Step 4: If primary database has multiple instances. we are given the following response.'log_archive_dest_state_1'. DGMGRL> SWITCHOVER TO LSD . select the standby server you wish to become the new primary server. Performing Switchover Now. then click the Switchover button. Please wait Once the broker completes the switchover process. Sandeep Oracle dataguard What are the things that a DBA needs to take care of before performing switchover from Production DB to physical standby which is at remote location in Data guard environment? Oracle 10g on AIX Sandeep Mohanty CHECKLIST BEFORE SWITCHOVER OPERATION ===================================== Please note log_archive_dest_state_3 :(archive dest for standby database) log_archive_dest_state_1 :(archive dest for primary database) SELECT PROTECTION_MODE FROM V$DATABASE. navigate to the Setup and Manage screen.DGMGRL> SHOW DATABASE VERBOSE LSD . Switchover succeeded. Make sure 'lgwr' and not 'arch' is mentioned here. otherwise new primary database will not open after switchover (if the protection_mode is Maximum availability). Shutdown all instances except one. -Regards. NOTE: LSD= local physical standby database ORC1= Primary ========= Switchover using 11g OEM Grid Control ======== To perform a switchover. New primary is LSD .'log_archive_dest_3'. SQL> select name. .

on primary -SQL> select database_role from v$database.on primary ---SQL> select distinct status from v$datafile. OPEN_MODE MOUNTED --->PROCEED with switchover.value from v$parameter where name in ('log_archive_dest_1'. DO NOT PROCEED with the switchover -. DATABASE_ROLE ---------------PHYSICAL STANDBY -.-. 'log_archive_dest_3'. STATUS ONLINE SYSTEM If any file(s) are in RECOVER status. issue this command : sql> alter system set log_archive_dest_state_3='ENABLE' scope=both. ---.'log_archive_dest_state_1'.'log_archive_dest_state_3). .on standby database-SQL> select database_role from v$database. log_archive_dest_state_3 -----------------DEFER --->DO NOT PROCEED. DATABASE_ROLE ---------------PRIMARY SQL>select name.on standby database-SQL> select distinct open_mode from v$database.

on standby database-SQL> select max(SEQUENCE#) LAST_LOG_APPLIED FROM V$ARCHIVED_LOG WHERE THREAD# = 1 and APPLIED= YES . LAST_LOG_APPLIED 3988 ---> PROCEED -Regards.on primary ---SQL> select max(SEQUENCE#) LAST_LOG_GENERATED FROM V$ARCHIVED_LOG WHERE THREAD# =1 and ARCHIVED= YES . LAST_LOG_GENERATED 3988 -. OPEN_MODE READ ONLY --->DO NOT PROCEED with switchover.SQL> select distinct open_mode from v$database. Sandeep . To confirm that logs are being shipped and more importantly the LAST LOG archived has been applied ---.

Sign up to vote on this title
UsefulNot useful