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

时间:2024-03-27 19:33:36

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

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

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


错误提示是:Error Code -1639 , SQL State: 08001 :详述一则DB2 Error Code 1639和SQL State 08001案例诊断和解决方案

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

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

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

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

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

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

最后总结一下: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 建立连接的示意图如下:详述一则DB2 Error Code 1639和SQL State 08001案例诊断和解决方案

记录供参考。


读完本文,觉得不够?2019 数据技术嘉年华来啦!现场大咖云集,与你共畅数据的魅力。现在加入,尽享超低票价优惠:详述一则DB2 Error Code 1639和SQL State 08001案例诊断和解决方案

嘉年华限时转发活动:

云和恩墨大讲堂 | 一个分享交流的地方

长按,识别二维码,加入万人交流社群

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

请备注:云和恩墨大讲堂