Forum Stats

  • 3,757,778 Users
  • 2,251,265 Discussions
  • 7,869,915 Comments

Discussions

Reading Oracle Instance Names from /etc/oratab file

User_2V7CQ
User_2V7CQ Member Posts: 1 Employee

Hi Gurus,

I have oracle RAC setup and wanted to read database instance entries from /etc/oratab file Now I have put in the Instance SID for the databases DBTEST and DBQA.


/etc/oratab from Node 1 which is running 2 oracle instances DBTEST1 and DBQA1 and one ASM instance +ASM1

DBTEST1:/u02/app/oracle/product/18.0.0.0/dbhome_1:Y

DBTEST1_ord18t:/u02/app/oracle/product/18.0.0.0/dbhome_1:Y

DBQA1:/u02/app/oracle/product/18.0.0.0/dbhome_3:Y

DBQA1:_ord3m:/u02/app/oracle/product/18.0.0.0/dbhome_3:Y

+ASM1:/u01/app/19.0.0.0/grid:N


I need to extract the Oracleinstance Name from these oratab files. I am using the following command which is returning the instance name and database name.

cat /etc/oratab|egrep ':N|:Y'|grep -v \*|cut -f1 -d':'

DBTEST1

DBTEST1_ord18t

DBQA1

DBQA1:_ord3m

+ASM1


But i need the output as follows

DBTEST1

DBQA1

+ASM1

Please help me which the script or command which will give me the instance name only from the /etc/oratab file.