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.
- What is mean by ORACLE_HOME and What is Purpose of it?
- How to check the ORACLE_HOME setting
- How to set ORACLE_HOME path
- How to change setting of oracle home or how to delete or change oracle home
Purpose of ORACLE_HOME:
- ORACLE_HOME is a directory name which will come at the time of Oracle software installation.
- The specified directory path of ORACLE_HOME directory is been stored in an environment variable.
- 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:\.
- 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.
- The ORACLE_HOME file will always used to ensure the correct oracle version is accessed running against the database.
- 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,
- Go to Control Panel -> System -> Advanced.
- 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.
- Choose “New” to create ORACLE_HOME variable as either User or System variable, depending on how you want its visibility.
- Set its value to the Oracle directory.
- Click OK to save.
- 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 orcl
You 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.