当前位置:   article > 正文

-bash: sqlplus: command not found 解决

-bash: sqlplus: command not found

首先确认在根目录下执行 sqlplus命令

[root@localhost ~] cd ~

1: bash: sqlplus: command not found 解决方法 

1) 查看环境.bash_profile 配置

[root@localhost ~]#  find -name .bash_profile

./usr/local/oracle11gr2/oracle/.bash_profile

./etc/skel/.bash_profile

./root/.bash_profile

./home/oracle/.bash_profile(这个是我oracle用户的环境变量)

 

2) 查看环境变量配置文件

[oracle@localhost ~]$ 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

export ORACLE_BASE=/usr/local/oracle11gr2/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

export ORACLE_SID=cssid

export ORACLE_OWNER=oracle

export PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin

这里的环境变量都已经配置了。

 

3) 登录oralce测试

[root@localhost ~]# sqlplus /nolog

-bash: sqlplus: command not found

找不到sqlplus 可执行文件找不到。 所以我们要去/usr/bin/ 下查看sqlplus 是否存在

 

4) 查看sqlplus 是否存在

[root@localhost oracle]# cd /usr/bin/

[root@localhost bin]# find -name sqlplus

[root@localhost bin]#

结果发现不存在

 

5) 要么去sqlplus根目录下执行,要么做个ln到/usr/bin/下

sqlplus根目录:/usr/local/oracle11gr2/oracle/product/11.2.0/db_1/bin/sqlplus

这里我们做ln。这样操作方便很多

ln -s /usr/local/oracle11gr2/oracle/product/11.2.0/db_1/bin/sqlplus /usr/bin

 

6) 测试结果;

[oracle@localhost bin]$ sqlplus /nolog

Error 6 initializing SQL*Plus

SP2-0667: Message file sp1<lang>.msb not found

 

SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

这里sqlplus已经找到了。当然这里又发现了其他的错误。 

这个是环境变量没有生效的原因。所以我们soruce一下,使得马上生效

[oracle@localhost ~]$ source .bash_profile

 

 再测试就ok了。

 

[oracle@localhost ~]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Mon May 11 12:51:24 2009

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

SQL> conn / as sysdba

Connected to an idle instance.

SQL> startup

ORACLE instance started.

Total System Global Area  167772160 bytes

Fixed Size                  1218316 bytes

Variable Size              79694068 bytes

Database Buffers           83886080 bytes

Redo Buffers                2973696 bytes

Database mounted.

Database opened.

SQL>

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/凡人多烦事01/article/detail/444966
推荐阅读
相关标签
  

闽ICP备14008679号