How To Set An Oracle Env. Variable - ORACLE - HOME?
How To Set An Oracle Env. Variable - ORACLE - HOME?
http://www.notesbit.com/index.php/scripts-oracle/how-to-set-an-oracle-environment-variable-
%E2%80%93-oracle_home/
* The ORACLE_HOME is an environment variable which is used to set and define the path
of Oracle Home (server) Directory.
* The ORACLE_HOME directory will have the sub directories, binaries,
executables, programs, scripts, etc. for the Oracle Database.
* This directory can be used by any user who wants to use the particular database.
* If the ORACLE_HOME variable is defined as an environment variable, then
during the installation process, the Oracle Home Path will be set to the directory
defined as default. If the variable is not defined, then the Oracle will take its own
default location. i.e. The ORACLE_HOME variable does not have to be preset as
an environment variable, it can be set during the installation process.
* Basically The ORACLE_HOME variable is in the following ORACLE_BASE
directory:
ORACLE_HOME=$ORACLE_BASE/product/10.2.0.
* The ORACLE_BASE is also an environment variable to define the base/root level directory
where you will have the Oracle Database directory tree – ORACLE_HOME defined under the
ORACLE_BASE directory.
* Basically, The ORACLE_BASE directory is a higher-level directory, than
ORACLE_HOME, that you can use to install the various Oracle Software Products and the
same Oracle base directory can be used for more than one installation.
Note: If you did not set the ORACLE_BASE environment variable before starting OUI, the
Oracle home directory is created in an app/username/directory on the first existing and writable
directory from /u01 through /u09 for UNIX and Linux systems, or on the disk drive with the
most available space for Windows systems. If /u01 through /u09 does not exist on the UNIX or
Linux system, then the default location is user_home_directory/app/username.
How to check if ORACLE_HOME is set already?
On Unix/Linux Systems:
Basically, before or after the Oracle Database is installed, the oracle user profile, the
environment variable file, is prepared where all the required environment variables for Oracle are
set. i.e. ORACLE_BASE, ORACLE_HOME, ORACLE_SID,PATH,
LD_LIBRARY_PATH, NLS_LANG, etc.
Note: This user profile file will be under user’s home directory i.e. $HOME/.bash_profile
$ echo $ORACLE_HOME
$ env
On Windows Systems:
OR
C:\echo %ORACLE_HOME%
C:\> set
Or
C:\> env
Start -> Run -> Regedit (enter) -> HKEY_LOCAL_MACHINE -> SOFTWARE –> ORACLE
i.e. My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE
On Unix/Linux Systems:
Define the ORACLE_HOME value in the user profile file i.e. .bash_profile or .profile
ORACLE_HOME=$ORACLE_BASE/product/10.2.0
export ORACLE_HOME
Bash shell:
$ . ./.bash_profile
$ . ./.profile
C shell:
% source ./.login
If no profile file is set with environment variables, then physically also be set as follows:
$ ORACLE_BASE=/oracle/app
$ export ORACLE_BASE
$ ORACLE_HOME=$ORACLE_BASE/product/10.2.0
$ export ORACLE_HOME
C Shell:
On Windows Systems:
My Computer -> Properties -> Advanced -> Environment Variables -> System Variables
-> New/Edit/Delete (to set the variables)
After setting the environment variables as above, open a fresh CMD tool and check whether they
set properly or not. Do not try on already opened CMD tool to make sure the variables set or not.
Another way to physically set the variables as follow at the DOS prompt: