错误描述
$ sqlplus / as sysdba
-bash: sqlplus: command not found
处理方法
- 查看环境.bash_profile 配置
$ find -name .bash_profile
./.bash_profile
$ pwd
/home/oracle
$ 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/.local/bin:$HOME/bin
export PATH
#add by rui on 20210715
export ORACLE_BASE=/oracle/app
export ORACLE_HOME=$ORACLE_BASE/oracle/product/12.1.0/dbhome_1 --配置错误,修改为【1】
export ORACLE_SID=rui1
export PATH=$HOME/bin:$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
【1】export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/dbhome_1
打开一个新窗口,再次输入命令:
$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Thu Jul 15 04:42:11 2021
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>
可以看到,问题已经成功解决。
本次产生错误的原因是:$ORACLE_HOME配置错误。

本文档描述了在Linux环境中遇到$ORACLE_HOME配置错误导致sqlplus无法运行的问题。通过检查.bash_profile文件,发现ORACLE_HOME路径设置不正确。修正为$ORACLE_BASE/product/12.1.0/dbhome_1后,问题得到解决,能够成功连接到Oracle数据库。

6013

被折叠的 条评论
为什么被折叠?



