暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

DB2 Error Code 1639 和 SQL State 08001 案例诊断和解决一则

原创 eygle 2019-10-21
2152

有朋友在墨天轮提出一个 DB2 的问题,当完成初始化安装部署之后,本地连接没有问题,但是远程无法连接数据库:
WechatIMG12.png
错误提示是:Error Code -1639 , SQL State: 08001 :
WechatIMG17.png

这个错误有多种可能性,例如防火墙没有开放 50000 端口,但是这个案例,客户已经关闭了防火墙,端口可达。

还有一个相关性问题,就是权限,在 db2inst1/sqllib/security 目录下,检查 db2ckpw 和 db2chpw 文件的权限:

WechatIMG21.png

将这两个文件的属主修改为 root ,权限修改为 4511 ,重启数据库,数据库就可以接受远程访问了:

chown root db2chpw
chown root db2ckpw
chmod 4511 db2chpw
chmod 4511 db2ckpw

WechatIMG26.png

最后总结一下:
db2ckpw 的作用是用于检查 DB2 服务器上的用户标识和密码。由于 DB2 依赖于操作系统级别的认证,因此,当某个用户或应用程序连接到服务器上的数据库时,使用该进程验证用户标识和密码。当将 AUTHENTICATION 设置为 SERVER 时,或者当连接是从非安全的操作系统建立的时候,就会进行认证。验证权限需要检查 passwd 文件,ckpw 顾名思义就是 Check Password file 的含义,正因为如此,这个工具必须以 root 运行,需要远程连接时必须保证该权限。

以下一段描述表述清晰:

db2ckpwd is the password checking daemon that deals with user
authentication. This process is used to confirm that the id exists and
has a right to be on the box. If the process if not a root process, only
local connections will be allowed to the database because the id is
already on the box. To make the OS API calls necessary to determine if
the user has the right to be on the box, DB2’s db2ckpwd must run as
root. If it is not started as root, it will not have permissions to make
the API calls, and it will return an SQL 30082 rc=24 error. Also since
the db2ckpwd must su to root, in order to run as root, the db2ckpw file
will need to have the su bit set, and the file system must be mounted so
that su’ing is allowed.

DB2 建立连接的示意图如下:
DB2Connect.jpg

记录供参考。


读完本文,觉得不够?2019 数据技术嘉年华来啦!现场大咖云集,与你共畅数据的魅力。现在加入,尽享超低票价优惠:
2019DTC.png

最后修改时间:2019-10-23 08:50:17
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
1人已赞赏
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论