学无止境
分类: Oracle
2013-12-09 17:00:33
配置服务的首选实例,和有效实例,通常情况客户端先连接改服务时,先连接首选实例,当首选实例无法连接时,连接有效实例。
可以使用DBCA配置,也可以使用srvctl配置,建议使用DBCA,比较简洁。
选择数据库
增加一个服务名
配置该服务在哪个实例上是首选,哪个实例是有效的。下面的TAF策略,可以选择基本的,或者预连接。
配置之后可以在CRS中查看到增加了服务
[root@rac1 ~]# /oracle/crs/bin/crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.....TAF.cs application ONLINE ONLINE rac1
ora....cl1.srv application ONLINE ONLINE rac1
ora.orcl.db application ONLINE ONLINE rac1
ora....l1.inst application ONLINE ONLINE rac1
ora....l2.inst application ONLINE ONLINE rac2
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
在数据库中,也可以查看到增加了服务名。
SQL> show parameter service
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string orcl, TAF
在监听中也可以看到有2个服务,该服务在实例1上是首选的,在实例2上有一个该服务的预连接服务。
Service "TAF" has 1 instance(s).
Instance "orcl1", status READY, has 2 handler(s) for this service...
Service "TAF_PRECONNECT" has 1 instance(s).
Instance "orcl2", status READY, has 1 handler(s) for this service...
Service "orcl" has 2 instance(s).
Instance "orcl1", status READY, has 2 handler(s) for this service...
Instance "orcl2", status READY, has 1 handler(s) for this service...