Database Reference
In-Depth Information
Using Oracle's Script
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. This 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
in the /var/opt/oracle directory. If, for some reason, the oratab file isn't automatically created, you can manually
create it (with a text editor).
The oratab file is used in Linux/Unix environments for the following purposes:
Automating the sourcing of required OS variables
The oratab file has three columns with this format:
Automating the start and stop of Oracle databases on the server
<database_sid>:<oracle_home_dir>:Y|N
The Y or N indicates whether you want Oracle to restart automatically on reboot of the box; Y indicates yes, and N
indicates no (the automatic restart feature requires additional tasks not covered in this topic).
Comments in the oratab file start with a pound sign ( # ). Here is a typical oratab file entry:
O12C:/orahome/app/oracle/product/12.1.0.1/db_1:N
ORA12CR1:/orahome/app/oracle/product/12.1.0.1/db_1:N
The names of the databases on the previous lines are O12C and ORA12CR1 . The path of each database's Oracle
home directory is next on the line (separated from the database name by a colon [ : ]).
Several Oracle-supplied utilities use the oratab file:
oraenv uses oratab to set the OS variables.
dbstart uses it to start the database automatically on server reboots (if the third field in
oratab is Y ).
dbshut uses it to stop the database automatically on server reboots (if the third field in
oratab is Y ).
The oraenv tool is discussed in the following section.
Using oraenv
If you don't properly set the required OS variables for an Oracle environment, then utilities such as SQL*Plus, RMAN,
Data Pump, and so on won't work correctly. The oraenv utility automates the setting of required OS variables (such as
ORACLE_HOME , ORACLE_SID , and PATH ) on an Oracle database server. This utility is used in Bash, Korn, and Bourne shell
environments (if you're in a C shell environment, there is a corresponding coraenv utility).
 
Search WWH ::




Custom Search