bash: sqlplus: command not found 解决方法

bash: sqlplus: command not found 解决方法

转载:https://shiguanghui.iteye.com/blog/1939054

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
    

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

  1. 登录oralce测试

     [root@localhost ~]# sqlplus /nolog
     
     -bash: sqlplus: command not found
    

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

  1. 查看sqlplus 是否存在

     [root@localhost oracle]# cd /usr/bin/
     
     [root@localhost bin]# find -name sqlplus
     
     [root@localhost bin]#
    

结果发现不存在

  1. 要么去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
  1. 测试结果;

     [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>
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值