Friday, July 20, 2012

What's the meaning of the asterisk in Oracle's ORATAB file?


The perplexing asterisk is something Oracle DBAs have all seen when editing /etc/oratab for years.  But how many are old enough to know what it means, and more importantly if it is still required, and what it should be set to, especially when multiple ORACLE_HOMEs are used.

It's somewhat pleasing that I haven’t seen it in any installations lately but it remains on some machines where prior Oracle versions were installed and have been upgraded.

The best suggestion I found from searching the web was to look in the oraenv script.  From the header of the script…  An asterisk '*' can be used to refer to the NULL SID.  So now you know. J  And if your're like me you’re still just as confused.  Join the club.  Nothing in the oraenv script actually does anything with it.

There is some further information in the dbhome script.  It actually uses it, and when explicitly passed a "" (i.e. dbhome "") then you are returned the ORACLE_HOME matching the line with the asterisk.   But oraenv won't accept the "" so it’s pretty academic.

A web search for “NULL SID” offers some better insights.  It returned Oracle 7 document where it stated that a NULL SID was not supported by SQLNET V2.  So it looks like it was something use back in the very early oracle versions before the ORACLE_SID was introduced to identify a database, and something that hasn't been used for years.

So, what should you do when you find a line with an asterisk in an oratab file?  Remove it and stop the confusion.

1 comment:

Jeff Markham said...

Actually, I ensure that each of my oratab files *has* the asterisk entry.

Why? There are many times when I login to a database server and want set the oracle environment for a quick query. I don't want to have to think about what instances are running on the server or look at /etc/oratab. I just want *some* Oracle Home set.

The asterisk entry is also pretty useful (IMO) for shell scripts. If you are deploying general administration scripts across multiple servers, then they need *some* Oracle Home and all they need to do is search for the asterisk entry.

Obviously, if I'm doing something that might be Oracle version-specific, then I use the instance-specific oratab entry. That keeps me from running the wrong $ORACLE_HOME/rdbms/admin script against a database which is using a "not the default" Oracle Home.