平台
AIX 6.1 64bit
DB2 V9.7/DB2 V10.1 ESE版本
背景和错误现象
数据库从DB2 V9.7升级到DB2 V10.1时候碰到如下错误(db2iupgrade.log):
root@sgxldap01:/tmp#cat db2iupgrade.log.16515272
DB2 Setup log file started at: Sat Jan 23 19:33:13 2016 JST
============================================================
Operating system information: AIX 6.1
Existing instances to configure:
Instance name: db2inst1
Instance user information:
User name: db2inst1
Fenced user information:
User name: fenced1
Setting default global profile registry variables :.......Success
Initializing instance list :.......Success
ERROR: An error occurred while upgrading the instance "db2inst1". The return
value is "1". If the problem persists contact your technical service
representative.
ERROR: DBI1205E One or more local databases cannot be upgraded to the version
from which you are running this command. Check the log file
/dbhome/db2inst1/upgrade.log for the list of errors.
Explanation:
~省略~
User response:
Determine the reason why the database cannot be upgraded and take the
corresponding action specified in the explanation.
Related information:
Upgrading databases
ERROR: An error occurred while configuring the instance "db2inst1".
Configuring DB2 instances :.......Failure
Updating global profile registry :.......Success
Post Install Recommendations
-----------------------------
~省略~
DB2 Setup log file finished at: Sat Jan 23 19:33:32 2016 JST
============================================================
root@sgxldap01:/tmp#
另外/dbhome/db2inst1/upgrade.log文件有如下错误’SQL1326N’:
[IBM][CLI Driver][DB2/AIX64] SQL1326N 不能访问 "/dbhome/db2inst1/idsslapd-db2inst1/db2inst1"。
原因
直接原因是SQL1326N导致
说明
因为文件许可权不正确、文件路径不正确或目录或路径中的空间不够,所以不能访问文件或目录 名称。
如果您正在使用集群管理器,并且 DB2 数据库管理器未能将给定路径添加到集群管理器配置,那么可能会返回此错误。集群管理器中生成的错误消息将记录在 db2diag 日志文件中。
用户响应
验证在命令中指定的任何路径或文件名是否有效、您是否有访问该路径或文件名的适当许可权以及是否有足够的空间来包含该文件。更正问题并重新提交该命令。如果问题仍存在,请与您的系统管理员联系。
如果您正在使用集群管理器,那么更正问题并重新提交该命令:
查看 db2diag 日志文件,以获取集群管理器中生成的错误消息。
对 db2diag 日志文件中的集群管理器错误消息作出响应,以更正导致 DB2 数据库管理器无法将路径添加至集群管理器配置的底层问题。
重新提交该命令。
分析
初步判定是文件权限问题导致的,调查分析了实例db2inst1具有对/dbhome/db2inst1/idsslapd-db2inst1/db2inst1具有读写执行权限,
所以问题不在于db2inst1的权限问题。
root@sgxldap01:/tmp#ls -ld /dbhome/db2inst1/idsslapd-db2inst1/db2inst1
drwxrwx--- 3 db2inst1 dbsysadm 256 Nov 22 2010 /dbhome/db2inst1/idsslapd-db2inst1/db2inst1/
root@sgxldap01:/tmp#
除了实例id之外我们往往会忽略fence ID,所以通过查看db2inst1的fence id及其权限,首先fence ID如何查看?
方法1:实例执行db2pd -fmp | grep Fenced
db2inst1:/dbhome/db2inst1$ db2pd -fmp | grep Fenced
Fenced User: fenced1
db2inst1:/dbhome/db2inst1$
方法2:实例查看文件cat ~/sqllib/ctrl/.fencedID
db2inst1:/dbhome/db2inst1/sqllib/ctrl$ pwd
/dbhome/db2inst1/sqllib/ctrl
db2inst1:/dbhome/db2inst1/sqllib/ctrl$ cat .fencedID
fenced1
db2inst1:/dbhome/db2inst1/sqllib/ctrl$
再确认fenced1的权限
由于/dbhome/db2inst1/idsslapd-db2inst1/db2inst1目录只有db2inst1和dbsysadm组才具有读写执行权限,所以确认fenced1所属于的group即可判定,如下:
db2inst1:/dbhome/db2inst1/idsslapd-db2inst1$ lsgroup dbsysadm
dbsysadm id=25257 admin=false users=root,db2inst1,db2as registry=files
db2inst1:/dbhome/db2inst1/idsslapd-db2inst1$ lsuser fenced1
fenced1 id=252259 pgrp=fenced1 groups=fenced1,db2asgrp home=/dbhome/fenced1 shell=/usr/bin/ksh gecos=101/S/012314//bigdatalyn
db2inst1:/dbhome/db2inst1/idsslapd-db2inst1$
很明显fenced1对目录是没有权限的访问的。
对策
把/dbhome/db2inst1/idsslapd-db2inst1/db2inst1目录权限改为777或者把fenced1的id加到dbsysadm的组里即可。
追记:FenceID
参考如下图