189 8069 5689

Oracle11gR2RACService-SideTAF配置示例

Service-Side TAF
Service-Side TAF的配置参考:
How To Configure Server Side Transparent Application Failover [ID 460982.1]
Service-SideTAF 可以看作是TAF的一种变种,首先Service-SideTAF也是TAF,所有TAF的特点它都有,其次这种TAF是在服务器上配置的,而不像TAF是在客户端配置的。
Client-Side TAF 是在客户端修改tnsnames.ora 文件来配置的,如果有很多客户端使用这个数据库,那么每次微笑调整都需要把所有的计算机更改一遍,既低效又容易出错。而Service-Side TAF 通过结合Service,在数据库里保存FAIL_MODE的配置,把所有的TAF配置保存在数据字典中,从而省去了客户端的配置工作,现在客户端的TNS文件就不需要任何TAF的配置选项了。
从配置参数而言,Service-Side TAF和TAF 相比多了一个Instance Role(实例角色)的概念。 所谓的实例角色,就是当有多个Instance 参与一个Service时,可以配置优先使用哪一个Instance为用户提供服务。用户共有两种可选角色。
PREFERRED:首选实例,会优先选择拥有这个角色的实例提供服务。
AVAILABLE: 后备实例,用户连接会优先连接PREFFERRED的Instance,当PREFERRED的Instance不可用时,才会被转到AVAILBALE的Instance上。
要使用Server-Side TAF必须配置Service。 Service 可以在创建数据库时创建,也可以在创建数据库之后修改,既可以使用dbca 配置向导,也可以用命令行的方式配置。

让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:国际域名空间、虚拟主机、营销软件、网站建设、徐汇网站维护、网站推广。

服务端不需要配置更改客户端实现taf
方法1.客户端配置 (METHOD = basic)节约资源、浪费时间
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.171.4)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.171.5)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
(FAILOVER_MODE =
(TYPE = session)
(METHOD = basic)
(RETRIES = 180)
(DELAY = 5)
)
)
)

方法2.客户端配置 (METHOD = preconnect)节约时间、浪费资源
orcl1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.171.4)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
(FAILOVER_MODE =
(TYPE = select)
(METHOD = preconnect)
(BACKUP = orcl2)
)
)
)
orcl2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.171.5)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
(FAILOVER_MODE =
(TYPE = select)
(METHOD = preconnect)
(BACKUP = orcl1)
)
)
)

由于客户端要改太过麻烦,现在我们看下怎么不改客户端,直接配置服务端
1.用srvctl 命令配置Service
[oracle@rac1]$srvctl add service -d orcl -s taf -r "orcl1,orcl2" -P BASIC
--这里的orcl是database name,orcl1和orcl2 是instance name。

删除service
#srvctl remove service -d orcl -s taf

2.启动taf服务
[oracle@rac1]srvctl start service -d orcl -s taf

2.1数据库运行时自动运行service
srvctl enable service -d orcl -s taf

  1. 检查service运行情况
    [oracle@rac1]srvctl config service -d orcl
    4.5.给service添加参数:

SQL> execute dbms_service.modify_service (service_name => '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);

删除数据字典里的service信息
begin
dbms_service.delete_service(service_name=>'taf');
end;
/

5.确认修改的参数
col name format a15
col failover_method format a11 heading 'METHOD'
col failover_type format a10 heading 'TYPE'
col failover_retries format 9999999 heading 'RETRIES'
col goal format a10
col clb_goal format a8
col AQ_HA_NOTIFICATIONS format a5 heading 'AQNOT'

select name, failover_method,failover_type, failover_retries,goal,
clb_goal,aq_ha_notifications from dba_services where name = 'taf';
6.检查service注册情况:
[oracle@rac1 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 13-DEC-2018 14:18:37

Copyright (c) 1991, 2013, Oracle. All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER

Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 13-DEC-2018 09:09:32
Uptime 0 days 5 hr. 9 min. 5 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/rac1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.171.2)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.171.4)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
Instance "orcl1", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl1", status READY, has 1 handler(s) for this service...
Service "taf" has 1 instance(s).
Instance "orcl1", status READY, has 1 handler(s) for this service...
The command completed successfully
7.客户端就可以使用Service-SideTAF了:

在客户端TNS 配置:

orcl =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST= 172.16.171.6)(PORT=1521))
(CONNECT_DATA=

   (SERVER=DEDICATED)

(SERVICE_NAME=taf )

)
)
--172.16.171.6是scan ip的地址

测试。。。。。。。。。。


文章标题:Oracle11gR2RACService-SideTAF配置示例
URL标题:http://cdxtjz.com/article/psjdsd.html

其他资讯