DB2:ksh: db2: not found.

8760阅读 0评论2014-06-16 jackson198574
分类:DB2/Informix

  



问题:

新建的用户无法执行相关的db2命令。
# su - test
$ db2 list active databases
ksh: db2:  not found.


但是实例用户可以连接:


# su - db2inst1
$ db2 connect to testdb user test using test


   Database Connection Information


 Database server        = DB2/AIX64 9.5.2
 SQL authorization ID   = TEST
 Local database alias   = TESTDB


解决方法:
在新建用户的环境变量中,加入实例名目录下包含相关命令的文件夹路径即可,有个通用的脚本,参照如下操作:
$ vi .profile
".profile" 9 lines, 254 characters 




PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:.


export PATH


if [ -s "$MAIL" ]           # This is at Shell startup.  In normal
then echo "$MAILMSG"        # operation, the Shell checks
fi                          # periodically.






# The following three lines have been added by IBM DB2 instance utilities.
if [ -f /dbinfo_db1/db2inst1/sqllib/db2profile ]; then           --------------db2inst1路径要使用实际环境中的相关实例名代替
    . /dbinfo_db1/db2inist1/sqllib/db2profile                    --------------db2inst1路径要使用实际环境中的相关实例名代替
fi




上一篇:DB2(Linux 64位)安装教程
下一篇:ORA-12170:TNS:Connect timeout occurred