Property from structered lines (/etc/oratab) for ORACLE version

(imported topic written by MartinZ91)

Hi

We try to find the running Oracle version on different OS. I think we’ll do 2 different properties for Windows and Unixes, because the if-clause in relevance might get to complex.

The windows-property will look at some registry values, I use the analysis posted here in the forum (thanks for that!)

For the Unix-property I want to analyse the files /etc/oratab on each machine running the database. Those files have lines in the following structure

SID:path:flag (the colon separates the 3 fields)

(there are normally also some comment lines starting with “#” which should be ignored)

I found a way to get the first field (SID - system ID) and the last field (the flag which can be Y or N for running or not running at boot time) with relevance. I’m a using “text preceding” rsp. “text following” clause

But how to get the middle field, the ORACLE_PATH?

Any help appriciated, thanks

Martin

(imported comment written by jessewk)

Martin,

Try:

substrings separated by “:” of lines whose (it contains “:” AND it does not start with “#”) of file “/etc/oratab”

(imported comment written by MartinZ91)

jessewk,

thanks. I tried that just now and got three answers (correct since there are 3 fields in the lines), it looks like follows in QnA:

q: (substrings separated by “:” of lines whose (it contains “:” AND it does not start with “#” AND it does not end with “N”) of file “e:\oratab”)

A: IMD

A: /oracle-imd-path

A: Y

T: 0.514 ms

I: plural substring

But now how to access just the second field? I want to use that PATH in the relevance clause to find files and there versions, so I need to get it as a singluar string I assume

Martin

(imported comment written by jessewk)

Hi Martin,

I should have read your post more carefully. Substrings won’t help you if you need to access a specific field.

You can try this:

preceding texts of firsts “:” of following texts of firsts “:” of lines whose (it contains “:” AND following text of first “:” of it contains “:” AND it does not start with “#”) of file “/etc/oratab”

-Jesse

(imported comment written by jessewk)

I’ll go for bonus points…

(
"SID: " & preceding text of first “:” of it & ", Path: " & preceding text of first “:” of following text of first “:” of it & ", Flag: " & following text of last “:” of it
)
of lines
whose
(
it does not start with "#"
AND
number of substrings separated by “:” of it = 3
)
of file “/etc/oratab”

Answer: SID: IMD, Path: /oracle-imd-path, Flag: Y

(imported comment written by MartinZ91)

jessewk,

Thank You, You’ll get the bonus points - it does what I think it should

Martin