找不到sqlplus 也就是$PATH 环境变量下面没有把oracle_homein 目录加到环境变量里面。
直接执行echo $PATH 发现没有。
因为安装的时候记得在安装用户下面是设置过环境变量的。(如果是在系统的环境变量下面设置的就/etc/profile 里面查看下)
进入到安装oracle 的用户的主目录下面,我的在/home/oracle 查看.bash_profile 文件有没有定义这个目录到$PATH。
umask 022
export ORACLE_BASE=/home/oracle/app
export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
很明显有的。可是为什么echo $PTAH 却没有呢。
切换到用oracle 重新连接就可以了。
为什么su oracle 却不行呢。 查询后发现su 用户 后并没有切换到该用户的目录下面,也就是说登录环境没有改变。
用su - 用户或者su -l 用户才能把登录环境也切换掉。执行之后成功找到sqlplus.