oracle 10g taf分享

介绍:

没有配置TAF的情况下,客户端连接数据库,一个节点宕机,客户端需要重新连接,才能正常连接。
通过TAF去连接数据库时,当一个节点宕机时,无需重连,会自动切换到另外一个节点,但是前提条件是没有未提交的事务,若有未提交的事务,则会报错ORA-25405: transaction status unknown,重新连接即可。

三种方法:Client-Side Connect time Failover、Client-Side TAF、Service-Side TAF

Service-Side TAF配置

创建taf服务
srvctl add service -d test -s taf -r “test1,test2” -P BASIC
-s 服务名
-r 需要创建服务的节点的instance_name
-P taf的状态,BASIC为基础状态
-d unique name

开启taf服务
srvctl start service -d test -s taf

服务ora.TEST.taf.TEST1.srv
oracle 10g taf分享_第1张图片
oracle 10g taf分享_第2张图片
oracle 10g taf分享_第3张图片

查看状态
srvctl status service -d TEST -s taf
在这里插入图片描述

查看taf服务的service_id
SQL> select name,service_id from dba_services where name=‘taf’;

NAME SERVICE_ID


taf 7

查看taf服务的信息
SQL> select name, failover_method, failover_type, failover_retries,goal, clb_goal,aq_ha_notifications from dba_services where service_id = 7;

NAME METHOD TYPE RETRIES GOAL CLB_GOAL AQNOT


taf LONG NO

修改参数taf服务的参数
begin
dbms_service.modify_service(service_name => ‘taf’,
goal => DBMS_SERVICE.goal_throughput,
aq_ha_notifications => TRUE,
failover_method => DBMS_SERVICE.failover_method_basic,
failover_type => DBMS_SERVICE.failover_type_select,
failover_retries => 10,
failover_delay => 1,
clb_goal => DBMS_SERVICE.clb_goal_long);
end;
/

检查配置情况

再次查看taf服务参数
SQL> select name, failover_method, failover_type, failover_retries,goal, clb_goal,aq_ha_notifications from dba_services where service_id = 7;

NAME METHOD TYPE RETRIES GOAL CLB_GOAL AQNOT


taf BASIC SELECT 10 THROUGHPUT LONG YES

method:basic/none
type:select/session/none
failover_retries为failover重试次数
goal: throughput(数据吞吐量)/ service_time(服务时间)/ none
clb_goal: long(会将服务均分给每个rac instance)
oracle 10g taf分享_第4张图片

修改tnsname
vi tnsnames.ora
TAF =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.yang.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip.yang.com)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = taf)
)
)

你可能感兴趣的:(oracle,oracle,数据库)