Add extra standby database to complete database migration to new servers with minimal outage

1. Background:

       When we have to upgrade Redhat Operating System due to license expiration for a Production database which has been configured Data Guard, as we know Redhat dosen`t support self-upgrade therefore we have to build brand new servers then migrate the primary and standby databases. thus the question comes up:  What do we do to complete this migration with minimal outage?   

       In this test, I`ll complete this task by adding the new server as an standby into dataguard, then switch-over the roles to complete migration.


2. Environment:

       Existing data guard contains one standby database.    Oracle 11.2.0.3 EE.  Linux Redhat 5.8

       Hostname:   redhat1 (primary),  redhat2 (standby)

  

      New built Operating system server without any Oracle application installed.  Linux Redhat 6.

      Hostname:   redhat3 (new primary),  redhat4 (new standby) .    


3. Thinking:

     i) Install Oracle software into redhat3 and redhat4

     ii) Add redhat3 , redhat4 as two additional standby databases for redhat1.  (One primary DB and three standby DBs)

     iii) Switchover redhat1 to standby and redhat3 to primary.  And modify application connection string to access redhat3.  (only 5 mins outage)

     iv)  Remove redhat1, redhat2 from Data Guard. 


4. Test Process:

step1.  Install Oracle software into redhat3 and redhat4

Please refer to previous articles for details:

Centos5.7x64 上部署 oracle11R2 重点概要

离开图形界面的那些日子 之一:Oracle 11.2.0.3 software setup in Silent Mode



step2.  Modify network files for 4 servers

i) listener.ora :

Copy the file into redhat3 and redhat4.  No modification is required.


ii) tnsnames.ora :

Add redhat3, redhat3 database alias into tnsnames.ora, then copy to new servers.  Use tnsping to verify it works fine from any server to any other one.


iii) oraPWD file :

Copy it into new servers $ORACLE_HOME/dbs directly.


step3.  Modify instance initial parameters for 4 servers (Sample)

Redhat1: test3_A

alter system set log_archive_config='dg_config=(test3_A,test3_B,test3_C,test3_D)';
alter system set log_archive_dest_3='service=test3_C lgwr sync AFFIRM delay=0 reopen=300 net_timeout=15 valid_for=(online_logfiles,primary_roles) db_unique_name=test3_C';
alter system set log_archive_dest_4='service=test3_D lgwr sync AFFIRM delay=0 reopen=300 net_timeout=15 valid_for=(online_logfiles,primary_roles) db_unique_name=test3_D';
alter system set log_archive_dest_state_3=enable;
alter system set log_archive_dest_state_4=enable;
alter system set fal_server='test3_B','test3_C','test3_D';

Redhat2: test3_B

alter system set log_archive_config='dg_config=(test3_A,test3_B,test3_C,test3_D)';
alter system set log_archive_dest_3='service=test3_C lgwr sync AFFIRM delay=0 reopen=300 net_timeout=15 valid_for=(online_logfiles,primary_roles) db_unique_name=test3_C';
alter system set log_archive_dest_4='service=test3_D lgwr sync AFFIRM delay=0 reopen=300 net_timeout=15 valid_for=(online_logfiles,primary_roles) db_unique_name=test3_D';
alter system set log_archive_dest_state_3=enable;
alter system set log_archive_dest_state_4=enable;
alter system set fal_server='test3_A','test3_C','test3_D';

Redhat3: test3_C

db_unique_name='test3_C'
log_archive_config='dg_config=(test3_A,test3_B,test3_C,test3_D)'
log_archive_dest_1='location=/u01/archivelogs/test3 valid_for=(all_logfiles,all_roles) db_unique_name=test3_C'
log_archive_dest_2='service=test3_A lgwr sync AFFIRM delay=0 reopen=300 net_timeout=15 valid_for=(online_logfiles,primary_roles) db_unique_name=test3_A'
log_archive_dest_3='service=test3_B lgwr sync AFFIRM delay=0 reopen=300 net_timeout=15 valid_for=(online_logfiles,primary_roles) db_unique_name=test3_B'
log_archive_dest_4='service=test3_D lgwr sync AFFIRM delay=0 reopen=300 net_timeout=15 valid_for=(online_logfiles,primary_roles) db_unique_name=test3_D'
log_archive_dest_state_1=enable
log_archive_dest_state_2=enable
log_archive_dest_state_3=enable
log_archive_dest_state_4=enable
fal_client='test3_C'
fal_server='test3_A','test3_B','test3_D'

Redhat4: test3_D

db_unique_name='test3_D'
log_archive_config='dg_config=(test3_A,test3_B,test3_C,test3_D)'
log_archive_dest_1='location=/u01/archivelogs/test3 valid_for=(all_logfiles,all_roles) db_unique_name=test3_C'
log_archive_dest_2='service=test3_A lgwr sync AFFIRM delay=0 reopen=300 net_timeout=15 valid_for=(online_logfiles,primary_roles) db_unique_name=test3_A'
log_archive_dest_3='service=test3_B lgwr sync AFFIRM delay=0 reopen=300 net_timeout=15 valid_for=(online_logfiles,primary_roles) db_unique_name=test3_B'
log_archive_dest_4='service=test3_C lgwr sync AFFIRM delay=0 reopen=300 net_timeout=15 valid_for=(online_logfiles,primary_roles) db_unique_name=test3_C'
log_archive_dest_state_1=enable
log_archive_dest_state_2=enable
log_archive_dest_state_3=enable
log_archive_dest_state_4=enable
fal_client='test3_D'
fal_server='test3_A','test3_B','test3_C'



step4. Create standby databases in redhat3 and redhat4 

RUN
{
backup incremental level=0 as compressed backupset database format '/u01/rman/test3/db_%u_%T.bk' include current controlfile for standby   
plus archivelog format '/u01/rman/test3/arc_%u_%T.bk' delete all input;
}

 
[oracle@redhat1 ~]$ rman target / auxiliary sys/oracle@test3_C
duplicate target database for standby nofilenamecheck;


[oracle@redhat1 ~]$ rman target / auxiliary sys/oracle@test3_D
duplicate target database for standby nofilenamecheck;


alter database recover managed standby database using current logfile disconnect from session;




step5. Switch over database roles and make application access the new Primary Database  (Only 5 mins Outage)

P: alter database commit to switchover to physical standby; 
   shutdown immediate 
   startup mount      
   alter database recover managed standby database using current logfile disconnect from session;

S: alter database commit to switchover to physical primary;
   alter database open




step6. Remove redhat1 , redhat2 from Data Guard.

Change files and parameters which were modified in step2&3.


----END----

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值