Monday, January 5, 2009

Something about Oratab -:

Oratab is a colon-delimited text file on Unix and Linux systems that associates ORACLE_SID and ORACLE_HOME values.

The last field contains a "Y" or "N" for database startup when the machine boots up. One can also use hashes (#) to start comment lines.

This file is either found in the /var/opt/oracle or the /etc directories.

Scripts like oraenv, dbhome, dbstart and dbshut use the oratab file.


==========================================================
Sample oratab file
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.
# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME::
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/opt/oracle/product/10.2.0/db_1:Y

------------------------------------------------------------------
The above oratab file describes an Oracle instance called orcl
(don't confuse this with the database name!) that uses directory /opt/oracle/product/10.2.0/db_1 as its Oracle home.
The Y indicates that this database should be started when the system boots up.


-----------------------------------------------------------------------------------


What is Oratab and what it is used for ?


"oratab" is a file created by Oracle in the /etc or /var/opt/oracle directory when installing database software. Originally ORATAB was used for SQL*Net V1, but lately is's being used to list the databases and software versions installed on a server.
This file may contain comments staring with a pound signs (#) in column one, and data lines consisting of entries in the following format:
database_sid:oracle_home_dir:Y|N
- database_sid is the system id (SID) of an Oracle instances on the server.
- Oracle_home_dir is the ORACLE_HOME directory associated with this instance.
- The Y|N flags indicate if the instance should automatically start at boot time (Y=yes, N=no).
Besides acting as a registry for what databases and software versions are installed on the server, ORATAB is also used for the following purposes:
o Oracle's "dbstart" and "dbshut" scripts use this file to figure out which instances are to be start up or shut down (using the third field, Y or N).
o The "oraenv" utility uses ORATAB to set the correct environment variables.
o One can also write Unix shell scripts that cycle through multiple instances using the information in the oratab file.

There is no harm in manually creating the oratab file.

When you install Oracle, the last step is to run "root.sh". One of the things that
this script does is to create oratab. It would be good to check to see if "root.sh"
(in $ORACLE_HOME) had been executed, because besides creating oratab it also
sets a number of file permissions correctly.
Note : If you have installed a patchset after installing the base oracle release, the
patchset would have created a new root.sh. Check the old and the new ones.

Another note : If you have multiple Oracle installations (seperate Oracle_Homes),
there is no harm in running root.sh from each OracleHome. If an oratab file exists,
the root.sh script merely appends to it with the entry for the additonal SID and
Oracle_Home.

No comments:

Post a Comment

Followers

About Me

My photo
N.Delhi, Delhi, India
I am an Oracle Certified Professional, Oracle 9i/10G DBA, having 4+ years of core DBA experience.