日期:2014-05-16  浏览次数:20440 次

Oracle 10gR2 (10.2.0.5) 3-Nodes RAC to Single Dataguard Switchover

Step By Step Configuring Oracle 10gR2 (10.2.0.5) 3-Nodes RAC to Single Dataguard


DG配置参考上面链接。主库环境是3-nodes的 RAC,保证实例racdb1正常运行,关闭racdb2和racdb3实例。

备库至于mount状态。

[oracle@standby arch]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Thu Dec 27 14:18:02 2012

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> set line 200
SQL> select dbid,name,switchover_status,db_unique_name,database_role,open_mode,current_scn from v$database;

      DBID NAME      SWITCHOVER_STATUS	  DB_UNIQUE_NAME		 DATABASE_ROLE	  OPEN_MODE  CURRENT_SCN
---------- --------- -------------------- ------------------------------ ---------------- ---------- -----------
 800157471 RACDB     SESSIONS ACTIVE	  standby			 PHYSICAL STANDBY MOUNTED	 1167683

SQL> 

主库停止racdb2,racdb3实例

[oracle@racnode1 ~]$ srvctl stop instance -d racdb -i racdb2
[oracle@racnode1 ~]$ srvctl stop instance -d racdb -i racdb3
[oracle@racnode1 ~]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------
ora.racdb.db   application    ONLINE    ONLINE    racnode2    
ora....b1.inst application    ONLINE    ONLINE    racnode1    
ora....b2.inst application    OFFLINE   OFFLINE               
ora....b3.inst application    OFFLINE   OFFLINE               
ora.....zwc.cs application    ONLINE    ONLINE    racnode1    
ora....db1.srv application    ONLINE    ONLINE    racnode1    
ora....SM1.asm application    ONLINE    ONLINE    racnode1    
ora....E1.lsnr application    ONLINE    ONLINE    racnode1    
ora....de1.gsd application    ONLINE    ONLINE    racnode1    
ora....de1.ons application    ONLINE    ONLINE    racnode1    
ora....de1.vip application    ONLINE    ONLINE    racnode1    
ora....SM2.asm application    ONLINE    ONLINE    racnode2    
ora....E2.lsnr application    ONLINE    ONLINE    racnode2    
ora....de2.gsd application    ONLINE    ONLINE    racnode2    
ora....de2.ons application    ONLINE    ONLINE    racnode2    
ora....de2.vip application    ONLINE    ONLINE    racnode2    
ora....SM3.asm application    ONLINE    ONLINE    racnode3    
ora....E3.lsnr application    ONLINE    ONLINE    racnode3    
ora....de3.gsd application    ONLINE    ONLINE    racnode3    
ora....de3.ons application    ONLINE    ONLINE    racnode3    
ora....de3.vip application    ONLINE    ONLINE    racnode3    

在主库确定switchover状态,如果是to standby说明可以正常切换,如果是session active可以加上with session shutdown语句执行

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
racdb1

SQL> select current_scn,protection_mode,database_role,force_logging,open_mode,switchover_status from v$database;

CURRENT_SCN PROTECTION_MODE	 DATABASE_ROLE	  FOR OPEN_MODE  SWITCHOVER_STATUS
----------- -------------------- ---------------- --- ---------- --------------------
    1188246 MAXIMUM PERFORMANCE  PRIMARY	  YES READ WRITE SESSIONS ACTIVE

将RAC主库切换为备库角色

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
racdb1

SQL> select current_scn,protection_mode,database_role,force_logging,open_mode,switchover_s