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

一、问题描述

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

复制代码
$ sqlplus / as sysdba
bash: sqlplus: command not found...

二、问题分析

查看环境变量是否正确配置:

复制代码
$ vim .bash_profile

.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

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

在最后添加如下内容:

复制代码
export PATH=$PATH:$ORACLE_HOME/bin

然后执行命令使生效:

复制代码
$ source .bash_profile

复制代码
$ . .bash_profile

三、效果验证

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

复制代码
$ 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>
相关推荐
AR72 分钟前
Linux与Windows跨平台文件共享实现
linux
暮云星影20 分钟前
附录:LInux编辑器学习笔记
linux·学习·编辑器
什么半岛铁盒21 分钟前
深入解析Linux软硬链接:原理、区别与应用实践
linux
晴空๓1 小时前
在CentOS上安装Docker需要注意的事项
linux·docker·centos
ALex_zry1 小时前
深入解析 MySQL 中的日期时间函数:DATE_FORMAT 与时间查询优化
android·数据库·mysql
二年级程序员1 小时前
MySQL 约束(入门版)
数据库·mysql
04Koi.1 小时前
Redis进阶--主从复制
数据库·redis·缓存
_清风来叙1 小时前
【U-Boot】解决U-Boot的“Unknown command ‘help‘ - try ‘help‘”问题
linux
University of Feriburg1 小时前
1-linux的基础知识
linux·笔记·学习·嵌入式实时数据库·嵌入式软件·初学者
S01d13r1 小时前
Redis 面经
数据库·redis·缓存