bash: sqlplus: command not found 及 oracle 环境变量设置

redhat 4.6安装oracle 10g后,切换到oracle用户,执行sqlplus,出现  bash: sqlplus: command not found,是因为oracle环境变量没有设置好。

下面是oracle环境变量的设置。

[root@rhel4 ~]# su - oracle

[oracle@rhel4 ~]$ pwd
/home/oracle

[oracle@rhel4 ~]$ vi .bash_profile

------------------------------------------------------------------------------------------------

# .bash_profile

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

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
unset USERNAME

#add 2013-5-1 for oracle
export EDITOR=vi
export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export PATH=/u01/app/oracle/oracle/product/10.2.0/db_1/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
export PATH=$ORACLE_HOME/bin:$PATH
umask 022    ----新建文件夹是777-022=755(rwxr-xr-x),新建文件是666-022=644(rw-r--r--)。

#add 2013-5-2
stty erase ^H     ---退格

stty erase ^?      

---------------------------------------------------------------------------------------

[oracle@rhel4 ~]$ source ~/.bash_profile   ---使设置生效

[oracle@rhel4 ~]$ echo $ORACLE_HOME
/u01/app/oracle/oracle/product/10.2.0/db_1

[oracle@rhel4 ~]$ echo $ORACLE_SID
orcl

[oracle@rhel4 ~]$ echo $ORACLE_BASE
/u01/app/oracle/oracle

然后执行在$oracle_home/bin下执行sqlplus

[oracle@rhel4 ~]$ cd $ORACLE_HOME/bin
[oracle@rhel4 bin]$ pwd
/u01/app/oracle/oracle/product/10.2.0/db_1/bin
[oracle@rhel4 bin]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Thu May 2 22:40:14 2013

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


但是如果不在$oracle_home/bin下执行sqlplus,可能仍然会出现  bash: sqlplus: command not found,

那么在root用户下执行 ln -s $ORACLE_HOME/bin/sqlplus    /usr/bin

ln 相当于建立快捷方式


在sqlplus中不能使用上下左右方向键,参见

点击打开链接


另外,留意.bash_profile 与.bashrc的区别




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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值