欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Oracle RAC failover 测试(TFA方式)

程序员文章站 2024-04-05 20:17:36
...

Oracle RAC 客户端故障转移(failover),当采用TFA方式时,对于已经建立连接的客户端,在连接的实例或节点出现故障时,客户端无需

Oracle RAC 客户端故障转移(failover),当采用TFA方式时,对于已经建立连接的客户端,在连接的实例或节点出现故障时,客户端无需再次发出连接请求,仍然可以继续之前的数据库操作,此称之为透明故障转移。本文描述基于Oracle 10g rac,客户端TFA方式的故障转移并给出示例。

下面是一些关于这方面的基础参考链接:

有关负监听配置,载均衡(load balance)请参考

ORACLE RAC 下非缺省端口监听配置(listener.ora tnsnames.ora)

Oracle RAC 客户端连接负载均衡(Load Balance)

Oracle RAC 服务器端连接负载均衡(Load Balance)

Oracle RAC 负载均衡测试(结合服务器端与客户端)

1、TFA描述
#下面关于TFA来自Oracle 的官方描述 ID 453293.1
Transparent Application Failover (TAF) is a feature of the Oracle Call Interface (OCI) driver at client side.
It enables the application to automatically reconnect to a database, if the database instance to which the connection is
made fails. In this case, the active transactions roll back.
Tnsnames Parameter: FAILOVER_MODE

When an instance to which a connection is established fails or is shutdown, the connection on the client side becomes
stale and would throw exceptions to the caller trying to use it. TAF enables the application to transparently reconnect
to a preconfigured secondary instance creating a fresh connection, but identical to the connection that was established
on the first original instance.

#简单一点来说,就是说对于那些已经成功连接到特定实例的客户端,如果该实例或节点异常宕机,客户端会自动重新发出到剩余实例的连
#接请求。使得客户端感觉不到它所连接的实例或节点已经出现故障,这个就称之为透明转移。但其间的活动事务将被回滚。
#通过在客户端的tnsnames.ora中配置FAILOVER_MODE项实现TFA

2、服务器端、客户端的环境
#服务器端环境,host信息
oracle@bo2dbp:~> cat /etc/hosts |grep vip
192.168.7.61 bo2dbp-vip.2gotrade.com bo2dbp-vip
192.168.7.62 bo2dbs-vip.2gotrade.com bo2dbs-vip

#服务器端环境,集群信息
oracle@bo2dbp:~> ./crs_stat.sh
Resource name Target State
-------------- ------ -----
ora.GOBO4.GOBO4A.inst OFFLINE OFFLINE on bo2dbp #此时节点1上的实例被关闭
ora.GOBO4.GOBO4B.inst ONLINE ONLINE on bo2dbs
ora.GOBO4.db ONLINE ONLINE on bo2dbp
ora.bo2dbp.ASM1.asm ONLINE ONLINE on bo2dbp
ora.bo2dbp.LISTENER_BO2DBP.lsnr ONLINE ONLINE on bo2dbp
ora.bo2dbp.LISTENER_ORA10G_BO2DBP.lsnr ONLINE ONLINE on bo2dbp
ora.bo2dbp.gsd ONLINE ONLINE on bo2dbp
ora.bo2dbp.ons ONLINE ONLINE on bo2dbp
ora.bo2dbp.vip ONLINE ONLINE on bo2dbp
ora.bo2dbs.ASM2.asm ONLINE ONLINE on bo2dbs
ora.bo2dbs.LISTENER_BO2DBS.lsnr ONLINE ONLINE on bo2dbs
ora.bo2dbs.LISTENER_ORA10G_BO2DBS.lsnr ONLINE ONLINE on bo2dbs
ora.bo2dbs.gsd ONLINE ONLINE on bo2dbs
ora.bo2dbs.ons ONLINE ONLINE on bo2dbs
ora.bo2dbs.vip ONLINE ONLINE on bo2dbs
ora.ora10g.db ONLINE ONLINE on bo2dbp