12
返回列表 发新帖
楼主: ylw6006

11g rac连接问题!

[复制链接]
论坛徽章:
5
ITPUB十周年纪念徽章
日期:2011-11-01 16:24:512012新春纪念徽章
日期:2012-01-04 11:55:05双黄蛋
日期:2012-01-11 11:00:012012新春纪念徽章
日期:2012-02-24 10:48:45茶鸡蛋
日期:2012-04-16 10:22:07
11#
 楼主| 发表于 2012-2-7 15:01 | 只看该作者
guisq11 发表于 2012-2-7 14:48
TAF有Client-side TAF和Server-side TAF
Client-side需要配置tnsname.ora,与10g的区别就是HOST只需要写上s ...

client的taf我已经搞定了,服务器端的配置则没有成功!
详情请看:http://ylw6006.blog.51cto.com/470441/769244

使用道具 举报

回复
论坛徽章:
2
2010新春纪念徽章
日期:2010-03-01 11:21:012011新春纪念徽章
日期:2011-02-18 11:43:33
12#
发表于 2012-2-9 17:07 | 只看该作者
TAF有一些限制的,比如说,JDBC:thin不能用,如果要实现select不中断,上面10楼兄弟给的样例是不够的,type至少要select级别

使用道具 举报

回复
论坛徽章:
5
ITPUB十周年纪念徽章
日期:2011-11-01 16:24:512012新春纪念徽章
日期:2012-01-04 11:55:05双黄蛋
日期:2012-01-11 11:00:012012新春纪念徽章
日期:2012-02-24 10:48:45茶鸡蛋
日期:2012-04-16 10:22:07
13#
 楼主| 发表于 2012-2-10 08:58 | 只看该作者
ccshu 发表于 2012-2-9 17:07
TAF有一些限制的,比如说,JDBC:thin不能用,如果要实现select不中断,上面10楼兄弟给的样例是不够的,typ ...

恩,是这样的!client side的taf,10g rac和11g rac环境下我都测试成功了,但是server side配置总是不成功!http://www.itpub.net/thread-1568414-1-1.html

使用道具 举报

回复
论坛徽章:
2
2010新春纪念徽章
日期:2010-03-01 11:21:012011新春纪念徽章
日期:2011-02-18 11:43:33
14#
发表于 2012-2-10 10:46 | 只看该作者
ylw6006 发表于 2012-2-10 08:58
恩,是这样的!client side的taf,10g rac和11g rac环境下我都测试成功了,但是server side配置总是不成功 ...

服务器端的是比较难配,你的remote_listener参数设置了吗?

另外,11g开始,需要通过srvctl命令来设置TAF

使用道具 举报

回复
论坛徽章:
5
ITPUB十周年纪念徽章
日期:2011-11-01 16:24:512012新春纪念徽章
日期:2012-01-04 11:55:05双黄蛋
日期:2012-01-11 11:00:012012新春纪念徽章
日期:2012-02-24 10:48:45茶鸡蛋
日期:2012-04-16 10:22:07
15#
 楼主| 发表于 2012-2-10 10:53 | 只看该作者
ccshu 发表于 2012-2-10 10:46
服务器端的是比较难配,你的remote_listener参数设置了吗?

另外,11g开始,需要通过srvctl命令来设置 ...

请问有没有文档?如果有的话,麻烦提供一份给我参考下,中英文的都没有关系!谢谢!

使用道具 举报

回复
论坛徽章:
2
2010新春纪念徽章
日期:2010-03-01 11:21:012011新春纪念徽章
日期:2011-02-18 11:43:33
16#
发表于 2012-2-10 11:21 | 只看该作者
ylw6006 发表于 2012-2-10 10:53
请问有没有文档?如果有的话,麻烦提供一份给我参考下,中英文的都没有关系!谢谢!

10g & 11g :Configuration of TAF(Transparent Application Failover) and Load Balancing [ID 453293.1]
          Modified 27-SEP-2011     Type HOWTO     Status PUBLISHED          

In this Document
  Goal
  Solution
      CONCEPTS
     CONFIGURATION
     Client Side Load Balancing
     Connect Time Failover
     Client Side Load Balance & Connect-time Failover Connect String
     TAF - Client Side Configuration
     TAF - Server Side Configuration
     Troubleshooting TAF
  References

Applies to:
Oracle Net Services - Version: 10.1.0.2.0 to 11.2.0.2 - Release: 10.1 to 11.2
Oracle Net Services - Version: 10.1.0.2.0 to 11.2.0.2   [Release: 10.1 to 11.2]
Information in this document applies to any platform.
Goal

This note explains the configuration in 10g & 11g  for :

1) Client Side Connect Time Load Balance
2) Client Side Connect Time Failover
3) Server Side Listener Connection Load Balance
4) Transparent Application Failover (TAF)
Solution
CONCEPTS

(1) Client Side Connect-Time Load Balance

The client load balancing feature enables clients to randomize connection requests among the listeners.

Tnsnames Parameter: LOAD_BALANCE

The (load_balance=yes) instructs SQLNet to progress through the list of listener addresses in a random sequence, balancing the load on the various listeners. When set to OFF, instructs SQLNet to try the addresses sequentially until one succeeds.

Load balancing can be specified for an ADDRESS_LIST or associated with a set of ADDRESSes or set DESCRIPTIONs.

This parameter must be correctly coded in your net service name (connect descriptor).
By default, this parameter is set to ON for DESCRIPTION_LISTs.

If you use ADDRESS_LIST, (load_balance=yes) should be within the (ADDRESS_LIST=) portion. If you do not use ADDRESS_LIST, (load_balance=yes) should be within the (description=) portion.

(2) Client Side Connect-Time failover

The connect-time failover enables clients to connect to another listener if the initial connection to the first listener fails. The number of listener protocol addresses determines how many listeners are tried. Without
connect-time failover, Oracle Net attempts a connection with only one listener. The default is on.

Tnsnames Parameter: FAILOVER

(failover=on) is default for ADDRESS_LISTs, DESCRIPTION_LISTs, and a set of
DESCRIPTIONs., therefore, you do not have to specify it explicitly.


(3) Server Side Listener Connection Load Balance

The listener connection load balancing feature improves connection performance by balancing the number of active connections among multiple dispatchers and instances. In a single-instance environment, the listener selects the least loaded dispatcher to handle the incoming client requests. In an Oracle Real Application Clusters (RAC) environment, connection load balancing also has the capability to balance the number of active connections among multiple instances.
1. Least-loaded node
2. Least-loaded instance
3. Least-loaded dispatcher for that instance (in case of Shared server configuration)


There are two types of server-side load balancing:

Load Based — Server side load balancing redirects connections by default depending on node load. From 10.2 onwards you can work this with Load balancing advisory (LBA). This will not be effective for login storms as the connections are already in the listener after which PMON update on the load comes to the listener.
Session Based — Session based load balancing takes into account the number of sessions connected to each node and then distributes the connections to balance the number of sessions across the different nodes.
Session count balancing is used when you set a listener parameter, PREFER_LEAST_LOADED_NODE_<listener_name>=OFF (<listener_name> is the actual name of the listener which is different on each node in your cluster and by default is constructed as "listener_<nodename>"). Please be aware that connections bursts (large number of connections initiated very quickly one after another) may not be properly balanced due to statistics update latency.

(4) Transparent Application Failover (TAF)

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.
CONFIGURATION

We will take a 2 node setup for this entire configuration example
Node1:

Hostname: node1.idc.oracle.com
VIP Hostname: node1-vip.idc.oracle.com
Database Service_names: service.idc.oracle.com
SID: sid1


Node2:

Hostname: node2.idc.oracle.com  
VIP Hostname: node2-vip.idc.oracle.com  
Database Service_names: service.idc.oracle.com  
SID: sid2


Note: Ensure that the node1-vip.idc.oracle.com and node2-vip.idc.oracle.com is resolvable & reachable from clients. If needed You may replace the hostnames with IP address in the entire configuration files.

Node1

Listener.ora
LISTENER_NODE1=  
(DESCRIPTION =  
(ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))  
  (ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip.idc.oracle.com)(PORT = 1521)(IP=FIRST))
  (ADDRESS = (PROTOCOL = TCP)(HOST = node1.idc.oracle.com)(PORT = 1521)(IP=FIRST))     
)  
)  

Start the listener
$ lsnrctl start LISTENER_NODE1

Tnsnames.ora
NODE1_LOCAL=
(ADDRESS = (PROTOCOL = TCP)(HOST=node1-vip.idc.oracle.com)(PORT = 1521))     


Note: Make sure this tns alias NODE1_LOCAL is resolvable on the server, this ensures PMON picksup the entry without problem.
The following command should succeed on node1
$ tnsping node1_local

Set the local_listener for node1
sql > alter system set LOCAL_LISTENER='node1_local' scope=both sid='sid1' ;



Node2

Listener.ora
LISTENER_NODE2=   
(DESCRIPTION =   
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))           
(ADDRESS=(PROTOCOL=TCP)(HOST=node2.idc.oracle.com)(PORT=1521)(IP=FIRST))   
(ADDRESS=(PROTOCOL=TCP)(HOST=node2-vip.idc.oracle.com)(PORT=1521)(IP=FIRST))   
)   
)

Start the listener
$ lsnrctl start LISTENER_NODE2

Tnsnames.ora

NODE2_LOCAL=  
   (ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip.idc.oracle.com)(PORT = 1521))


Note: Make sure this tns alias NODE2_LOCAL is resolvable on the server, this ensures PMON picksup the entry without problem.
The following command should succeed on node2
$ tnsping node2_local

Set the local_listener for node2

sql > alter system set LOCAL_LISTENER='node2_local' scope=both sid='sid2' ;  

Enable the server side Load balancing (if required)
You should make the the listeners aware of adjacent nodes load to do the server side load balance.
To make PMON to notify the load information to adjacent nodes,  you should set the REMOTE_LISTENER parameter.

Add the following tnsalias in both the nodes tnsnames.ora
Node1 & Node2 Tnsnames.ora
NODE_REMOTE =
(DESCRIPTION =     
  (ADDRESS = (PROTOCOL = TCP)(HOST=node1-vip.idc.oracle.com)(PORT = 1521))   
  (ADDRESS = (PROTOCOL = TCP)(HOST=node2-vip.idc.oracle.com)(PORT = 1521))   
)


Note: Make sure this tns alias NODE_REMOTE is resolvable on all the servers, this ensures PMON picksup the entry without problem.
The following command should succeed on all the nodes
$ tnsping node_remote

Set the remote listeners to both the nodes
sql> alter system set REMOTE_LISTENER='node_remote' scope=both;


Client Side Load Balancing

Following is an example of TNS net service alias for client side load balancing
CLIENT_LOADBALANCE=
(DESCRIPTION =
  (LOAD_BALANCE = yes)
  (ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip.idc.oracle.com)(PORT = 1521))
  (ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip.idc.oracle.com)(PORT = 1521))  
  (CONNECT_DATA =  
   (SERVICE_NAME = service.idc.oracle.com)  
  )
)
Connect Time Failover

Sample connect time failover TNS net service alias
address_list defaults the failover=on
CLIENT_FAILOVER=
(DESCRIPTION =  
(ADDRESS_LIST =  
  (ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip.idc.oracle.com)(PORT = 1521))
  (ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip.idc.oracle.com)(PORT = 1521))  
)
(CONNECT_DATA =
   (SERVICE_NAME = service.idc.oracle.com)
)
)
Client Side Load Balance & Connect-time Failover Connect String
CLIENT_LOAD_FAILOVER=
(DESCRIPTION =
(ADDRESS_LIST =
  (LOAD_BALANCE = yes)
  (ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip.idc.oracle.com)(PORT = 1521))
  (ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip.idc.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
  (SERVICE_NAME = service.idc.oracle.com)
)
)


TAF - Client Side Configuration

Failover Mode Type can be Either SESSION or SELECT.
Session failover will have just the session to failed over to the next available node.The select query will not be resumed.

You can refer the below document for various options on TAF
Oracle® Database Net Services Administrator's Guide
Chapter on Enabling Advanced Features of Oracle Net Services

Simple TAF can be configured on the client side tnsnames.ora with following entry
TAF=
(DESCRIPTION =
(ADDRESS_LIST =
  (LOAD_BALANCE = yes)
  (ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip.idc.oracle.com)(PORT = 1521))
  (ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip.idc.oracle.com)(PORT = 1521))
)
(CONNECT_DATA =
   (SERVICE_NAME = service.idc.oracle.com)
   (failover_mode=(type=select)(method=basic))
    )
  )
TAF - Server Side Configuration

From Oracle 10.2 onwards, TAF can be configured with server side at the time of service creation also.
Refer Note 460982.1 How To Configure Server Side Transparent Application
Failover

Troubleshooting Load Balance

Incase of server side load balancing not happening properly, to start diagonisng the issue you may collect the below set of information:

a. Is session load balance turned on ?
b. What is the connection distribution on nodes ?
c. Is all the nodes are equal power w.r.t CPU / Memory / Hardware ?
d. Is there any application connecting locally (BEQueath connection) and doing big operations on any one of the node?
e. Are all the nodes are configured with proper settings of local / remote listeners?
Refer NOTE 263599.1 Understanding and Troubleshooting Instance Load Balancing
Troubleshooting TAF

Incase of client connectivity failure the ideal start point to diagonise the issue is with Client Sqlnet tracing at support Level

To enable the client tracing  Refer
NOTE 395525.1How to Enable Oracle SQLNet Client , Server , Listener , Kerberos and External procedure Tracing from Net Manager

While creating an Service Request with Oracle Support for TAF , provide the following information to diagonise the problem:

a. Failed connection client sqlnet tracing

b. Execute and provide the output of following commands from both the nodes:
    $ sql > show parameter Listener
    $ sql> show parameter service
    $ lsnrctl  services <listener_name>

c. Upload the tnsnames.ora & Listener logs (by default created with <listener_name>.log) from both nodes.
References
NOTE:226880.1 - Configuration of Load Balancing and Transparent Application Failover
NOTE:342419.1 - ORA-12520: Listeners Running on VIP Address in 10g or Newer RAC
NOTE:395525.1 - How to Enable Oracle SQLNet Client , Server , Listener , Kerberos and External procedure Tracing from Net Manager

使用道具 举报

回复
论坛徽章:
0
17#
发表于 2012-2-11 05:15 | 只看该作者
ylw6006 发表于 2012-2-10 08:58
恩,是这样的!client side的taf,10g rac和11g rac环境下我都测试成功了,但是server side配置总是不成功 ...

For server side,

1. Find your service name. "select name from dba_services" or "show parameter service"
2. Run the following procedure with your service name:

execute dbms_service.modify_service (service_name => 'your service name' -
, 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);



使用道具 举报

回复
论坛徽章:
5
ITPUB十周年纪念徽章
日期:2011-11-01 16:24:512012新春纪念徽章
日期:2012-01-04 11:55:05双黄蛋
日期:2012-01-11 11:00:012012新春纪念徽章
日期:2012-02-24 10:48:45茶鸡蛋
日期:2012-04-16 10:22:07
18#
 楼主| 发表于 2012-2-15 09:36 | 只看该作者
ccshu 发表于 2012-2-9 17:07
TAF有一些限制的,比如说,JDBC:thin不能用,如果要实现select不中断,上面10楼兄弟给的样例是不够的,typ ...

请教,使用下面的方式配置JDBC:thin支持TAF是否可行?
TuxSam T. • Hey Guys,

Thanks for all your inputs. I found a way out.
I used oci driver and the TAF works like a charm.

I performed following steps

1-> Installed oracle Software Only on the application server (In My Case JBoss)
2-> Set up Env variables TNS_ADMIN, ORACLE_HOME , CLASSPATH to include $ORACLE_HOME/jdbc/lib/ojdbc6.jar and other jboss common classes
3-> Sourced the above profile
4-> in Jboss datacource Changed the connection url from jdbc.oracle.thin to jdbc.oracle.oci:@TAFSRV
5-> Created a tnsnames.ora in $TNS_ADMIN with the TAF entry of the RAC database
6-> started jboss
7-> Tested my code .. it worked like a charm

Thanks again
Hemant

refer:http://www.linkedin.com/groups/c ... -3156190.S.56866012

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表