由于一心想着使用DGbroker做一次完整的failover切换,所以我得首先配置一个DGbroker工具,这里网络的配置过程
就省略了,因为在之前的配置中也详细的有写到。一下主要是配置broker工具的后续工作,并使用该工作简单地做了一个
switchover主备库之间的角色切换。真心感觉到,使用broker来作switchover切换比在sqlplus中作切换简单多了,简化了
很多的操作步骤,切换迅速。
--使用DGbroker管理DG演练:
--登录broker工具并以sys用户登录:
[oracle@host01 ~]$ export ORACLE_SID=SBDB
[oracle@host01 ~]$ dgmgrl
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/oracle
Connected.
DGMGRL>
--创建configuration配置文件:
DGMGRL> CREATE CONFIGURATION 'SBDB' as PRIMARY DATABASE IS 'SBDB' CONNECT IDENTIFIER IS SBDB;
Configuration "SBDB" created with primary database "SBDB"
DGMGRL> SHOW CONFIGURATION
Configuration - SBDB
Protection Mode: MaxPerformance
Databases:
SBDB - Primary database
Fast-Start Failover: DISABLED
Configuration Status:
DISABLED
--添加备库的角色:
DGMGRL> ADD DATABASE 'ORA11GR2' AS CONNECT IDENTIFIER IS ORA11GR2;
Database "ORA11GR2" added
DGMGRL>
--启用CONFIGURATION配置文件:
DGMGRL> ENABLE CONFIGURATION;
Enabled.
DGMGRL> SHOW CONFIGURATION;
Configuration - SBDB
Protection Mode: MaxPerformance
Databases:
SBDB - Primary database
ORA11GR2 - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
--启用备库:
DGMGRL> ENABLE DATABASE 'ORA11GR2';
Enabled.
DGMGRL>
--查看备库的状态:
DGMGRL> SHOW DATABASE 'ORA11GR2';
Database - ORA11GR2
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds (computed 1 second ago)
Apply Lag: 0 seconds (computed 1 second ago)
Apply Rate: 769.00 KByte/s
Real Time Query: ON
Instance(s):
ORA11GR2
Database Status:
SUCCESS
#当然类似地查看主库的状态,还可以使用 SHOW DATABASE VERBOSE 'ORA11GR2'查看更详细的信息。
----使用DGbroker切换主备库之间的角色:
DGMGRL> switchover to 'ORA11GR2'; #这里特别强调:to备库名,有些版本不需加单引号括起,有些版本需要括起。
Performing switchover NOW, please wait...
Operation requires a connection to instance "ORA11GR2" on database "ORA11GR2"
Connecting to instance "ORA11GR2"...
Connected.
New primary database "ORA11GR2" is opening...
Operation requires startup of instance "SBDB" on database "SBDB"
Starting instance "SBDB"...
Unable to connect to database
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
Failed.
Warning: You are no longer connected to ORACLE.
Please complete the following steps to finish switchover:
start up instance "SBDB" of database "SBDB"
#这一次的切换跟我上一次的切换有所不一样,上一次直切就可以切换过去了。但是没有关系,没有影响正常的切换,
跟着报出来的提示,去重新启动提示到的实例就可以完成切换了。
#切换成功。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31392094/viewspace-2135703/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/31392094/viewspace-2135703/