Re: AIX question

From: Andrew Kerber <andrew.kerber_at_gmail.com>
Date: Wed, 4 Jun 2014 08:50:25 -0500
Message-ID: <CAJvnOJY213-0bJKed_DELeuYDD_DR=aAusQdDJWdb9zJ_Enngg_at_mail.gmail.com>



That one got it, with a slight change for AIX:

for ORACLE_SID in `ps -eo="CMD" | egrep -i '(ora|xe)_pmon' | awk '{tst = substr ($1, 1,4) ;

                if (tst != "grep") {
                  if ( tst != "ora_" )
                     print substr($1,9,length ($1) )
                  else
                     print substr($1,10,length ($1) )
                }
             }' | sort;`

do

Thanks very much.

On Tue, Jun 3, 2014 at 9:28 PM, De DBA <dedba_at_tpg.com.au> wrote:

> I use this (linux, GNU awk) to list running instances:
>
> ps -eo cmd | egrep -i '(ora|xe)_pmon' | awk '{tst = substr ($1,
> 1,4) ;
> if (tst != "grep") {
> if ( tst != "ora_" )
> print substr($1,9,length ($1) )
> else
> print substr($1,10,length ($1) )
> }
> }' | sort;
>
>
> Hth,
> Tony
>
>
> On 04/06/14 12:12, Andrew Kerber wrote:
>
>> I have a script that runs the loop below:
>>
>> for ORACLE_SID in `ps -e -o="CMD" | grep smon|grep -v grep| awk -F "_"
>> '{print$3}'`
>> do
>> ....
>> done
>>
>> The problem that just came up is a rac one node instance, where the
>> ORACLE_SID is orcl_1 or orcl_2
>>
>> So the script above, in a standard rac instance would find orcl1 or
>> orcl2, which is what I want. But with Rac one node, and the underscore in
>> the name it just extracts orcl, when I need to extract orcl_1.
>>
>> Can one of you scripting gurus show me a corrected version of that for
>> loop that gets the correct ORACLE_SID?
>>
>>
>>
>> --
>> Andrew W. Kerber
>>
>> 'If at first you dont succeed, dont take up skydiving.'
>>
>
>

-- 
Andrew W. Kerber

'If at first you dont succeed, dont take up skydiving.'

--
http://www.freelists.org/webpage/oracle-l
Received on Wed Jun 04 2014 - 15:50:25 CEST

Original text of this message