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

本文详细介绍了如何诊断和解决DB2 Error Code -1639及SQL State 08001导致的远程连接失败问题。在排查中,发现可能是db2ckpw和db2chpw文件的权限问题。通过将文件属主更改为root并设置特定权限,然后重启数据库,可以成功解决远程访问问题。了解db2ckpwd在DB2认证过程中的角色,对于确保正确权限配置至关重要。

导读:在 db2inst1/sqllib/security 目录下,检查 db2ckpw 和 db2chpw 文件的权限。

 

有朋友在墨天轮提出一个 DB2 的问题,当完成初始化安装部署之后,本地连接没有问题,但是远程无法连接数据库:

640?wx_fmt=png

 

错误提示是:Error Code -1639 , SQL State: 08001 :640?wx_fmt=png

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

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

640?wx_fmt=png

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

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

640?wx_fmt=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 建立连接的示意图如下:640?wx_fmt=jpeg

记录供参考。


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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值