Physical Data Guard failover process

One of my application is oracle physical data guard, and server team found the memory on primary node is broken and BIOS is too old, so we have to replace RAM and update BIOS. Then the solution is to switch the standby database to primary and primary to standby – that means to switch the database role.

Today I finish this task, would like to record it since i don’t have enough RAM in my brain, I will forget the process.. 🙂

Step 1: Ask partner to shutdown application from their side, so no user is using the system when I’m switching the databases ;

Step 2: apply archive logs to standby database, make sure it’s syncing up with primary
archive log list
select max(sequence#) from v$log_history ;
recover standby database ;

Step 3: check both primary and standby database status, make sure they are ready for the switch ;
Select DATABASE_ROLE, SWITCHOVER_STATUS FROM V$DATABASE;

Step 4: Switch the role

4-1). On primary node
if switchover_status is TO_PRIMARY, can use this sql to switch primary to standby,
Alter DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY ;

If switchover_status is SESSION ACTIVE, this is the sql to failover,
Alter DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;
shutdown immediate;
startup nomount ;
alter database mount standby database ;

4-2). On Standby node
Alter DATABASE COMMIT TO SWITCHOVER TO PRIMARY ;
or
Alter DATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN;

shutdown immediate;
startup ;

Step 5: Make sure the new standby DB syncs up with new primary DB

5-1), on new primary,
archive log list

5-2). on new standby
alter database recover managed standby database using current logfile disconnect from session;
archive log list
select max(sequence#) from v$log_history ;
use the last two sql to query the log applying progress.. make sure the new standby is syncing up with new primary..

the whole process doesn’t take long time, it’s my first time to do such thing, and it took me about 10 mins. hope I have good lucky  tomorrow when I witch it back once server team replace the RAM and update the BIOS.

发表评论?

0 条评论。

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>