本文主要是介绍osqa java_ORACLE RAC TAF 配置(透明故障转移),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
--ORACLE RAC TAF 配置(透明故障转移)
TAF(Transparent Application Failover)即透明应用程序故障转移技术。当初始化连接出现问题无法连接时,该功能可以保证应用程序重新连接到可用服务。在重新连接过程中,之前的活动事务将会被回滚,但在“具体条件”下TAF可以保证SELECT语句不被终止。这也是RAC亮点之一。
所谓的“具体条件”指的就是FAILOVER_MODE中METHOD选择“BASIC”、TYPE选择“SELECT”
TAF的特性:
1:TAF是ORACLE客户端提供的一项特性,使用TAF,对客户端的环境有一定的要求,比如JAVA的JDBC驱动、Oracle客户端的版本等(8i开始支持TAF);
2:大致上TAF可以分为2种,连接时的TAF和会话建立后TAF;
3:TAF本身与是否RAC环境无关,但一般都用在RAC环境,最小程度的减少最应用的影响,单实例环境下也可以使用TAF,这样使用PL/SQL developer连接数据库,即使数据库实例重启,也不需要重新连接;
4:RAC环境下,还可以把TAF配置在服务器端;
5:配置listener.ora文件的GLOBAL_DBNAME参数后将会禁用TAF
查看当前service
col name format a24
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'
selectname,failover_method,failover_type,failover_retries,goal,clb_goal,aq_ha_notificationsfromdba_services;
1. 客户端TAF配置
vi tnsnames.ora
NODE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac-scan.yang.com)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = rac.yang.com)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5))
)
)
SELECTMACHINE,FAILOVER_TYPE,FAILOVER_METHOD,FAILED_OVERFROMV$SESSIONWHERESID=141;
MACHINE TYPE METHOD FAI
-------------------- ---------- ----------- ---
tay SELECTBASICNO
2. 服务器端TAF配置
2.1添加taf服务
srvctl add service -d cnposqa -s cnposqa_taf -r "cnposqa1,cnposqa2" -P BASIC
-e Failover type (NONE, SESSION, or SELECT)
-m Failover method (NONE or BASIC)
srvctl add service -d cnposqa -s cnposqa_taftt -r "cnposqa1,cnposqa2" -e select -m basic -P BASIC
2.2启动服务
srvctl start service -d cnposqa -s cnposqa_taf
2.3检查服务情况
>srvctl config service -d cnposqa -s cnposqa_taf
Service name: cnposqa_taf
Service is enabled
Server pool: cnposqa_cnposqa_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: cnposqa1,cnposqa2
Available instances:
2.3 给service添加参数(basic,select):
execute dbms_service.modify_service (service_name => 'cnposqa_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);
++单边服务添加
--cnposqa_taf2单边服务,主节点cnposqa2, 副节点cnposqa1 (-r Preferred , -a Available )
srvctl add service -d cnposqa -s cnposqa_taf2 -r "cnposqa2" -a "cnposqa1" -P BASIC
config service -d cnposqa -s cnposqa_taf2
Service name: cnposqa_taf2
Service is enabled
Server pool: cnposqa_cnposqa_taf2
Cardinality: 1
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: cnposqa2
Available instances: cnposqa1
切换测试
--停服务
stop service -d cnposqa -s cnposqa_taf2
--服务启动到instance 1
start service -d cnposqa -s cnposqa_taf2 -i cnposqa1
这篇关于osqa java_ORACLE RAC TAF 配置(透明故障转移)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!