Categories: SQL Tutorials

How to set oracle_home path?

In my previous article i have given the detailed description of multiple queries related to oracle. In this article i would like to throw light on – How to set oracle_home path? I will explain multiple steps for setting up the oracle_home path.We often use the oracle_home in detail. In this post i would like to cover the following topics in detail.

  1. What is mean by ORACLE_HOME and What is Purpose of it?
  2. How to check the ORACLE_HOME setting
  3. How to set ORACLE_HOME path
  4. How to change setting of oracle home or how to delete or change oracle home

Purpose of ORACLE_HOME:

  1. ORACLE_HOME is a directory name which will come at the time of Oracle software installation.
  2. The specified directory path of ORACLE_HOME directory is been stored in an environment variable.
  3. The path of the ORACLE_HOME directory is stored the installation path of oracle. Example : For windows it could be C:\ or C:\Software or under D:\.
  4. File Structure under oracle home : The structure of files in ORACLE_HOME is fixed. Example : The location of sqlplus.exe is always ORACLE_HOME/bin and Tnsnames.ora path will be ORACLE_HOME\network\admin.
  5. The ORACLE_HOME file will always used to ensure the correct oracle version is accessed running against the database.
  6. When it is important : It is very critical when you are using multiple versions of oracle on same windows server. ORACLE_HOME file is also important for installing the patches of oracle.

How to set oracle_home path? :

Once you install the Oracle.We require to check ORACLE_HOME file is set or not. We require to set the ORACLE_HOME .

How to set oracle_home path? Windows Server

There are so many questions in mind that what is exact path of ORACLE_HOME file.We require to check whether the ORACLE_HOME is set or not.

c:\>echo %ORACLE_HOME%

C:\oraclexe\app\oracle\product\11.1.0.6\server

If the path is given below (The version name may be different). If ORACLE_HOME is not set then you require to set the ORACLE_HOME.

C :\> echo %ORACLE_HOME%%ORACLE_HOME

How to set oracle_home path?

We require to set the ORACLE_HOME for Windows server ,

C:\>set ORACLE_HOME=C:\oraclexe\app\oracle\product\11.1.0.6\server

C:\>echo %ORACLE_HOME%C:\oraclexe\app\oracle\product\11.1.0.6\server

C:\>

How to check and set Environment variable path?

Step 1 : Go to the Control Panel –> System –> Advanced

Step 2 :We require to create on button named “Environment Variables”. There are two set of variables – first is User and other is System variables.The user variables are the variables which are visible to anyone who has logged in to the system. The system variables are visible to any other person who uses the system.

Step 3:Depending on the visibility you require to create ORACLE_HOME variable by clicking on New button.

Step 4 : We require to set the ORACLE_HOME directory value and Save it.

Step 5: We require to verify it with new command line session,

  1. Go to Control Panel -> System -> Advanced.
  2. Click on button “Environment Variables”. This will open a window with two sets of variables – User and System. User variables are visible to your login only, while system variables are visible to anyone else who uses the system.
  3. Choose “New” to create ORACLE_HOME variable as either User or System variable, depending on how you want its visibility.
  4. Set its value to the Oracle directory.
  5. Click OK to save.
  6. Verify through a new command line session that the value has been set correctly.


How to set oracle_home path? Unix or Linux Server

You can also check and set the ORACLE_HOME path on unix or linux server. The first step is to check the ORACLE_HOME.

Command to use :

env | grep ORACLE_HOME

If the path is not set then you will get the following error.

SQL> @%ORACLE_HOME%\RDBMS\ADMIN\SCOTT.sqlSP2-0310: unable to open file "%ORACLE_HOME%\RDBMS\ADMIN\SCOTT.sql"

If you get above error then you require to set the ORACLE_HOME using following Steps.

Step 1 : Open the linux/unix operating system command prompt.

Step 2 : Use following commands to set the ORACLE_HOME and ORACLE_SID are set properly.

Command 1 : (bash or ksh) export ORACLE_SID=orcl

Command 2 :csh or tcsh) setenv ORACLE_SID orclYou can set these with the scripts coraenv (for the C shell) and oraenv (for other shells). These scripts are typically located in the /usr/local/bin directory.

Step 3 : Check and Ensure that the ORACLE_HOME/BIN directory in environment variable path.

Step 4 : Command to use,

export ORACLE_HOME=/app/oracle/product/11.1.0.6/server

How to change setting of ORACLE_HOME?

There is need to edit or delete the ORACLE_HOME. These kind of situation occurs when there is need to install multiple oracle installations. You require to follow the same steps and only you need to click on Edit or Delete button accordingly in Windows.

In Linux system also you can also edit profile file for your default shell in home directory. Example : /home/oracle , so that these environment variables are set every time you log in as that user.

I hope you get clear idea about – How to set oracle_home path? in detail .If you like this article or if you have any issues with the same kindly comment in comments section.

Amit S

Oracle Consultant with vast experience in Oracle BI and PL/SQL Development. Amiet is the admin head of this website who contributes by preparing tutorials and articles related to database technologies. He is responsible to manage the content and front-end of the website.

Recent Posts

What is Root Cause Analysis (RCA) With real examples

In my previous article I have given details about application support engineer day to day…

4 weeks ago

Application Support Engineer Day to day responsibilities

In my previous articles I have given the roles and responsibilities of L1,L2 and L3…

1 month ago

What is mean by SLA ( Service Level Agreement) with Examples?

In my previous articles i have given the hierarchy of production support in real company…

1 month ago

What is Production support Hierarchy in organization?

In this article i would like to provide information about production support organization structure or…

1 month ago

What are roles and responsibilities for L3 Support Engineer?

In my previous article I have given roles for L1 and L2 support engineer with…

1 month ago

What are roles and responsibilities of L2 Engineer?

I have started this new series of how to become application support engineer. This article…

1 month ago