• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

Oracle Interview Questions – oratab file

by admin

Oracle provides a mechanism for automatically setting the required OS variables. This approach relies on two files: oratab and oraenv. 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
  • Automating the start and stop of Oracle databases on the server

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).

This post discusses some of the most commonly asked interview questions related to the oratab file.

How to locate the oratab file?

You can search for oratab file using the following UNIX command:

$ find / -name oratab

The oratab file is normally located in the:
– /var/opt/oracle directory for Solaris platform
– /etc directory for most of the other platforms

If the oratab file could not be found, you can recreate the file using any text editor just like vi or gedit. The oratab file contains comments in Unix-style leading pound signs (#), and data lines consisting of entries in the following format:

database_sid:oracle_home_dir:Y|N

where:

  • 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.
  • Y|N flags indicate if the instance should automatically start at boot time (Y=yes, N=no).

How does oracle run without the oratab file?

Oratab is not absolutely essential for the functioning of the database. Oratab contains the oracle home associated with the SID. It is used for:

  • connecting remotely through sql*net v1 (outdated)
  • discovering nodes through OEM.
  • allow for auto start of the database through the dbstart script.
  • discovering instances for dbca operation

Why wasn’t it created when performing an oracle install?

Oratab is created when you run root.sh as root user, which is a shell script, updates/creates an 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.

Can I, with the assistance of root user, create the directory for oratab and then create a new oratab file in that directory?

Yes, you can create a /var/opt/oracle or /etc directory, depending on the platform. then create a new oratab file in that directory with root assistance. The oratab file format is as follows:

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:[N|Y]

The first and second fields are the system identifier and home directory of the database respectively. The third field 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. An $ORACLE_SID can be for a RDBMS instance, e.g. ‘v1120’, but also for an ASM instance, e.g. ‘+ASM’.

Sample oratab file:

#Backup file is /u01/app/oracle/product/11.2.0/dbhome_1/srvm/admin/oratab.bak.fabrie2-nl line added by Agent
#

# 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.
#
#
+ASM:/u01/app/oracle/product/11.2.0/grid:N
v1120:/u01/app/oracle/product/11.2.0/dbhome_1:N # line added by Agent

Filed Under: Interview Questions, oracle

Some more articles you might also be interested in …

  1. Types of Workload Distribution (Load Balancing) in Oracle RAC
  2. Adding Users to Oracle Passwordfile (Oracle Passwordfile Authentication)
  3. Oracle Data Guard – Tempfiles created at primary are not automatically created at standby
  4. Oracle Database – Configuring Secure Application Roles
  5. Oracle GoldenGate: Pump (Extract) Sample Parameter File
  6. How to Start/Stop/Relocate SCAN listener in Oracle 11gR2 RAC
  7. Deleting duplicate records from a table
  8. New Background Processes In Oracle Database 10g
  9. How to Force ASM to Scan the Multipathed Device First using ASMLIB/oracleasm
  10. How to change max_string_size value from STANDARD to EXTENDED

You May Also Like

Primary Sidebar

Recent Posts

  • nixos-rebuild Command Examples in Linux
  • nixos-option: Command Examples in Linux
  • nixos-container : Command Examples in Linux
  • nitrogen Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright