DB2:ksh: db2: not found.

jackson198574發表於2014-06-16
DB2:ksh: db2: not found.  



問題:

新建的使用者無法執行相關的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



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/20802110/viewspace-1183722/,如需轉載,請註明出處,否則將追究法律責任。