- 07 Jun 2024
- 1 Minute to read
- Print
- DarkLight
- PDF
Setting Environment Variables
- Updated on 07 Jun 2024
- 1 Minute to read
- Print
- DarkLight
- PDF
Issue Description
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.
Analysis
The error you're encountering suggests that the environment variables for ORACLE_HOME and potentially LD_LIBRARY_PATH are not set correctly. These environment variables are necessary for SQL*Plus to locate its required message files and libraries. Here’s how to set these variables:
Setting Environment Variables
Locate the Oracle Installation Directory:
Typically, this directory is the root directory where Oracle software is installed. For example: /opt/oracle/product/19c/dbhome_1.
Set the ORACLE_HOME Environment Variable:
Open your profile file (.bashrc, .bash_profile, .zshrc, etc.) in a text editor. For example:
sh
Copy code
Add the following lines at the end of the file:
sh
Copy code
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1 export PATH=$ORACLE_HOME/bin:$PATH esxport LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
Save the file and exit the text editor.
Apply the changes.
Apply the changes by sourcing the profile file:
sh
Copy code
source ~/.
Verifying the Environment Variables
Check ORACLE_HOME
Verify that the ORACLE_HOME variable is set correctly:
sh
Copy code
echo $ORACLE_HOME
It should output the path to your Oracle home directory. Example: /opt/oracle/product/19c/dbhome_1
Check PATH:
Verify that the PATH variable includes the Oracle bin directory:
sh
echo $ORACLE_HOME
Ensure that the Oracle bin directory (e.g., /opt/oracle/product/19c/dbhome_1/bin) is listed in the output.
Check LD_LIBRARY_PATH:
Verify that the LD_LIBRARY_PATH variable includes the Oracle lib directory:
sh
Copy code
echo $LD_LIBRARY_PATH
Ensure that the Oracle lib directory (e.g., /opt/oracle/product/19c/dbhome_1/lib) is listed in the output.
Example
Here’s a concrete example assuming Oracle is installed in /opt/oracle/product/19c/dbhome_1:
Open your profile file:
sh
Copy code
nano ~/.bashrc
Add the following lines:
sh
Copy code
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1 export PATH=$ORACLE_HOME/bin:$PATH export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
Save and exit the text editor.
Apply the changes:
sh
Copy code
source ~/.bashrc
Verify the environment variables:
sh
Copy code
echo $ORACLE_HOME echo $PATH echo $LD_LIBRARY_PATH
Try running SQL*Plus again:
sh
Copy code
sqlplus