Setting Environment Variables
  • 07 Jun 2024
  • 1 Minute to read
  • Dark
    Light
  • PDF

Setting Environment Variables

  • Dark
    Light
  • PDF

Article summary

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

  1. Locate the Oracle Installation Directory:

    1. Typically, this directory is the root directory where Oracle software is installed. For example: /opt/oracle/product/19c/dbhome_1.

  2. Set the ORACLE_HOME Environment Variable:

    1. Open your profile file (.bashrc, .bash_profile, .zshrc, etc.) in a text editor. For example:

      sh

      Copy code

    2. 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

    3. Save the file and exit the text editor.

  3. Apply the changes.

    1. Apply the changes by sourcing the profile file:

      sh

      Copy code

      source ~/.

      Verifying the Environment Variables

      1. Check ORACLE_HOME

        1. Verify that the ORACLE_HOME variable is set correctly:

          sh

          Copy code

          echo $ORACLE_HOME

        2. It should output the path to your Oracle home directory. Example: /opt/oracle/product/19c/dbhome_1

      2. Check PATH:

        1. Verify that the PATH variable includes the Oracle bin directory:

          sh

          echo $ORACLE_HOME

        2. Ensure that the Oracle bin directory (e.g., /opt/oracle/product/19c/dbhome_1/bin) is listed in the output.

      3. Check LD_LIBRARY_PATH:

        1. Verify that the LD_LIBRARY_PATH variable includes the Oracle lib directory:

          sh

          Copy code

          echo $LD_LIBRARY_PATH

        2. 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:

          1. Open your profile file:

            sh

            Copy code

            nano ~/.bashrc

          2. 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

          3. Save and exit the text editor.

          4. Apply the changes:

            sh

            Copy code

            source ~/.bashrc

          5. Verify the environment variables:

            sh

            Copy code

            echo $ORACLE_HOME echo $PATH echo $LD_LIBRARY_PATH

          6. Try running SQL*Plus again:

            sh

            Copy code

            sqlplus


Was this article helpful?