前幾天在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