10gDG switchover 過程

super_sky發表於2014-03-18

primary環境資訊
IP : 192.168.152.10
ORACLE_SID=PROD
資料庫版本 10.2.0.1
作業系統 Red Hat Enterprise Linux Server release 5.9 (Tikanga) 32位

standby環境資訊
IP : 192.168.152.20
ORACLE_SID=OCM3
資料庫版本 10.2.0.1
作業系統 Red Hat Enterprise Linux Server release 5.9 (Tikanga) 32位

第一次切換:

在primary庫新增一個表空間
SYS@PROD>create tablespace part5 datafile '/u01/app/oracle/oradata/PROD/disk1/part501.dbf' size 20M;
Tablespace created.

SYS@PROD>alter system archive log current;
System altered.
主庫日誌:
Tue Mar 18 15:32:25 2014
Thread 1 advanced to log sequence 18
  Current log# 3 seq# 18 mem# 0: /u01/app/oracle/oradata/PROD/disk1/redo03.log
  Current log# 3 seq# 18 mem# 1: /u01/app/oracle/oradata/PROD/disk1/redo06.log
Tue Mar 18 15:32:29 2014
LNS: Standby redo logfile selected for thread 1 sequence 18 for destination LOG_ARCHIVE_DEST_2
Tue Mar 18 15:32:34 2014
ARCm: Standby redo logfile selected for thread 1 sequence 17 for destination LOG_ARCHIVE_DEST_2

standby database:
Tue Mar 18 15:32:34 2014
RFS[13]: Possible network disconnect with primary database
Redo Shipping Client Connected as PUBLIC
-- Connected User is Valid
RFS[15]: Assigned to RFS process 2498
RFS[15]: Identified database type as 'physical standby'
Primary database is in MAXIMUM PERFORMANCE mode
Primary database is in MAXIMUM PERFORMANCE mode
RFS[15]: Successfully opened standby log 5: '/u01/app/oracle/oradata/OCM3/disk1/standbylog5a.log'
Tue Mar 18 15:32:47 2014
Fetching gap sequence in thread 1, gap sequence 17-17
Tue Mar 18 15:32:48 2014
Redo Shipping Client Connected as PUBLIC
-- Connected User is Valid
RFS[16]: Assigned to RFS process 2502
RFS[16]: Identified database type as 'physical standby'
RFS[16]: Successfully opened standby log 4: '/u01/app/oracle/oradata/OCM3/disk1/standbylog4a.log'
Tue Mar 18 15:33:18 2014
Media Recovery Log /u01/app/oracle/archlog/1_17_836758036.arc
Tue Mar 18 15:33:37 2014
Media Recovery Waiting for thread 1 sequence 18 (in transit)

檢視主庫狀態
SYS@PROD>select database_role,switchover_status from v$database;

DATABASE_ROLE    SWITCHOVER_STATUS
---------------- --------------------
PRIMARY          TO STANDBY
檢視備庫狀態
SYS@OCM3>select database_role,switchover_status from v$database;

DATABASE_ROLE    SWITCHOVER_STATUS
---------------- --------------------
PHYSICAL STANDBY NOT ALLOWED

將主庫切換成備庫
SYS@PROD>alter database commit to switchover to physical standby with session shutdown;

SYS@PROD>select status,instance_name from v$instance;

STATUS       INSTANCE_NAME
------------ ----------------
STARTED      PROD
SYS@PROD>shutdown immediate
SYS@PROD>startup mount

SYS@PROD>select database_role,switchover_status from v$database;

DATABASE_ROLE    SWITCHOVER_STATUS
---------------- --------------------
PHYSICAL STANDBY TO PRIMARY

SYS@PROD>alter database recover managed standby database disconnect from session parallel 2;

將備庫切換為主庫
SYS@OCM3>select database_role,switchover_status from v$database;

DATABASE_ROLE    SWITCHOVER_STATUS
---------------- --------------------
PHYSICAL STANDBY TO PRIMARY

SYS@OCM3>
SYS@OCM3>alter database commit to switchover to primary with session shutdown ;
SYS@OCM3>alter database open;

SYS@OCM3>select database_role,switchover_status from v$database;

DATABASE_ROLE    SWITCHOVER_STATUS
---------------- --------------------
PRIMARY          TO STANDBY

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/11590946/viewspace-1124217/,如需轉載,請註明出處,否則將追究法律責任。

相關文章