The Oratab Script

I recently wrote a Python scrip for parsing the Oracle oratab file and printing out the contents in a clean, easy to read format. I’ve found the script to be very useful and more convenient than grepping through the raw oratab file for what I’m looking for. Today, I added some pretty nifty features by way of command line options and decided I’d go ahead and put it up here for anyone interested. The help (-h) option is pretty self explanatory so I won’t be going into further detail here. I’ll simply show the usage and some sample output. Take it for a spin and post some feedback.

The script is called “oratab” and can be downloaded from Github.com at DBA Scripts.

Here is the usage and a few samples…

> oratab -h
usage:

-----------------------------------------------------------
Report Contents of the Oratab File.

options:
 -h, --help show this help message and exit
 -d report distinct oracle homes found
 -i report only invalid oracle homes
 -r show the restart flag
 -t terse report format
 -v report only valid oracle homes
 --v print version info.

Listing #1 – Default Output

> oratab

Oratab File: /etc/oratab

Oracle SID           Oracle Home
-------------------- ------------------------------------------------------------
+ASM1                /u01/app/12.1.0.2/grid
-MGMTDB              /u01/app/12.1.0.2/grid
ASCFIN               /u01/app/oracle/product/11.2.0.4/dbhome_1
ASCFIN1              /u01/app/oracle/product/11.2.0.4/dbhome_1
ASCSYM               /u01/app/oracle/product/11.2.0.4/dbhome_1
ASCSYM1              /u01/app/oracle/product/11.2.0.4/dbhome_1
CSM                  /u01/app/oracle/product/11.2.0.4/dbhome_1
CSM1                 /u01/app/oracle/product/11.2.0.4/dbhome_1
ILTESTP              /u01/app/oracle/product/11.2.0.4/dbhome_1
OGGBDA               /u01/app/oracle/product/12.1.0.2/dbhome_1
OGGBDA1              /u01/app/oracle/product/12.1.0.2/dbhome_1
DBM01                /u01/app/oracle/product/12.1.0.2/dbhome_1
DBM011               /u01/app/oracle/product/12.1.0.2/dbhome_1
DEMO12               /u01/app/oracle/product/12.1.0.2/dbhome_1
DEMO121              /u01/app/oracle/product/12.1.0.2/dbhome_1
ENT                  /u01/app/oracle/product/12.1.0.2/dbhome_1
ENT1                 /u01/app/oracle/product/12.1.0.2/dbhome_1
ENT11                /u01/app/oracle/product/11.2.0.4/dbhome_1
ENT111               /u01/app/oracle/product/11.2.0.4/dbhome_1
ESIPOC               /u01/app/oracle/product/12.1.0.2/dbhome_1
ESIPOC1              /u01/app/oracle/product/12.1.0.2/dbhome_1
UPONOR               /u01/app/oracle/product/12.1.0.2/dbhome_1
UPONOR1              /u01/app/oracle/product/12.1.0.2/dbhome_1

Listing #2 – Distinct Oracle Homes

> oratab -d

Oratab File: /etc/oratab

Oracle Home
------------------------------------------------------------
/u01/app/12.1.0.2/grid
/u01/app/oracle/product/12.1.0.2/dbhome_1
/u01/app/oracle/product/11.2.0.4/dbhome_1

Listing #3 – Terse Format

> oratab -t
+ASM1                /u01/app/12.1.0.2/grid
-MGMTDB              /u01/app/12.1.0.2/grid
ASCFIN               /u01/app/oracle/product/11.2.0.4/dbhome_1
ASCFIN1              /u01/app/oracle/product/11.2.0.4/dbhome_1
ASCSYM               /u01/app/oracle/product/11.2.0.4/dbhome_1
ASCSYM1              /u01/app/oracle/product/11.2.0.4/dbhome_1
CSM                  /u01/app/oracle/product/11.2.0.4/dbhome_1
CSM1                 /u01/app/oracle/product/11.2.0.4/dbhome_1
ILTESTP              /u01/app/oracle/product/11.2.0.4/dbhome_1
OGGBDA               /u01/app/oracle/product/12.1.0.2/dbhome_1
OGGBDA1              /u01/app/oracle/product/12.1.0.2/dbhome_1
DBM01                /u01/app/oracle/product/12.1.0.2/dbhome_1
DBM011               /u01/app/oracle/product/12.1.0.2/dbhome_1
DEMO12               /u01/app/oracle/product/12.1.0.2/dbhome_1
DEMO121              /u01/app/oracle/product/12.1.0.2/dbhome_1
ENT                  /u01/app/oracle/product/12.1.0.2/dbhome_1
ENT1                 /u01/app/oracle/product/12.1.0.2/dbhome_1
ENT11                /u01/app/oracle/product/11.2.0.4/dbhome_1
ENT111               /u01/app/oracle/product/11.2.0.4/dbhome_1
ESIPOC               /u01/app/oracle/product/12.1.0.2/dbhome_1
ESIPOC1              /u01/app/oracle/product/12.1.0.2/dbhome_1
UPONOR               /u01/app/oracle/product/12.1.0.2/dbhome_1
UPONOR1              /u01/app/oracle/product/12.1.0.2/dbhome_1

The DBA Scripts project is a collection of scripts useful to Oracle DBA’s. I’ll be posting a series of blogs discussing the other scripts found in this Github project. In the meantime the help (-h) option should give you a pretty good idea of what they do and how to use them.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s