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

2024-02-01 09:18

本文主要是介绍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 sysdbaSQL*Plus: Release 10.2.0.5.0 - Production on Thu Dec 27 14:18:02 2012Copyright (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 optionsSQL> 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	 1167683SQL> 

主库停止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
----------------
racdb1SQL> 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
----------------
racdb1SQL> 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
----------- -------------------- ---------------- --- ---------- --------------------1188294 MAXIMUM PERFORMANCE  PRIMARY	  YES READ WRITE SESSIONS ACTIVESQL> alter database commit to switchover to physical standby with session shutdown;Database altered.SQL> select open_mode from v$database;
select open_mode from v$database*
ERROR at line 1:
ORA-01507: database not mounted

启动racdb1到mount

SQL> shutdown immediate
ORA-01507: database not mountedORACLE instance shut down.
SQL> startup mount
ORACLE instance started.Total System Global Area  599785472 bytes
Fixed Size		    2098112 bytes
Variable Size		  201329728 bytes
Database Buffers	  390070272 bytes
Redo Buffers		    6287360 bytes
Database mounted.
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	  racdb 			 PHYSICAL STANDBY MOUNTED	 1188349

确认原备库single database的switchover状态,如果是to primary说明可以正常切换,如果是session active可以加上with session shutdown语句执行

SQL> show parameter instance_nameNAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
instance_name			     string	 standby
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     TO PRIMARY 	  standby			 PHYSICAL STANDBY MOUNTED	 1188349

切换原来备库为主库角色

SQL> alter database commit to switchover to primary;Database altered.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     TO STANDBY 	  standby			 PRIMARY	  MOUNTED	       0

切换完成,验证日志传输,数据同步

在现备库racdb1操作

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.Total System Global Area  599785472 bytes
Fixed Size		    2098112 bytes
Variable Size		  201329728 bytes
Database Buffers	  390070272 bytes
Redo Buffers		    6287360 bytes
SQL> alter database mount standby database;Database altered.SQL> alter database recover managed standby database using current logfile disconnect from session;Database altered.

在现主库standby创建表空间

SQL> alter database open;Database altered.SQL> alter system switch logfile;System altered.SQL> create tablespace test003 datafile size 10M autoextend on;Tablespace created.

在现备库racdb1查看,test003已经同步过来

SQL> alter database mount standby database;Database altered.SQL> alter database recover managed standby database using current logfile disconnect from session;Database altered.SQL> select name from v$datafile;NAME
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+DATADG/racdb/datafile/system.269.802972261
+DATADG/racdb/datafile/undotbs1.256.802972267
+DATADG/racdb/datafile/sysaux.265.802972263
+DATADG/racdb/datafile/users.257.802972267
+DATADG/racdb/datafile/example.258.802972265
+DATADG/racdb/datafile/undotbs2.259.802972265
+DATADG/racdb/datafile/undotbs3.264.802972269
+DATADG/racdb/datafile/test.281.803129599
+DATADG/racdb/datafile/test003.282.8031410599 rows selected.
现备库alert.log

RFS[2]: Archived Log: '/u01/app/oracle/arch/1_66_802540708.dbf'
Thu Dec 27 14:44:15 CST 2012
Media Recovery Log /u01/app/oracle/arch/1_66_802540708.dbf
Media Recovery Log /u01/app/oracle/arch/1_67_802540708.dbf
Media Recovery Log /u01/app/oracle/arch/1_68_802540708.dbf
Media Recovery Waiting for thread 1 sequence 69 (in transit)
Thu Dec 27 14:44:18 CST 2012
Recovery of Online Redo Log: Thread 1 Group 8 Seq 69 Reading mem 0Mem# 0: +DATADG/racdb/onlinelog/group_8.273.803122441Mem# 1: +FLASHDG/racdb/onlinelog/group_8.268.803122445
Successfully added datafile 9 to media recovery
Datafile #9: '+DATADG/racdb/datafile/test003.282.803141059'

在现主库standby创建表,insert几条数据

SQL> show parameter instance_nameNAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
instance_name			     string	 standby
SQL> conn hr/
Enter password: 
Connected.
SQL> create table t_test003 (tid number(3) primary key,tname varchar2(30)) tablespace test003;Table created.SQL> insert into t_test003 values(1,'switchover OK!');1 row created.SQL> commit;Commit complete.

在现备库racdb1查看数据是否同步

SQL> alter database recover managed standby database cancel;Database altered.SQL> alter database open;Database altered.SQL> select open_mode from v$database union all select instance_name from v$instance;OPEN_MODE
----------------
READ ONLY
racdb1SQL> conn hr
Enter password: 
Connected.
SQL> desc t_test003Name		   Null?    Type----------------- -------- ------------TID		   NOT NULL NUMBER(3)TNAME			    VARCHAR2(30)SQL> select * from t_test003;TID TNAME
---------- ------------------------------1 switchover OK!

在现主库standby删除test003表空间

SQL> drop tablespace test003 including contents and datafiles;Tablespace dropped.

在现备库racdb1查看是否删除

SQL> select name from v$datafile;NAME
--------------------------------------------------------------------------------
+DATADG/racdb/datafile/system.269.802972261
+DATADG/racdb/datafile/undotbs1.256.802972267
+DATADG/racdb/datafile/sysaux.265.802972263
+DATADG/racdb/datafile/users.257.802972267
+DATADG/racdb/datafile/example.258.802972265
+DATADG/racdb/datafile/undotbs2.259.802972265
+DATADG/racdb/datafile/undotbs3.264.802972269
+DATADG/racdb/datafile/test.281.8031295998 rows selected.
alert.log

RFS[1]: Archived Log: '/u01/app/oracle/arch/1_69_802540708.dbf'
RFS[1]: Archived Log: '/u01/app/oracle/arch/1_70_802540708.dbf'
Thu Dec 27 14:58:36 CST 2012
Media Recovery Log /u01/app/oracle/arch/1_69_802540708.dbf
Recovery deleting file #9:'+DATADG/racdb/datafile/test003.282.803141059' from controlfile.
Deleted Oracle managed file +DATADG/racdb/datafile/test003.282.803141059
Recovery dropped tablespace 'TEST003'
Media Recovery Log /u01/app/oracle/arch/1_70_802540708.dbf
Media Recovery Waiting for thread 1 sequence 71


racdb1和standby角色还原

在standby操作

SQL> show parameter instance_nameNAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
instance_name			     string	 standby
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.Total System Global Area  599785472 bytes
Fixed Size		    2098112 bytes
Variable Size		  163580992 bytes
Database Buffers	  427819008 bytes
Redo Buffers		    6287360 bytes
Database mounted.
Database opened.
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     TO STANDBY 	  standby			 PRIMARY	  READ WRITE	 1190295

启动racdb2,racdb3到mount

SQL> select dbid,name,switchover_status,db_unique_name,database_role,open_mode,current_scn from gv$database;DBID NAME      SWITCHOVER_STATUS	  DB_UNIQUE_NAME		 DATABASE_ROLE	  OPEN_MODE  CURRENT_SCN
---------- --------- -------------------- ------------------------------ ---------------- ---------- -----------800157471 RACDB     SESSIONS ACTIVE	  racdb 			 PHYSICAL STANDBY MOUNTED	 1190108800157471 RACDB     SESSIONS ACTIVE	  racdb 			 PHYSICAL STANDBY MOUNTED	 1190108800157471 RACDB     SESSIONS ACTIVE	  racdb 			 PHYSICAL STANDBY MOUNTED	 1190108SQL> !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    ONLINE    ONLINE    racnode2    
ora....b3.inst application    ONLINE    ONLINE    racnode3    
ora.....zwc.cs application    ONLINE    OFFLINE               
ora....db1.srv application    ONLINE    OFFLINE               
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 

在standby操作

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     TO STANDBY 	  standby			 PRIMARY	  READ WRITE	 1190421SQL> alter database commit to switchover to physical standby;Database altered.SQL> select open_mode from v$database;
select open_mode from v$database*
ERROR at line 1:
ORA-01507: database not mountedSQL> shutdown immediate
ORA-01507: database not mountedORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.Total System Global Area  599785472 bytes
Fixed Size		    2098112 bytes
Variable Size		  163580992 bytes
Database Buffers	  427819008 bytes
Redo Buffers		    6287360 bytes
SQL> alter database mount standby database;Database altered.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     TO PRIMARY 	  standby			 PHYSICAL STANDBY MOUNTED	 1190459

在racdb1操作,停止racdb2,racdb3实例,切换为主库角色

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	  racdb 			 PHYSICAL STANDBY MOUNTED	 1190459SQL> alter database commit to switchover to primary with session shutdown;
alter database commit to switchover to primary with session shutdown
*
ERROR at line 1:
ORA-38777: database must not be started in any other instance.SQL> !srvctl stop instance -d racdb -i racdb2SQL> !srvctl stop instance -d racdb -i racdb3SQL>  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	  racdb 			 PHYSICAL STANDBY MOUNTED	 1190459SQL> !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    OFFLINE               
ora....db1.srv application    ONLINE    OFFLINE               
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    SQL> alter database commit to switchover to primary with session shutdown;Database altered.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	  racdb 			 PRIMARY	  MOUNTED	       0

启动RAC所有instance

SQL> !srvctl start instance -d racdb -i racdb2SQL> !srvctl start instance -d racdb -i racdb3SQL> !srvctl start service -d racdb -s zwc
PRKP-1062 : Service zwc is already running.SQL> !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    ONLINE    ONLINE    racnode2    
ora....b3.inst application    ONLINE    ONLINE    racnode3    
ora.....zwc.cs application    ONLINE    ONLINE    racnode1    
ora....db1.srv application    ONLINE    ONLINE    racnode2    
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    
SQL> alter database open;Database altered.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	  racdb 			 PRIMARY	  READ WRITE	 1191263



切换完成,验证同步

在racdb1上

SQL> create tablespace test004 datafile size 10m;Tablespace created.SQL> create tablespace test005 datafile size 10m;Tablespace created.SQL> create tablespace test006 datafile size 10m;Tablespace created.

在standby上验证

SQL> alter database recover managed standby database using current logfile disconnect from session;Database altered.
alert.log

Waiting for all non-current ORLs to be archived...
Clearing online redo logfile 1 +DATADG/standby/onlinelog/group_1.273.803060123
Clearing online log 1 of thread 1 sequence number 82
Deleted Oracle managed file +DATADG/standby/onlinelog/group_1.273.803060123
Thu Dec 27 15:29:16 CST 2012
Completed: alter database recover managed standby database using current logfile disconnect from session
Thu Dec 27 15:29:16 CST 2012
Clearing online redo logfile 1 complete
Clearing online redo logfile 2 +DATADG/standby/onlinelog/group_2.274.803060125
Clearing online log 2 of thread 1 sequence number 82
Deleted Oracle managed file +DATADG/standby/onlinelog/group_2.274.803060125
Clearing online redo logfile 2 complete
Media Recovery Log /u01/app/oracle/arch/1_75_802540708.dbf
Media Recovery Log /u01/app/oracle/arch/1_76_802540708.dbf
Media Recovery Log /u01/app/oracle/arch/2_39_802540708.dbf
Media Recovery Log /u01/app/oracle/arch/1_77_802540708.dbf
Media Recovery Log /u01/app/oracle/arch/2_40_802540708.dbf
Media Recovery Log /u01/app/oracle/arch/3_33_802540708.dbf
Media Recovery Log /u01/app/oracle/arch/3_34_802540708.dbf
Media Recovery Log /u01/app/oracle/arch/1_78_802540708.dbf
Media Recovery Log /u01/app/oracle/arch/1_79_802540708.dbf
Media Recovery Log /u01/app/oracle/arch/1_80_802540708.dbf
Media Recovery Waiting for thread 2 sequence 41 (in transit)
Thu Dec 27 15:29:21 CST 2012
Recovery of Online Redo Log: Thread 2 Group 14 Seq 41 Reading mem 0Mem# 0: +DATADG/standby/onlinelog/group_14.267.803059831
Media Recovery Waiting for thread 3 sequence 35 (in transit)
Thu Dec 27 15:29:21 CST 2012
Recovery of Online Redo Log: Thread 3 Group 17 Seq 35 Reading mem 0Mem# 0: +DATADG/standby/onlinelog/group_17.270.803059869
Media Recovery Log /u01/app/oracle/arch/1_81_802540708.dbf
Successfully added datafile 9 to media recovery
Datafile #9: '+DATADG/standby/datafile/test004.281.803143763'
Media Recovery Waiting for thread 1 sequence 82 (in transit)
Thu Dec 27 15:29:23 CST 2012
Recovery of Online Redo Log: Thread 1 Group 11 Seq 82 Reading mem 0Mem# 0: +DATADG/standby/onlinelog/group_11.264.803059801
Thu Dec 27 15:29:48 CST 2012
Successfully added datafile 10 to media recovery
Datafile #10: '+DATADG/standby/datafile/test005.282.803143787'
Thu Dec 27 15:30:11 CST 2012
Successfully added datafile 11 to media recovery
Datafile #11: '+DATADG/standby/datafile/test006.283.803143811'
SQL> select name from v$datafile;NAME
------------------------------------------------------------------------------------------------------------------------------------------------------
+DATADG/standby/datafile/system.257.803059147
+DATADG/standby/datafile/undotbs1.259.803059147
+DATADG/standby/datafile/sysaux.261.803059163
+DATADG/standby/datafile/users.263.803059163
+DATADG/standby/datafile/example.258.803059147
+DATADG/standby/datafile/undotbs2.262.803059163
+DATADG/standby/datafile/undotbs3.260.803059149
+DATADG/standby/datafile/test.279.803129613
+DATADG/standby/datafile/test004.281.803143763
+DATADG/standby/datafile/test005.282.803143787
+DATADG/standby/datafile/test006.283.803143811

在racdb1上drop刚刚创建的表空间

SQL> drop tablespace test004 including contents and datafiles;Tablespace dropped.SQL> drop tablespace test005 including contents and datafiles;Tablespace dropped.SQL> drop tablespace test006 including contents and datafiles;Tablespace dropped.

在standby上验证同步

SQL> select name from v$datafile;NAME
------------------------------------------------------------------------------------------------------------------------------------------------------
+DATADG/standby/datafile/system.257.803059147
+DATADG/standby/datafile/undotbs1.259.803059147
+DATADG/standby/datafile/sysaux.261.803059163
+DATADG/standby/datafile/users.263.803059163
+DATADG/standby/datafile/example.258.803059147
+DATADG/standby/datafile/undotbs2.262.803059163
+DATADG/standby/datafile/undotbs3.260.803059149
+DATADG/standby/datafile/test.279.803129613
alert.log

Thu Dec 27 15:32:35 CST 2012
Recovery deleting file #9:'+DATADG/standby/datafile/test004.281.803143763' from controlfile.
Deleted Oracle managed file +DATADG/standby/datafile/test004.281.803143763
Recovery dropped tablespace 'TEST004'
Thu Dec 27 15:32:48 CST 2012
Recovery deleting file #10:'+DATADG/standby/datafile/test005.282.803143787' from controlfile.
Deleted Oracle managed file +DATADG/standby/datafile/test005.282.803143787
Recovery dropped tablespace 'TEST005'
Recovery deleting file #11:'+DATADG/standby/datafile/test006.283.803143811' from controlfile.
Deleted Oracle managed file +DATADG/standby/datafile/test006.283.803143811
Recovery dropped tablespace 'TEST006'

至此switchover结束,最后再把zwc服务拉回到racdb1

[oracle@racnode1 ~]$ srvctl relocate service -d racdb -s zwc -i racdb2 -t racdb1
[oracle@racnode1 ~]$ sqlplus / as sysdbaSQL*Plus: Release 10.2.0.5.0 - Production on Thu Dec 27 15:36:34 2012Copyright (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, Real Application Clusters, OLAP, Data Mining
and Real Application Testing optionsSQL> show parameter service_nameNAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
service_names			     string	 zwc
SQL> set linesize 150
SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';Session altered.SQL> select INSTANCE_NAME,HOST_NAME,VERSION,STARTUP_TIME,STATUS,ACTIVE_STATE,INSTANCE_ROLE,DATABASE_STATUS from gv$INSTANCE;INSTANCE_NAME	 HOST_NAME  VERSION	      STARTUP_TIME	  STATUS       ACTIVE_ST INSTANCE_ROLE	    DATABASE_STATUS
---------------- ---------- ----------------- ------------------- ------------ --------- ------------------ -----------------
racdb1		 racnode1   10.2.0.5.0	      2012-12-27 14:52:55 OPEN	       NORMAL	 PRIMARY_INSTANCE   ACTIVE
racdb3		 racnode3   10.2.0.5.0	      2012-12-27 15:21:09 OPEN	       NORMAL	 PRIMARY_INSTANCE   ACTIVE
racdb2		 racnode2   10.2.0.5.0	      2012-12-27 15:19:52 OPEN	       NORMAL	 PRIMARY_INSTANCE   ACTIVE









这篇关于Oracle 10gR2 (10.2.0.5) 3-Nodes RAC to Single Dataguard Switchover的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/666805

相关文章

Oracle数据库使用 listagg去重删除重复数据的方法汇总

《Oracle数据库使用listagg去重删除重复数据的方法汇总》文章介绍了在Oracle数据库中使用LISTAGG和XMLAGG函数进行字符串聚合并去重的方法,包括去重聚合、使用XML解析和CLO... 目录案例表第一种:使用wm_concat() + distinct去重聚合第二种:使用listagg,

oracle中exists和not exists用法举例详解

《oracle中exists和notexists用法举例详解》:本文主要介绍oracle中exists和notexists用法的相关资料,EXISTS用于检测子查询是否返回任何行,而NOTE... 目录基本概念:举例语法pub_name总结 exists (sql 返回结果集为真)not exists (s

Oracle的to_date()函数详解

《Oracle的to_date()函数详解》Oracle的to_date()函数用于日期格式转换,需要注意Oracle中不区分大小写的MM和mm格式代码,应使用mi代替分钟,此外,Oracle还支持毫... 目录oracle的to_date()函数一.在使用Oracle的to_date函数来做日期转换二.日

oracle数据库索引失效的问题及解决

《oracle数据库索引失效的问题及解决》本文总结了在Oracle数据库中索引失效的一些常见场景,包括使用isnull、isnotnull、!=、、、函数处理、like前置%查询以及范围索引和等值索引... 目录oracle数据库索引失效问题场景环境索引失效情况及验证结论一结论二结论三结论四结论五总结ora

Oracle Expdp按条件导出指定表数据的方法实例

《OracleExpdp按条件导出指定表数据的方法实例》:本文主要介绍Oracle的expdp数据泵方式导出特定机构和时间范围的数据,并通过parfile文件进行条件限制和配置,文中通过代码介绍... 目录1.场景描述 2.方案分析3.实验验证 3.1 parfile文件3.2 expdp命令导出4.总结

Oracle数据库执行计划的查看与分析技巧

《Oracle数据库执行计划的查看与分析技巧》在Oracle数据库中,执行计划能够帮助我们深入了解SQL语句在数据库内部的执行细节,进而优化查询性能、提升系统效率,执行计划是Oracle数据库优化器为... 目录一、什么是执行计划二、查看执行计划的方法(一)使用 EXPLAIN PLAN 命令(二)通过 S

leetcode-24Swap Nodes in Pairs

带头结点。 /*** Definition for singly-linked list.* public class ListNode {* int val;* ListNode next;* ListNode(int x) { val = x; }* }*/public class Solution {public ListNode swapPairs(L

Oracle type (自定义类型的使用)

oracle - type   type定义: oracle中自定义数据类型 oracle中有基本的数据类型,如number,varchar2,date,numeric,float....但有时候我们需要特殊的格式, 如将name定义为(firstname,lastname)的形式,我们想把这个作为一个表的一列看待,这时候就要我们自己定义一个数据类型 格式 :create or repla

ORACLE 11g 创建数据库时 Enterprise Manager配置失败的解决办法 无法打开OEM的解决办法

在win7 64位系统下安装oracle11g,在使用Database configuration Assistant创建数据库时,在创建到85%的时候报错,错误如下: 解决办法: 在listener.ora中增加对BlueAeri-PC或ip地址的侦听,具体步骤如下: 1.启动Net Manager,在“监听程序”--Listener下添加一个地址,主机名写计

Oracle Start With关键字

Oracle Start With关键字 前言 旨在记录一些Oracle使用中遇到的各种各样的问题. 同时希望能帮到和我遇到同样问题的人. Start With (树查询) 问题描述: 在数据库中, 有一种比较常见得 设计模式, 层级结构 设计模式, 具体到 Oracle table中, 字段特点如下: ID, DSC, PID; 三个字段, 分别表示 当前标识的 ID(主键), DSC 当