Setting Oracle Environment Variables

🐧 Setting Oracle Environment Variables on Linux

1. Open Terminal and Switch to the Oracle User:

            su - oracle

2. Set Environment Variables:

            export ORACLE_BASE=/u01/app/oracle
            export ORACLE_HOME=$ORACLE_BASE/product/23.0.0/dbhome_1
            export ORACLE_SID=orcl
            export PATH=$ORACLE_HOME/bin:$PATH

These variables define the base directory for Oracle software (ORACLE_BASE), the location of the Oracle home directory (ORACLE_HOME), the Oracle System Identifier (ORACLE_SID), and update the system PATH to include Oracle binaries.

3. Make Variables Persistent:

To ensure these settings persist across sessions, add them to the Oracle user's profile script:

            vi ~/.bash_profile

Add the export lines mentioned above, save, and exit. Then, apply the changes:

            source ~/.bash_profile


🪟 Setting Oracle Environment Variables on Windows

1. Access Environment Variables:

  • Right-click on This PC or My Computer and select Properties.
  • Click on Advanced system settings.
  • In the System Properties window, click on Environment Variables

2. Set ORACLE_HOME:

  • Under System variables, click New
  • Enter ORACLE_HOME as the variable name.
  • Set the variable value to your Oracle installation path, e.g., C:\oracle\product\23.0.0\dbhome_1.
  • Click OK.

3. Set ORACLE_SID:

  • Click New again under System variables.
  • Enter ORACLE_SID as the variable name.
  • Set the variable value to your database SID, e.g., orcl.
  • Click OK.

4. Update PATH Variable:

  • In the System variables section, find and select the Path variable, then click Edit.
  • Click New and add the path to the Oracle bin directory, e.g., C:\oracle\product\23.0.0\dbhome_1\bin
  • Click OK to close all dialog boxes.

🔍 Verifying Environment Variables

On Linux:

              echo $ORACLE_HOME
              echo $ORACLE_SID
              which sqlplus

On Windows:

Open Command Prompt and run:

              echo %ORACLE_HOME%
              echo %ORACLE_SID%
              where sqlplus

Comments

Popular posts from this blog

Managing Oracle Data Files – Resizing and Adding

Oracle Database Basic Consepts (Start / Stop / Check Database Status)

Kubernetes Administration – Essential Commands for IFS Cloud