DB2TCP_CLIENT_RCVTIMEOUT 的作用

本文主要讲述DB2客户端配置参数 DB2TCP_CLIENT_RCVTIMEOUT的作用


解释:

DB2TCP_CLIENT_RCVTIMEOUT - Adjust this variable on the client to terminate the connection if data is not received from the server within a specified amount of time. This is useful in situations where a connection has already been established with the server but the server is no longer responding because the machine is overloaded. 


说明:

 这个参数的作用是:如果客户端等了这么久,还没有收到服务端的返回结果,那么客户端就会终止掉连接。


测试:

 首先在服务端用一条不提交的SQL语句锁住表,然后在客户端执行以下操作:

$ db2 "connect to remotedb user e97q7a using pwd"


$ db2 "select * from sourcetab with RR"
SQL0911N  The current transaction has been rolled back because of a deadlock 
or timeout.  Reason code "68".  SQLSTATE=40001       <--服务端设定的locktimeout为10,过10秒之后,发生锁超时。

$ db2 terminate

$ db2set DB2TCP_CLIENT_RCVTIMEOUT=5              <--将DB2TCP_CLIENT_RCVTIMEOUT设为5,表示如果过5s还没有返回结果,则终止连接

$ db2 "connect to remotedb user e97q7a using e97q7a"

$ db2 "select * from sourcetab with RR"
SQL30081N  A communication error has been detected. Communication protocol 
being used: "TCP/IP".  Communication API being used: "SOCKETS".  Location 
where the error was detected: "192.168.10.91".  Communication function 
detecting the error: "selectForRecvTimeout".  Protocol specific error code(s): 
"2", "*", "*".  SQLSTATE=08001                                 <--在发生锁超时(需要10s)之前连接被终止(只需要5s)


同时,可以在服务端的db2diag.log里看到如下消息:

2015-12-14-08.30.05.821471+000 I1821A544          LEVEL: Error
PID     : 14942256             TID  : 7330        PROC : db2sysc 0
INSTANCE: e97q7a               NODE : 000         DB   : SOURCEDB
APPHDL  : 0-5766               APPID: 192.168.10.92.48807.151214082949
AUTHID  : E97Q7A  
EDUID   : 7330                 EDUNAME: db2agent (SOURCEDB) 0
FUNCTION: DB2 UDB, common communication, sqlcctcptest, probe:11
MESSAGE : Detected client termination
DATA #1 : Hexdump, 2 bytes
0x0700000008FF3942 : 0036                                       .6

2015-12-14-08.30.05.821775+000 I2366A526          LEVEL: Error
PID     : 14942256             TID  : 7330        PROC : db2sysc 0
INSTANCE: e97q7a               NODE : 000         DB   : SOURCEDB
APPHDL  : 0-5766               APPID: 192.168.10.92.48807.151214082949
AUTHID  : E97Q7A  
EDUID   : 7330                 EDUNAME: db2agent (SOURCEDB) 0
FUNCTION: DB2 UDB, common communication, sqlcctest, probe:50
MESSAGE : sqlcctest RC
DATA #1 : Hexdump, 2 bytes
0x0700000008FF5A20 : 0036                                       .6

2015-12-14-08.30.05.821910+000 I2893A506          LEVEL: Error
PID     : 14942256             TID  : 7330        PROC : db2sysc 0
INSTANCE: e97q7a               NODE : 000         DB   : SOURCEDB
APPHDL  : 0-5766               APPID: 192.168.10.92.48807.151214082949
AUTHID  : E97Q7A  
EDUID   : 7330                 EDUNAME: db2agent (SOURCEDB) 0
FUNCTION: DB2 UDB, base sys utilities, sqeAgent::AgentBreathingPoint, probe:10
CALLED  : DB2 UDB, common communication, sqlcctest
RETCODE : ZRC=0x00000036=54

2015-12-14-08.30.05.822184+000 I3400A1344         LEVEL: Warning
PID     : 14942256             TID  : 7330        PROC : db2sysc 0
INSTANCE: e97q7a               NODE : 000         DB   : SOURCEDB
APPHDL  : 0-5766               APPID: 192.168.10.92.48807.151214082949
AUTHID  : E97Q7A  
EDUID   : 7330                 EDUNAME: db2agent (SOURCEDB) 0
FUNCTION: DB2 UDB, base sys utilities, sqeAgent::AgentBreathingPoint, probe:16
CALLSTCK: (Static functions may not be resolved correctly, as they are resolved to the nearest symbol)
  [0] 0x090000004606DAB8 pdLog + 0xC0
  [1] 0x090000004584F0FC pdLog@glue411 + 0x94
  [2] 0x09000000457848F4 AgentBreathingPoint__8sqeAgentFi + 0x68C
  [3] 0x0900000045F1F048 IntrptWaitLock__18@87@90142@sqeAgentFP16SQLO_EDUWAITPOSTiPUiT2 + 0x1C0
  [4] 0x0900000045FBE060 sqlplnfd__FP9sqeBsuEduP14SQLP_LOCK_INFOP8SQLP_LCBP9SQLP_LHSHP8SQLP_LRBUiiUlT7P8SQLP_AWBT7 + 0xBA0
  [5] 0x0900000045F70178 sqlplnfd__FP9sqeBsuEduP14SQLP_LOCK_INFOP8SQLP_LCBP9SQLP_LHSHP8SQLP_LRBUiiUlT7P8SQLP_AWBT7@glue1405 + 0xA4
  [6] 0x0900000045F70088 sqlplrq__FP9sqeBsuEduP14SQLP_LOCK_INFO + 0x64
  [7] 0x0900000045F74C68 sqldLockTable__FP8sqeAgentP14SQLP_LOCK_INFOUiUsi + 0xC8
  [8] 0x0900000045F752B0 sqldScanOpen__FP8sqeAgentP14SQLD_SCANINFO1P14SQLD_SCANINFO2PPv + 0x53C
  [9] 0x0900000045F44F28 sqlritaSimplePerm__FP8sqlrr_cb + 0x7FC


参考资料:

http://www-01.ibm.com/support/docview.wss?uid=swg21231084


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值