Databases Reference
In-Depth Information
The ORACLE_HOME variable is also important because it defines the starting point directory for locating the Oracle
binary files (such as sqlplus , dbca , netca , rman , and so on) that are in ORACLE_HOME/bin .
The ORACLE_SID variable defines the default name of the database you're attempting to create. ORACLE_SID is also
used as the default name for the parameter file, which is init<ORACLE_SID>.ora or spfile<ORACLE_SID>.ora .
The LD_LIBRARY_PATH variable is important because it specifies where to search for libraries on Linux/Unix
boxes. The value of this variable is typically set to include ORACLE_HOME/lib .
The PATH variable specifies which directories are looked in by default when you type a command from the OS
prompt. In almost all situations, ORACLE_HOME/bin (the location of the Oracle binaries) must be included in your PATH
variable.
You can take several different approaches to setting the prior variables. This chapter discusses three, beginning
with a hard-coded manual approach and ending with the approach that I personally prefer.
A Manually Intensive Approach
In Linux/Unix, when you're using the Bourne, Bash, or Korn shell, you can set OS variables manually from the OS
command line with the export command::
$ export ORACLE_HOME=/u01/app/oracle/product/12.1.0.1/db_1
$ export ORACLE_SID=o12c
$ export LD_LIBRARY_PATH=/usr/lib:$ORACLE_HOME/lib
$ export PATH=$ORACLE_HOME/bin:$PATH
For the C or tcsh shell, use the setenv command to set variables:
$ setenv ORACLE_HOME <path>
$ setenv ORACLE_SID <sid>
$ setenv LD_LIBRARY_PATH <path>
$ setenv PATH <path>
Another way that DBAs set these variables is by placing the previous export or setenv commands into a
Linux/Unix startup file, such as .bash_profile , .bashrc , or .profile . That way, the variables are automatically set
upon login.
However, manually setting OS variables (either from the command line or by hard-coding values into a startup
file) isn't the optimal way to instantiate these variables. For example, if you have multiple databases with multiple
Oracle homes on a box, manually setting these variables quickly becomes unwieldy and not very maintainable.
Oracle's Approach to Setting OS Variables
A much better method for setting OS variables is use of a script that uses a file that contains the names of all Oracle
databases on a server and their associated Oracle homes. This approach is flexible and maintainable. For instance, if
a database's Oracle home changes (e.g., after an upgrade), you only have to modify one file on the server and not hunt
down where the Oracle home variables may be hard-coded into scripts.
Oracle provides a mechanism for automatically setting the required OS variables. Oracle's approach relies on two
files: oratab and oraenv .
Understanding oratab
You can think of the entries in the oratab file as a registry of what databases are installed on a box and their
corresponding Oracle home directories. The oratab file is automatically created for you when you install the Oracle
software. On Linux boxes, oratab is usually placed in the /etc directory. On Solaris servers the oratab file is placed
 
Search WWH ::




Custom Search