1.背景

在Suse15安装好DB2后,执行db2level命令查看版本报错

db2inst@admin:~$ cd /opt/ibm/db2/V11.1/bin/
db2inst@admin:/opt/ibm/db2/V11.1/bin$ ./db2level 
SQL10007N Message "-10003" could not be retrieved.  Reason code: "3".

2.原因

环境变量导致的

3.解决方案

在db2inst用户下执行

cd /home/db2inst
vim ~/.bash_profile

在文件中填下以下内容:

DB2_HOME=/opt/ibm/db2/V11.1/
export PATH=$PATH:$DB2_HOME/bin:/home/db2inst1/sqllib/bin
if [ -f /home/db2inst1/sqllib/db2profile ]
    then
        source /home/db2inst1/sqllib/db2profile
fi

使环境变量生效

db2inst@admin:~$ pwd
/home/db2inst
db2inst@admin:~$ source ~/.bash_profile

再次运行db2level

db2inst@admin:~$ cd /opt/ibm/db2/V11.1/bin/
db2inst@admin:/opt/ibm/db2/V11.1/bin$ db2level 
DB21085I  This instance or install (instance name, where applicable: 
"db2inst1") uses "64" bits and DB2 code release "SQL11014" with level 
identifier "0205010F".
Informational tokens are "DB2 v11.1.4.4", "s1811091400", "DYN1811091400AMD64", 
and Fix Pack "4".
Product is installed at "/opt/ibm/db2/V11.1".

Logo

更多推荐