相关的理论说明,参考如下Blog:
http://blog.csdn.net/tianlesoftware/article/details/5340788
How To Configure Server Side TransparentApplication Failover [ID 460982.1]
1.创建TAFService
[oracle@db1 bin]$ ./srvctl add service -d orcl -s server_taf -r "orcl1,orcl2" -P BASIC
--这里的orcl是database name,orcl1和orcl2 是instance name。
2.启动server_taf服务
[oracle@db1 bin]$ ./srvctl start service -d orcl -s server_taf
3.检查service运行情况
[oracle@db1 bin]$ ./srvctl config service -d orcl
Service name: server_taf
Service is enabled
Server pool: orcl_server_taf
Cardinality: 2
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Edition:
Preferred instances: orcl1,orcl2
Available instances:
4.确认serviceID
SQL> select name,service_id from dba_services where name = 'server_taf';
NAMESERVICE_ID
--------------------------------------------------------------------------
server_taf3
5.给service添加参数:
SQL>executedbms_service.modify_service(service_name=>'server_taf'-
,aq_ha_notifications=>true-
,failover_method=>dbms_service.failover_method_basic-
,failover_type=>dbms_service.failover_type_select-
,failover_retries=>180-
,failover_delay=>5-
,clb_goal=>dbms_service.clb_goal_long);
6. 确认参数修改:
colnameformata15
colfailover_methodformata11heading'METHOD'
colfailover_typeformata10heading'TYPE'
colfailover_retriesformat9999999heading'RETRIES'
colgoalformata10
colclb_goalformata8
colAQ_HA_NOTIFICATIONSformata5heading'AQNOT'
SQL> select name, failover_method,failover_type, failover_retries,goal, clb_goal,aq_ha_notifications from dba_services where service_id = 3;
NAME METHOD TYPE RETRIES GOAL CLB_GOAL AQNOT
--------------- ----------- ------------------ ---------- -------- -----
server_taf BASIC SELECT 180 NONE LONGYES
SQL>
7. 检查service注册情况:
[oracle@db1 bin]$ lsnrctl services
LSNRCTL for Linux: Version 11.2.0.3.0 -Production on 15-JUL-2012 13:26:43
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db1)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for thisservice...
Handler(s):
"DEDICATED" established:57 refused:0 state:ready
LOCAL SERVER
Service "orcl" has 1 instance(s).
Instance "orcl1", status READY, has 1 handler(s) for thisservice...
Handler(s):
"DEDICATED" established:11 refused:0 state:ready
LOCAL SERVER
Service "orclXDB" has 1instance(s).
Instance "orcl1", status READY, has 1 handler(s) for thisservice...
Handler(s):
"D000" established:0 refused:0 current:0 max:1022 state:ready
DISPATCHER <machine: db1, pid: 2167>
(ADDRESS=(PROTOCOL=tcp)(HOST=db1.tianlesoftware.com)(PORT=38731))
Service "server_taf" has 1instance(s).
Instance "orcl1", status READY, has 1 handler(s) for thisservice...
Handler(s):
"DEDICATED" established:11 refused:0 state:ready
LOCAL SERVER
The command completed successfully
8. 客户端就可以使用Service-SideTAF了:
在客户端TNS 配置:
orcl =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST= orcl.tianlesoftware.com)(PORT=1521))
(CONNECT_DATA=
(SERVER=DEDICATED)
(SERVICE_NAME=orcl)
)
)
-- orcl.tianlesoftware.com是SCAN IP地址。
9.查看进程状态
[oracle@db1 bin]$ ./crs_stat -t
Name Type Target StateHost
------------------------------------------------------------
ora.DATA.dg ora....up.type ONLINE ONLINEdb1
ora.FRA.dg ora....up.type ONLINE ONLINEdb1
ora....ER.lsnr ora....er.type ONLINE ONLINEdb1
ora....N1.lsnr ora....er.type ONLINE ONLINEdb2
ora....N2.lsnr ora....er.type ONLINE ONLINEdb1
ora....N3.lsnr ora....er.type ONLINE ONLINEdb1
ora.OCR.dg ora....up.type ONLINE ONLINEdb1
ora.asm ora.asm.type ONLINEONLINE db1
ora....SM1.asm application ONLINEONLINE db1
ora....01.lsnr application ONLINEONLINE db1
ora....-01.gsd application OFFLINEOFFLINE
ora....-01.ons application ONLINEONLINE db1
ora....-01.vip ora....t1.type ONLINE ONLINEdb1
ora....SM2.asm application ONLINEONLINE db2
ora....02.lsnr application ONLINEONLINE db2
ora....-02.gsd application OFFLINEOFFLINE
ora....-02.ons application ONLINEONLINE db2
ora....-02.vip ora....t1.type ONLINE ONLINEdb2
ora.cvu ora.cvu.type ONLINEONLINE db1
ora.gsd ora.gsd.type OFFLINEOFFLINE
ora....network ora....rk.type ONLINE ONLINEdb1
ora.oc4j ora.oc4j.type ONLINEONLINE db1
ora.ons ora.ons.type ONLINEONLINE db1
ora.orcl.db ora....se.type ONLINE ONLINEdb1
ora....taf.svc ora....ce.type ONLINE ONLINEdb1
ora.scan1.vip ora....ip.type ONLINE ONLINEdb2
ora.scan2.vip ora....ip.type ONLINE ONLINEdb1
ora.scan3.vip ora....ip.type ONLINE ONLINEdb1
-------------------------------------------------------------------------------------------------------
版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!
Skype: tianlesoftware
Email: [email protected]
Blog: http://www.tianlesoftware.com
Weibo: http://weibo.com/tianlesoftware
Twitter: http://twitter.com/tianlesoftware
Facebook: http://www.facebook.com/tianlesoftware
Linkedin: http://cn.linkedin.com/in/tianlesoftware
-------加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请----
DBA1 群:62697716(满); DBA2 群:62697977(满)DBA3 群:62697850(满)
DBA 超级群:63306533(满); DBA4 群:83829929 DBA5群: 142216823
DBA6 群:158654907 DBA7 群:172855474 DBA总群:104207940