Oracle Dataguard Manual Switchover

I am in the process of putting my notes into web pages, please keep checking in later for more contents

top   prev   next  

1): On primary (server-A):

-- make sure no (active) user sessions connected to the primary db before do the switchover.
set linesize 180 trimspool on
column MACHINE FORMAT A50
select database_role, status, machine, count(*) from v$session, v$database 
where type='USER' 
group by DATABASE_ROLE, status, machine 
order by DATABASE_ROLE, status, machine;

select DATABASE_ROLE,  switchover_status  from v$database;

--     Note: [ Sometimes it takes a while to get the "TO STANDBY" . It will show as
--    "SESSIONS ACTIVE" . Dont Panic just wait for sometime and execute the query again. ] 

select status, gap_status from v$archive_dest_status  where dest_id = 2;

STATUS    GAP_STATUS
--------- ------------------------
VALID     NO GAP

2): On primary (server-A)

select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
TO STANDBY

3):On primary  (server-A)

ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY;
---dangerous, kill active session --- alter database commit to switchover to physical standby with session shutdown;

4): On primary (server-A)
shutdown immediate;



top   prev   next  

1): On standby: (server-B)

select switchover_status from v$database;

SWITCHOVER_STATUS
--------------------
TO PRIMARY

-- if says "NOT ALLOWED" then :
	ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
	ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

2): On standby: (server-B)
alter database commit to switchover to primary;

3): On standby: (server-B)
alter database open;

or
shutdown immediate;
startup;




top   prev   next  

on new standby (original primary) (server-A)
5): On Old primary 
startup nomount
alter database mount standby database;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;