linux db2 command not found,db2 command not found in unix

问题

I am trying to execute a simple db2 command in Linux command prompt. but Linux command prompt is not recognizing the command it is giving - bash db2 command not found. but db2 is installed in the Linux machine.

command I am trying to execute from Linux command line processor is db2 "create database smaple"

Error I am getting is below "If db2 in not a typo you can run the following command to lookup the package that contains the binary" command-not-found db2 -bash: db2: command not found"

Is this because of environment variable problem ?? or there is only one instance of db2 ie db2inst1 is running in the machine.my user name in appsusr and db2 instance name is db2inst1 are different is this causing problem?? and I am not having super user access.Is this is causing any problem?? do I need super user access is required ??

回答1:

Just type, echo $PATH in your command prompt , where you can see all the exported paths in your system.

If the db2 path is not found in your environment variable list, then do the following.

export PATH=$PATH:/opt/IBM/db2/V10.1/bin

and then press enter.

I hope this will resolve your issue.

回答2:

On Linux and UNIX DB2 platforms, the proper way to set your environment variables to run DB2 commands is to source the sqllib/db2profile script belonging to the local DB2 instance owner. That will set not only your PATH but also other important variables that DB2 requires.

In your case, the instance is owned by the db2inst1 user, so your login startup file or batch script should run this command:

. ~db2inst1/sqllib/db2profile

The leading dot is necessary to set the variables in your current shell process, not the sub-process that quickly vanishes after db2profile finishes.

回答3:

It's more than likely that, if DB2 is installed, it's simply not in your path.

Your path should contain something like:

/opt/IBM/db2/V10.1/bin

which is where the executables live (depending on which version you're running).

Changing your path will probably entail changes to one of the startup files, such as .bashrc or .bash_profile.

来源:https://stackoverflow.com/questions/27898194/db2-command-not-found-in-unix

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值