sqlplus连接oracle时报错如下:

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

造成此问题为ORACLE_HOME设置错误.

查看oracle用户环境变量,[oracle@denglj ~]$ cat .bash_profile

发现ORACLE_HOME=$ORACLE_BASE/oracle/product/18.3.0/db_1

而Oracle software此前被解压到另一个目录(/home/oracle/setup),如下所示.

SP2-0667异常报错_sql

处理方案:将ORACLE_HOME=$ORACLE_BASE/oracle/product/18.3.0/db_1

修改为ORACLE_HOME=/home/oracle/setup

保存退出后,需[oracle@denglj ~]$ source .bash_profile使其生效,如下所示此问题不在发生.

[oracle@denglj ~]$ sqlplus /nolog

SQL*Plus: Release 18.0.0.0.0 - Production on Mon Sep 6 22:35:53 2021

Version 18.3.0.0.0

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