当前位置:   article > 正文

bash: sqlplus: command not found 问题解决方法

bash: sqlplus: command not found

一、问题描述
在Linux中Oracle安装成功后,首次启动使用时,出现 sqlplus 命令不识别的问题,现象如下:

$ sqlplus / as sysdba
bash: sqlplus: command not found...
  • 1
  • 2

二、问题分析
查看环境变量是否正确配置:

$ vim .bash_profile
  • 1

.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
export ORACLE_SID=ORCLCDB
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19c/dbhome_1
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

发现PATH环境变量没有正确配置,于是执行如下操作:

在最后添加如下内容:

export PATH=$PATH:$ORACLE_HOME/bin
  • 1

然后执行命令使生效:

$ source .bash_profile
  • 1

$ . .bash_profile
  • 1

三、效果验证
再次尝试登录,发现可正常登录,示例效果如下:

$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Mar 15 22:18:23 2024
Version 19.3.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL>

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/444959
推荐阅读
相关标签
  

闽ICP备14008679号