Professional Documents
Culture Documents
STEPS For Switch Over From Primary To Standby Database
STEPS For Switch Over 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.
1. Verify the primary database instance is open and the standby database
instance is mounted.
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.
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;
4. After step 3 completes:
- If you are using Oracle Database 10g release 1, you will have to Shut down
and restart the new
primary database STBY.
SQL>SHUTDOWN IMMEDIATE;
SQL>STARTUP;
- If you are using Oracle Database 10g release 2, you can open the new Primary
database STBY:
SQL>ALTER DATABASE OPEN;
Check the current archived log and last archived log on both primary and standby
databases.
first connect to your standby database and execute the following command......
3. Immediately after issuing command in step 2, shut down and restart the former
primary instance
PRIM:
SQL>SHUTDOWN IMMEDIATE;
SQL>STARTUP MOUNT;
5. On the new primary database STANDBY, perform a SWITCH LOG FILE to start
sending redo data to the
standby database PRIM
.
SQL>ALTER SYSTEM SWITCH LOGFILE;
Step 1: On the primary database, query the V$database view to verify that the
SWITCHOVER_STATUS column indicates that a switchover is possible.
SQL> alter database commit to switchover to physical standby with session shutdown;
Step 3: Shut down and restart the old primary as a new standby.
Step 3: Check the standby database that is the target of the switchover.
DGMGRL> SHOW DATABASE VERBOSE ‘LSD’;
Step 4: If primary database has multiple instances. Shutdown all instances except one.
Once the broker completes the switchover process, we are given the following
response.
To perform a switchover, navigate to the “Setup and Manage” screen, select the
standby server you wish to become the new primary server, then click the “Switchover”
button.
-Regards,
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
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).
-- on standby database--
SQL> select database_role from v$database;
DATABASE_ROLE
----------------
PHYSICAL STANDBY
-- on primary --
SQL> select database_role from v$database;
DATABASE_ROLE
----------------
PRIMARY
STATUS
——-
ONLINE
SYSTEM
If any file(s) are in RECOVER status, DO NOT PROCEED with the switchover
-- on standby database--
SQL> select distinct open_mode from v$database;
OPEN_MODE
———-
MOUNTED --->PROCEED with switchover.
SQL> select distinct open_mode from v$database;
OPEN_MODE
———-
READ ONLY --->DO NOT PROCEED with switchover.
To confirm that logs are being shipped and more importantly the LAST LOG archived
has been applied…
LAST_LOG_GENERATED
——————
3988
-- 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,
Sandeep