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

47 篇文章 0 订阅
12 篇文章 0 订阅

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_status from v$database;

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

SQL> 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 mounted


ORACLE 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_name

NAME				     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.803141059

9 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 0
  Mem# 0: +DATADG/racdb/onlinelog/group_8.273.803122441
  Mem# 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_name

NAME				     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
racdb1

SQL> conn hr
Enter password: 
Connected.
SQL> desc t_test003
 Name		   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.803129599

8 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_name

NAME				     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	 1190108
 800157471 RACDB     SESSIONS ACTIVE	  racdb 			 PHYSICAL STANDBY MOUNTED	 1190108
 800157471 RACDB     SESSIONS ACTIVE	  racdb 			 PHYSICAL STANDBY MOUNTED	 1190108

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    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	 1190421

SQL> 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 mounted

SQL> shutdown immediate
ORA-01507: database not mounted


ORACLE 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	 1190459

SQL> 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 racdb2

SQL> !srvctl stop instance -d racdb -i 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	 1190459

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    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 racdb2

SQL> !srvctl start instance -d racdb -i racdb3

SQL> !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 0
  Mem# 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 0
  Mem# 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 0
  Mem# 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 sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Thu Dec 27 15:36:34 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, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> show parameter service_name

NAME				     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









评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值