What is Oratab
Oracle creates a record for each Oracle RAC database in the oratab configuration file. The oratab file is created by the root.sh script during installation and is updated by the Database Configuration Assistant (dbca) when creating or deleting a database.
In Linux, the file path is /etc/oratab and the sample contents of the oratab file are as follows.
The fields are separated by the sign (:). Sections starting with (#) are comments. There is a N or Y at the end of the line. These letters determine whether to start the database instance automatically when the server restarts. N means No and Y means Yes. Oracle’s “dbstart” and “dbshut” scripts use this file to find out which instances to start or stop.
1 |
$DB_UNIQUE_NAME:$ORACLE_HOME:N |
Sample Oratab Content
1 2 |
+ASM:/u01/app/12.2.0.1/grid:N # line added by Agent orcl:/u01/app/oracle/product/12.2.0/dbhome_1:N # line added by Agent |
What is Oratab used for
Oracle Enterprise Manager uses the oratab file to determine the name of the Oracle RAC database during service discovery and to determine whether the database is automatically started when the system restarts. Also, the information in the oratab file is used when loading environment variables with oraenv.
When setting variables with Oraenv, the value of ORACLE_SID will be set to $DB_UNIQUE_NAME in the line in the oratab file. This variable must be instance name in RAC databases. Therefore when you add a line to the oratab file as below, all variables will be set as normal.
1 |
orcl1:/u01/app/oracle/product/12.2.0/dbhome_1:N |
Then, when you set the variables with oraenv, ORACLE_SID will be set to orcl1. Otherwise, the instance name of the RAC database on the node to which you are connected will not be set correctly.
When you create a new database via DBCA with the name of an old database remaining in the oratab file, it will ask you to give it a different name than the record in the oratab file. When you have problems like this, dbca will not cause problems when you delete the related line from the oratab file.