bash:xxx:command not found

前几天在centos6.0上配好了oracle 10g并且能够执行oracle相关命令,但是今天准备往oracle里倒数据时,执行sqlplus 出现bash:command not found

[oracle@master ~]$ sqlplus /nolog
bash: sqlplus: command not found

 

然后google了下,是/usr/bin找不到sqlplus命令,然后对$ORACLE_HOME/bin/sqlplus在/usr/bin下建立连接

[oracle@master ~]$ ln -s $ORACLE_HOME/bin/sqlplus /usr/bin
[oracle@master ~]$ sqlplus /nolog
bash: sqlplus: command not found

还是出现找不到命令,用which sqlplus

[oracle@master ~]$ which sqlplus
/usr/bin/which: no sqlplus in (/home/env/hbase0946/bin:/usr/java/jdk1.6.0_43/bin:/home/env/ant190/bin:/home/env/maven305/bin:/home/env/hadoop112/bin:/home/env/zookeeper345/bin:/usr/lib/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

查询结果可知$PATH中没有包含到$ORACLE_HOME/bin,既然找到了原因那就好办了。

[oracle@master ~]$ vi .bash_profile

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

ORACLE_BASE=/home/oracle/oracle10g
ORACLE_HOME=$ORACLE_BASE/102
ORACLE_SID=orcl
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin

export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH

在.bash_profile 中PATH已经包含了$ORACLE_HOME/bin,那就是说明我的profile没有起作用。

[oracle@master ~]$ source .bash_profile 
[oracle@master ~]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Dec 19 10:05:27 2013

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> 

让我费解的地方是安装完oracle的时候我已经source .bash_profile并且sqlplus这些命令是有用的,只是过了几天重开终端再执行时就失效了,我并没有重启linux

 

posted on 2013-12-19 10:46  chenkeyou  阅读(3095)  评论(0编辑  收藏  举报

导航