DB2无法连接的问题排查过程

今天上午,在测试环境下手动的安装了一个DB2 V9.7,设置完SVCENAME后,然后使用clpplus连接报以下错误:

 

[db2inst1@lstest ~]$ clpplus db2inst1/[email protected]:60000/sde
 
[jcc][t4][2043][11550][3.58.82] 异常 java.net.ConnectException:打开端口 60,000 上服务器 /192.168.100.228 
的套接字时出错,消息为:拒绝连接。 ERRORCODE=-4499, SQLSTATE
=08001

从错误上看应该是60000端口有问题,

接着使用netstat 命令查看DB2的db2sysc是否在监听60000端口,结果如下:

netstat -lnp|grep 60000

没有任何返回,重启DB2的实例,依旧,此时接着查看DB2内部的db2tcpcm是否启动,

结果如下:

[db2inst1@lstest ~]$ db2pd -edu
 
Database
 Partition 0 -- Active -- Up 0 days 00:21:54
 
List of
 all
 EDUs for
 database
 partition 0
 
db2sysc PID: 27228
db2wdog PID: 27226
db2acd  PID: 27239
 
EDU ID    TID            Kernel TID     EDU Name                               USR (s)      SYS (s)
========================================================================================================================================
16        47112997824832 27492          db2agent (idle) 0                      0.010000     0.000000
15        47113002019136 27237          db2resync 0                            0.000000     0.000000
14        47113006213440 27236          db2ipccm 0                             0.000000     0.000000
13        47113010407744 27235          db2licc 0                              0.000000     0.000000
12        47113014602048 27234          db2thcln 0                             0.000000     0.000000
11        47113018796352 27233          db2alarm 0                             0.000000     0.000000
1         47112758749504 27232          db2sysc 0                              0.070000     0.090000
[db2inst1@lstest ~]$

没有发现db2tcpcm的edu,只发现了db2ipccm这个edu,此时才找到问题,估计是没有设置DB2的通讯协议环境变量,使用db2set结果如下:

[db2inst1@lstest ~]$ db2set
DB2AUTOSTART=YES

果然没有设置通讯协议的环境变量,接下来设置TCPCOMM为tcpip

[db2inst1@lstest ~]$ db2set DB2COMM=tcpip
[db2inst1@lstest ~]$ db2set
DB2COMM=tcpip
DB2AUTOSTART=YES
[db2inst1@lstest ~]$ db2stop
2010-12-28 14:58:30     0   0   SQL1064N  DB2STOP processing was successful.
SQL1064N  DB2STOP processing was successful.
[db2inst1@lstest ~]$ db2start
12/28/2010 14:58:36     0   0   SQL1063N  DB2START processing was successful.
SQL1063N  DB2START processing was successful.

[db2inst1@lstest ~]$ netstat -lnp|grep 60000
(Not
 all
 processes could be identified, non-owned process info
 will not
 be shown, you would have to
 be root to
 see it all
.)
tcp        0      0 0.0.0.0:60000               0.0.0.0:*                   LISTEN      28505/db2sysc 0
[db2inst1@lstest ~]$ db2pd -edu
 
Database
 Partition 0 -- Active -- Up 0 days 00:00:57
 
List of
 all
 EDUs for
 database
 partition 0
 
db2sysc PID: 28505
db2wdog PID: 28503
db2acd  PID: 28520
 
EDU ID    TID            Kernel TID     EDU Name                               USR (s)      SYS (s)
========================================================================================================================================
19        47304052566336 28518          db2spmlw 0                             0.000000     0.000000
18        47304056760640 28517          db2spmrsy 0                            0.000000     0.030000
17        47304060954944 28516          db2resync 0                            0.000000     0.000000
16        47304065149248 28515          db2tcpcm 0                             0.000000     0.000000
15        47304069343552 28514          db2tcpcm 0                             0.000000     0.000000
14        47304073537856 28513          db2ipccm 0                             0.000000     0.000000
13        47304077732160 28512          db2licc 0                              0.000000     0.000000
12        47304081926464 28511          db2thcln 0                             0.000000     0.000000
11        47304086120768 28510          db2alarm 0                             0.000000     0.000000
1         47303826073920 28509          db2sysc 0                              0.020000     0.010000

此时已经包括了两个db2tcpcm进程了。

使用clpplus后可以顺利连接,

[db2inst1@lstest ~]$ clpplus db2inst1/[email protected]:60000/sde
数据库连接信息
 
主机名 = 192.168.100.228
数据库服务器 = DB2/LINUXX8664  SQL09071
SQL
 授权标识 = db2inst1
本地数据库别名 = SDE
端口 = 60000
 
CLPPlus: 版本 1.1
Copyright © 2009, IBM CORPORATION.  All
 rights reserved.

至此全部搞定。

你可能感兴趣的:(DB2数据库,db2,processing,database,数据库服务器,sql,数据库)