一、 准备工作 因此套环境是通过 oracle grid control 平台配置 RAC primarySingle standby ,所以配置之前,首先配置好每个各自的环境,再进行下面的 RACdataguard 配置。 Oracle11g grid control 和单实例 Oracle11gR2 dataguard 配置见文章: Oracle Grid
一、准备工作
因此套环境是通过oracle grid control平台配置RAC primary+Single standby,所以配置之前,首先配置好每个各自的环境,再进行下面的RAC+dataguard配置。
Oracle11g grid control和单实例Oracle11gR2 dataguard配置见文章:
Oracle11gR2 RAC配置见文章:
二、环境说明
RAC primary和Single standby配置
2节点RAC和1个single instance组成的data guard环境。
Primary database是一个两节的RAC,存储都采用ASM的方式,具体如下
RAC Primary |
Inode1 |
Inode2 |
Public IP |
192.168.2.101 |
192.168.2.102 |
Private IP |
192.168.0.101 |
192.168.0.102 |
Virtual IP |
192.168.2.111 |
192.168.2.112 |
Instance |
Racdb1 |
racdb2 |
Rac-scan IP |
192.168.2.201 |
|
DB_NAME |
racdb |
|
Data,Controle file,Redo file |
ASM |
|
OS版本 |
Oracle Enterprise Linux 5.6 64bit |
|
oracle版本 |
Enterprise Edition Release 11.2.0.3.0 - 64bit |
Standby database的数据文件也采用ASM的方式存储
Single instance standby |
说明 |
OS版本 |
Oracle Enterprise Linux 5.6 64bit |
oracle版本 |
Enterprise Edition Release 11.2.0.3.0 - 64bit |
IP |
192.168.2.200 |
Oracle |
安装的非RAC版本 |
Instance |
racstd |
Data,Controle file,Redo file |
+data,+fra |
Grid control环境
Grid control host |
说明 |
OS版本 |
Oracle Enterprise Linux 5.6 64bit |
oracle版本 |
Enterprise Edition Release 11.2.0.3.0 - 64bit |
Grid control版本 |
Enterprise Manager Grid Control 11.1.0.1.0 |
IP |
192.168.2.100 |
Instance name |
gcdb |
Database name |
gcdb |
存储方式 |
文件系统 |
示例:race1 host文件内容如下:
[oracle@rac1 log]$ cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhosti6
# Public
192.168.2.101 rac1.localdomain rac1
192.168.2.102 rac2.localdomain rac2
# Private
192.168.0.101 rac1-priv.localdomain rac1-priv
192.168.0.102 rac2-priv.localdomain rac2-priv
# Virtual
192.168.2.111 rac1-vip.localdomain rac1-vip
192.168.2.112 rac2-vip.localdomain rac2-vip
# SCAN
192.168.2.201 rac-scan.localdomain rac-scan
192.168.2.200 single.localdomain single
192.168.2.100 gc.localdomain gc
三、安装步骤
Oracle grid control概览页面
安装步骤:
注:下面步骤和单实例上配置dataguard步骤基本相同
1.查看安装环境
2.点集群目标实例名称:racdb_racdb1
3.退回上一级目标页面:
“集群数据库:racdb”
4.点击Data Guard部分的“添加备用数据库”
进入下面页面
5.如下设置,继续到下一步
6.如下设置,继续到下一步
7.如下设置,继续到下一步
8.输入备库ASM口令,继续到下一步
9.如下设置,继续到下一步
10.如下设置,继续到下一步
11.复查,最后检查主备设置
11.点击完成后,进入处理页面,如下:
12.处理完成后进入下面创建页面,也可直接进入broker页面查看
13.点击“正在创建”,查看创建过程
14.创建成功后,进入dataguard broker管理页面查看dataguard状态:
四、Switchover切换
主库:
查看RAC当前连接实例:
SQL> SELECT INSTANCE_NUMBERFROM V$INSTANCE;
----------------
racdb2
查看RAC其它活动实例:
SQL> Select Instance_Name, Host_Name From Gv$instance
2 Where Inst_Id (Select Instance_Number From V$instance);
INSTANCE_NAME HOST_NAME
---------------- ----------------------------------------------------------------
racdb1 rac1.localdomain
备库:
SQL> select name,open_mode from v$database;
Name OPEN_MODE
----------- --------------------
Racstd READ ONLY WITH APPLY
1. 在dataguard broker管理页面进行switchover主备切换
点击dataguard部分
安装和管理
点击切换,进入确认页面
点击是,进入执行页面
此时可以查看各实例的日志,查看切换过程:
1. 首先可以看到racdb1实例关闭,只保留一个活动的实例进行switchover切换。
racdb1实例alter日志:
Mon Sep 03 08:25:27 2012
Shutting down instance (abort)
License high water mark = 14
USER (ospid: 17603): terminating the instance
Termination issued to instance processes. Waiting for the processes to exit
Instance terminated by USER, pid = 17603
Mon Sep 03 08:25:39 2012
Instance shutdown complete
2. 然后可以看到racdb2实例进行备库切换,再重新启动,修改各种参数,最后打开为只读应用状态。
racdb2实例alter日志:
Mon Sep 03 08:32:28 2012
ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN
ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY [Process Id: 30224] (racdb2)
Mon Sep 03 08:32:28 2012
Thread 2 cannot allocate new log, sequence 519
Checkpoint not complete
Current log# 3 seq# 518 mem# 0: +DATA/racdb/onlinelog/group_3.265.765380283
Current log# 3 seq# 518 mem# 1: +FRA/racdb/onlinelog/group_3.259.765380285
Mon Sep 03 08:32:28 2012
Stopping background process CJQ0
Mon Sep 03 08:32:37 2012
Archived Log entry 1133 added for thread 1 sequence 476 ID 0x2f1be9d9 dest 1:
ARC4: Standby redo logfile selected for thread 1 sequence 476 for destination LOG_ARCHIVE_DEST_2
Mon Sep 03 08:32:59 2012
Stopping background process MMNL
Stopping background process MMON
Mon Sep 03 08:33:09 2012
Starting background process MMON
Starting background process MMNL
Mon Sep 03 08:33:09 2012
MMON started with pid=24, OS id=28385
Mon Sep 03 08:33:10 2012
MMNL started with pid=25, OS id=28389
Stopping background process QMNC
All dispatchers and shared servers shutdown
CLOSE: killing server sessions.
Active process 16387 user 'oracle' program 'oracle@rac2.localdomain'
……
Active process 16452 user 'oracle' program 'oracle@rac2.localdomain'
minact-scn: Inst 2 is now the master inc#:8 mmon proc-id:28385 status:0x6
minact-scn status: grec-scn:0x0000.00000000 gmin-scn:0x0000.0165378f gcalc-scn:0x0000.016537a2
minact-scn: master continuing after IR
CLOSE: all sessions shutdown successfully.
Waiting for all non-current ORLs to be archived...
Waiting for the ORL for thread 1 sequence 477 to be archived...
Mon Sep 03 08:33:40 2012
idle dispatcher 'D000' terminated, pid = (33, 5)
Mon Sep 03 08:33:40 2012
ARC1: Archiving disabled thread 1 sequence 477
Archived Log entry 1135 added for thread 1 sequence 477 ID 0x2f1be9d9 dest 1:
Mon Sep 03 08:33:42 2012
ORL for thread 1 sequence 477 has been archived...
All non-current ORLs have been archived.
Waiting for all FAL entries to be archived...
All FAL entries have been archived.
Waiting for dest_id 2 to become synchronized...
Active, synchronized Physical Standby switchover target has been identified
Switchover End-Of-Redo Log thread 2 sequence 518 has been fixed
Switchover: Primary highest seen SCN set to 0x0.0x165d682
ARCH: Noswitch archival of thread 2, sequence 518
ARCH: End-Of-Redo Branch archival of thread 2 sequence 518
ARCH: LGWR is actively archiving destination LOG_ARCHIVE_DEST_2
ARCH: Standby redo logfile selected for thread 2 sequence 518 for destination LOG_ARCHIVE_DEST_2
Archived Log entry 1137 added for thread 2 sequence 518 ID 0x2f1be9d9 dest 1:
ARCH: Archiving is disabled due to current logfile archival
Primary will check for some target standby to have received alls redo
Final check for a synchronized target standby. Check will be made once.
LOG_ARCHIVE_DEST_2 is a potential Physical Standby switchover target
Active, synchronized target has been identified
Target has also received all redo
Backup controlfile written to trace file /u01/app/oracle/diag/rdbms/racdb/racdb2/trace/racdb2_rsm0_30224.trc
Clearing standby activation ID 790358489 (0x2f1be9d9)
The primary database controlfile was created using the
'MAXLOGFILES 192' clause.
There is space for up to 188 standby redo logfiles
Use the following SQL commands on the standby database to create
standby redo logfiles that match the primary database:
ALTER DATABASE ADD STANDBY LOGFILE 'srl1.f' SIZE 52428800;
ALTER DATABASE ADD STANDBY LOGFILE 'srl2.f' SIZE 52428800;
ALTER DATABASE ADD STANDBY LOGFILE 'srl3.f' SIZE 52428800;
ALTER DATABASE ADD STANDBY LOGFILE 'srl4.f' SIZE 52428800;
ALTER DATABASE ADD STANDBY LOGFILE 'srl5.f' SIZE 52428800;
Archivelog for thread 2 sequence 518 required for standby recovery
Switchover: Primary controlfile converted to standby controlfile succesfully.
Switchover: Complete - Database shutdown required
Completed: ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN
Mon Sep 03 08:34:04 2012
Process (ospid 29982) is suspended due to switchover to physical standby operation.
Mon Sep 03 08:34:04 2012
Shutting down instance (abort)
License high water mark = 21
USER (ospid: 28646): terminating the instance
Instance terminated by USER, pid = 28646
Mon Sep 03 08:34:16 2012
Instance shutdown complete
Mon Sep 03 08:34:30 2012
Starting ORACLE instance (normal)
Mon Sep 03 08:35:19 2012
LICENSE_MAX_SESSION = 0
LICENSE_SESSIONS_WARNING = 0
Private Interface 'eth1:1' configured from GPnP for use as a private interconnect.
[name='eth1:1', type=1, ip=169.254.93.205, mac=00-0c-29-19-8d-45, net=169.254.0.0/16, mask=255.255.0.0, use=haip:cluster_interconnect/62]
Public Interface 'eth0' configured from GPnP for use as a public interface.
[name='eth0', type=1, ip=192.168.2.102, mac=00-0c-29-19-8d-3b, net=192.168.2.0/24, mask=255.255.255.0, use=public/1]
Public Interface 'eth0:1' configured from GPnP for use as a public interface.
[name='eth0:1', type=1, ip=192.168.2.112, mac=00-0c-29-19-8d-3b, net=192.168.2.0/24, mask=255.255.255.0, use=public/1]
Public Interface 'eth0:2' configured from GPnP for use as a public interface.
[name='eth0:2', type=1, ip=192.168.2.201, mac=00-0c-29-19-8d-3b, net=192.168.2.0/24, mask=255.255.255.0, use=public/1]
Picked latch-free SCN scheme 3
Mon Sep 03 08:35:29 2012
Using LOG_ARCHIVE_DEST_1 parameter default value as USE_DB_RECOVERY_FILE_DEST
ARCH: Warning; less destinations available than specified
by LOG_ARCHIVE_MIN_SUCCEED_DEST init.ora parameter
Autotune of undo retention is turned on.
LICENSE_MAX_USERS = 0
SYS auditing is disabled
Starting up:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options.
ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1
System name: Linux
Node name: rac2.localdomain
Release: 2.6.32-100.26.2.el5
Version: #1 SMP Tue Jan 18 20:11:49 EST 2011
Machine: x86_64
VM name: VMWare Version: 6
Using parameter settings in server-side pfile /u01/app/oracle/product/11.2.0/db_1/dbs/initracdb2.ora
System parameters with non-default values:
processes = 150
spfile = "+DATA/racdb/spfileracdb.ora"
memory_target = 1184M
control_files = "+DATA/racdb/controlfile/current.260.765379719"
control_files = "+FRA/racdb/controlfile/current.256.765379719"
db_block_size = 8192
compatible = "11.2.0.0.0"
log_archive_dest_1 = ""
log_archive_dest_2 = "service="(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=single.localdomain)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=racstd)(SERVER=DEDICATED)))""
log_archive_dest_2 = "LGWR ASYNC NOAFFIRM delay=0 optional compression=disable max_failure=0 max_connections=1 reopen=300 db_unique_name="racstd" net_timeout=30"
log_archive_dest_2 = "valid_for=(all_logfiles,primary_role)"
log_archive_dest_3 = ""
log_archive_dest_state_2 = "ENABLE"
log_archive_dest_state_3 = "ENABLE"
log_archive_min_succeed_dest= 1
fal_server = "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=single.localdomain)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=racstd)(SERVER=DEDICATED)))"
log_archive_trace = 0
log_archive_config = "dg_config=(racdb,racstd)"
log_archive_format = "%t_%s_%r.dbf"
log_archive_max_processes= 5
archive_lag_target = 0
cluster_database = TRUE
db_create_file_dest = "+DATA"
db_recovery_file_dest = "+FRA"
db_recovery_file_dest_size= 15G
standby_file_management = "AUTO"
thread = 2
undo_tablespace = "UNDOTBS2"
instance_number = 2
remote_login_passwordfile= "EXCLUSIVE"
db_domain = ""
dispatchers = "(PROTOCOL=TCP) (SERVICE=racdbXDB)"
remote_listener = "rac-scan:1521"
audit_file_dest = "/u01/app/oracle/admin/racdb/adump"
audit_trail = "DB"
db_name = "racdb"
open_cursors = 300
dg_broker_start = TRUE
dg_broker_config_file1 = "+DATA/dr1racdb.dat"
dg_broker_config_file2 = "+DATA/dr2racdb.dat"
diagnostic_dest = "/u01/app/oracle"
Cluster communication is configured to use the following interface(s) for this instance
169.254.93.205
cluster interconnect IPC version:Oracle UDP/IP (generic)
IPC Vendor 1 proto 2
Mon Sep 03 08:35:36 2012
PMON started with pid=2, OS id=29579
--各种进程启动
.......
MMON started with pid=24, OS id=29677
Mon Sep 03 08:35:47 2012
MMNL started with pid=25, OS id=29683
Mon Sep 03 08:35:47 2012
starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...
NOTE: initiating MARK startup
starting up 1 shared server(s) ...
Starting background process MARK
Mon Sep 03 08:35:47 2012
MARK started with pid=27, OS id=29693
NOTE: MARK has subscribed
lmon registered with NM - instance number 2 (internal mem no 1)
Reconfiguration started (old inc 0, new inc 2)
List of instances:
2 (myinst: 2)
Global Resource Directory frozen
* allocate domain 0, invalid = TRUE
Communication channels reestablished
Master broadcasted resource hash value bitmaps
Non-local Process blocks cleaned out
LMS 0: 0 GCS shadows cancelled, 0 closed, 0 Xw survived
Set master node info
Submitted all remote-enqueue requests
Dwn-cvts replayed, VALBLKs dubious
All grantable enqueues granted
Post SMON to start 1st pass IR
Submitted all GCS remote-cache requests
Post SMON to start 1st pass IR
Fix write in gcs resources
Reconfiguration complete
Mon Sep 03 08:35:51 2012
LCK0 started with pid=31, OS id=29713
Starting background process RSMN
Mon Sep 03 08:35:53 2012
RSMN started with pid=32, OS id=29721
ORACLE_BASE from environment = /u01/app/oracle
Mon Sep 03 08:35:55 2012
DMON started with pid=30, OS id=29727
Mon Sep 03 08:35:56 2012
ALTER DATABASE MOUNT
This instance was first to mount
Mon Sep 03 08:36:00 2012
NOTE: Loaded library: System
Mon Sep 03 08:36:00 2012
SUCCESS: diskgroup DATA was mounted
Mon Sep 03 08:36:00 2012
ALTER SYSTEM SET local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.2.112)(PORT=1521))))' SCOPE=MEMORY SID='racdb2';
SUCCESS: diskgroup FRA was mounted
Mon Sep 03 08:36:03 2012
NOTE: dependency between database racdb and diskgroup resource ora.DATA.dg is established
NOTE: dependency between database racdb and diskgroup resource ora.FRA.dg is established
Mon Sep 03 08:36:09 2012
ARCH: STARTING ARCH PROCESSES
Mon Sep 03 08:36:09 2012
ARC0 started with pid=35, OS id=29791
ARC0: Archival started
ARC0: Becoming the 'no FAL' ARCH
ARC0: Becoming the 'no SRL' ARCH
ARC0: Thread not mounted
ARCH: STARTING ARCH PROCESSES COMPLETE
Mon Sep 03 08:36:11 2012
Successful mount of redo thread 2, with mount id 790629740
Physical Standby Database mounted.
Lost write protection disabled
Completed: ALTER DATABASE MOUNT
Mon Sep 03 08:36:15 2012
ALTER DATABASE OPEN
Data Guard Broker initializing...
Data Guard Broker initialization complete
Mon Sep 03 08:36:18 2012
Starting Data Guard Broker (DMON)
AUDIT_TRAIL initialization parameter is changed to OS, as DB is NOT compatible for database opened with read-only access
This instance was first to open
Mon Sep 03 08:36:19 2012
INSV started with pid=39, OS id=29836
Beginning standby crash recovery.
Serial Media Recovery started
Mon Sep 03 08:36:22 2012
Managed Standby Recovery starting Real Time Apply
Mon Sep 03 08:36:25 2012
NSV1 started with pid=36, OS id=29852
Mon Sep 03 08:36:26 2012
Media Recovery Log +FRA/racdb/archivelog/2012_09_03/thread_1_seq_476.286.793009945
Media Recovery Log +FRA/racdb/archivelog/2012_09_03/thread_2_seq_516.304.792986419
Media Recovery Log +FRA/racdb/archivelog/2012_09_03/thread_2_seq_517.303.793009875
Mon Sep 03 08:37:10 2012
RSM0 started with pid=42, OS id=30038
Mon Sep 03 08:37:11 2012
Media Recovery Log +FRA/racdb/archivelog/2012_09_03/thread_2_seq_518.279.793010027
Identified End-Of-Redo (switchover) for thread 2 sequence 518 at SCN 0x0.165d682
Media Recovery Log +FRA/racdb/archivelog/2012_09_03/thread_1_seq_477.322.793010021
Using STANDBY_ARCHIVE_DEST parameter default value as USE_DB_RECOVERY_FILE_DEST
Mon Sep 03 08:37:15 2012
ARC0: STARTING ARCH PROCESSES
ALTER SYSTEM SET log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST','valid_for=(ALL_LOGFILES, ALL_ROLES)' SCOPE=BOTH;
ALTER SYSTEM SET log_archive_trace=0 SCOPE=BOTH SID='racdb2';
ALTER SYSTEM SET log_archive_format='%t_%s_%r.dbf' SCOPE=SPFILE SID='racdb2';
ALTER SYSTEM SET standby_file_management='AUTO' SCOPE=BOTH SID='*';
ALTER SYSTEM SET archive_lag_target=0 SCOPE=BOTH SID='*';
ALTER SYSTEM SET log_archive_max_processes=5 SCOPE=BOTH SID='*';
Mon Sep 03 08:37:16 2012
ARC1 started with pid=43, OS id=30069
ALTER SYSTEM SET log_archive_min_succeed_dest=1 SCOPE=BOTH SID='*';
ALTER SYSTEM SET fal_server='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=single.localdomain)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=racstd)(SERVER=DEDICATED)))' SCOPE=BOTH;
Data Guard: Redo Apply Services will be started after instance open completes
Resetting standby activation ID 0 (0x0)
Incomplete Recovery applied until change 23451266 time 09/03/2012 08:33:45
Completed standby crash recovery.
Mon Sep 03 08:37:18 2012
ARC2 started with pid=44, OS id=30077
Picked Lamport scheme to generate SCNs
Mon Sep 03 08:37:18 2012
SMON: enabling cache recovery
ARC1: Becoming the heartbeat ARCH
ARC1: Becoming the active heartbeat ARCH
ARC1: Becoming the active heartbeat ARCH
Mon Sep 03 08:37:20 2012
ARC3 started with pid=45, OS id=30085
ARC2: Becoming the heartbeat ARCH
ARC1: Archival started
Mon Sep 03 08:37:23 2012
ARC4 started with pid=46, OS id=30105
ARC2: Archival started
ARC3: Archival started
Mon Sep 03 08:37:24 2012
Primary database is in MAXIMUM PERFORMANCE mode
ARC4: Archival started
ARC0: STARTING ARCH PROCESSES COMPLETE
RFS[1]: Assigned to RFS process 30092
RFS[1]: Selected log 5 for thread 1 sequence 482 dbid 762996486 branch 765379723
Mon Sep 03 08:37:28 2012
Dictionary check beginning
Mon Sep 03 08:37:29 2012
RFS[2]: Assigned to RFS process 30123
RFS[2]: Selected log 6 for thread 1 sequence 481 dbid 762996486 branch 765379723
Dictionary check complete
Database Characterset is ZHS16GBK
No Resource Manager plan active
Mon Sep 03 08:37:32 2012
RFS[3]: Assigned to RFS process 30126
RFS[3]: Opened log for thread 2 sequence 519 dbid 762996486 branch 765379723
RFS[2]: Opened log for thread 1 sequence 478 dbid 762996486 branch 765379723
Archived Log entry 1139 added for thread 1 sequence 478 rlc 765379723 ID 0x2f1bc82c dest 2:
RFS[2]: Opened log for thread 2 sequence 520 dbid 762996486 branch 765379723
Mon Sep 03 08:37:33 2012
Archived Log entry 1140 added for thread 1 sequence 481 ID 0x2f1bc82c dest 1:
Archived Log entry 1141 added for thread 2 sequence 519 rlc 765379723 ID 0x0 dest 2:
Archived Log entry 1142 added for thread 2 sequence 520 rlc 765379723 ID 0x0 dest 2:
RFS[3]: Opened log for thread 2 sequence 521 dbid 762996486 branch 765379723
Archived Log entry 1143 added for thread 2 sequence 521 rlc 765379723 ID 0x0 dest 2:
RFS[2]: Opened log for thread 1 sequence 479 dbid 762996486 branch 765379723
Archived Log entry 1144 added for thread 1 sequence 479 rlc 765379723 ID 0x2f1bc82c dest 2:
RFS[3]: Opened log for thread 1 sequence 480 dbid 762996486 branch 765379723
Archived Log entry 1145 added for thread 1 sequence 480 rlc 765379723 ID 0x2f1bc82c dest 2:
Starting background process GTX0
Mon Sep 03 08:37:37 2012
GTX0 started with pid=50, OS id=30160
replication_dependency_tracking turned off (no async multimaster replication found)
Mon Sep 03 08:37:41 2012
Physical standby database opened for read only access.
Completed: ALTER DATABASE OPEN
Mon Sep 03 08:38:06 2012
Data Guard: Database open completed; restarting redo-apply ...
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE THROUGH ALL SWITCHOVER DISCONNECT USING CURRENT LOGFILE
Attempt to start background Managed Standby Recovery process (racdb2)
Mon Sep 03 08:38:07 2012
MRP0 started with pid=54, OS id=30220
MRP0: Background Managed Standby Recovery process started (racdb2)
started logmerger process
Mon Sep 03 08:38:15 2012
Managed Standby Recovery starting Real Time Apply
Parallel Media Recovery started with 2 slaves
Waiting for all non-current ORLs to be archived...
All non-current ORLs have been archived.
Clearing online redo logfile 1 +DATA/racdb/onlinelog/group_1.261.765379725
Mon Sep 03 08:38:18 2012
Completed: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE THROUGH ALL SWITCHOVER DISCONNECT USING CURRENT LOGFILE
Mon Sep 03 08:38:18 2012
Clearing online log 1 of thread 1 sequence number 482
Mon Sep 03 08:38:20 2012
Clearing online redo logfile 1 complete
Clearing online redo logfile 2 +DATA/racdb/onlinelog/group_2.262.765379727
Clearing online log 2 of thread 1 sequence number 481
Clearing online redo logfile 2 complete
Clearing online redo logfile 3 +DATA/racdb/onlinelog/group_3.265.765380283
Clearing online log 3 of thread 2 sequence number 518
Mon Sep 03 08:38:29 2012
Clearing online redo logfile 3 complete
Clearing online redo logfile 4 +DATA/racdb/onlinelog/group_4.266.765380287
Clearing online log 4 of thread 2 sequence number 517
Clearing online redo logfile 4 complete
Mon Sep 03 08:38:31 2012
Media Recovery Log +FRA/racdb/archivelog/2012_09_03/thread_2_seq_519.301.793010251
Media Recovery Log +FRA/racdb/archivelog/2012_09_03/thread_2_seq_520.296.793010253
Media Recovery Log +FRA/racdb/archivelog/2012_09_03/thread_1_seq_478.318.793010253
Media Recovery Log +FRA/racdb/archivelog/2012_09_03/thread_2_seq_521.324.793010255
Media Recovery Log +FRA/racdb/archivelog/2012_09_03/thread_1_seq_479.297.793010255
Media Recovery Log +FRA/racdb/archivelog/2012_09_03/thread_1_seq_480.310.793010255
Media Recovery Log +FRA/racdb/archivelog/2012_09_03/thread_1_seq_481.302.793010253
Mon Sep 03 08:38:41 2012
Media Recovery Waiting for thread 1 sequence 482 (in transit)
Recovery of Online Redo Log: Thread 1 Group 5 Seq 482 Reading mem 0
Mem# 0: +DATA/racdb/onlinelog/group_5.269.791953157
Mem# 1: +FRA/racdb/onlinelog/group_5.287.791953159
3. racstd备库switchover切换成主库。
Racstd库alter日志
Mon Sep 03 09:09:27 2012
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL
MRP0: Background Media Recovery cancelled with status 16037
Errors in file /u01/app/oracle/diag/rdbms/racstd/racstd/trace/racstd_pr00_1049.trc:
ORA-16037: user requested cancel of managed recovery operation
Managed Standby Recovery not using Real Time Apply
Recovery interrupted!
Mon Sep 03 09:09:27 2012
MRP0: Background Media Recovery process shutdown (racstd)
Managed Standby Recovery Canceled (racstd)
Completed: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL
Forcing database into limbo
ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY WAIT WITH SESSION SHUTDOWN
ALTER DATABASE SWITCHOVER TO PRIMARY (racstd)
Maximum wait for role transition is 15 minutes.
krsv_proc_kill: Killing 3 processes (all RFS)
CLOSE: killing server sessions.
Active process 22285 user 'oracle' program 'oracle@single.localdomain'
Active process 22285 user 'oracle' program 'oracle@single.localdomain
4. 然后实例racdb1启动到mount状态,修改各种参数,也成为备用实例。
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
racdb1 MOUNTED
--打开实例
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
racdb1 OPEN
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ ONLY WITH APPLY
5. 最后再检查各数据库状态
--rac数据库状态
[oracle@rac1 dbs]$ sqlplus "/as sysdba"
SQL> select name,open_mode,DATABASE_ROLE,PROTECTION_MODE from v$database;
NAME OPEN_MODE DATABASE_ROLE PROTECTION_MODE
--------- -------------------- ---------------- --------------------
RACDB READ ONLY WITH APPLY PHYSICAL STANDBY MAXIMUM PERFORMANCE
--single数据库状态
[oracle@single~]$ sqlplus "/as sysdba"
SQL> select name,open_mode,DATABASE_ROLE,PROTECTION_MODE from v$database;
NAME OPEN_MODE DATABASE_ROLE PROTECTION_MODE
--------- -------------------- ---------------- --------------------
RACDB READ WRITE PRIMARY MAXIMUM PERFORMANCE
6 switchover操作后的页面
这样,切换后的角色为:
主库:racstd(host:single)
备库:racdb(实例名racdb1,racdb2;hosts:rac1,rac2)
7. 再尝试switchover切回原来主备角色
--此时不需要停止集群备库的任何实例,然后就可以直接进行switchover切换
--同样点“切换”按钮,登录后服务器后进入执行切换页面
即同样的方法,点击“切换”后一键完成主库切换。
总结:
使用grid control页面的datagurd broker管理进行主备切换,只需要点击“切换”按钮即可完成rac+datagurd的所有主备切换操作,无需再去手关闭rac实例到只有一个活动实例才能完成切换操作,所以操作都会后台自动完成,方便快捷。