Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

grep fine selection 1

Status
Not open for further replies.

Gloups

IS-IT--Management
Sep 16, 2003
394
FR
Hi all


I'm using a shell script on an AIX box to stop my oracle Databases.

To test if oracle is runing for specific instance, i use commands like:

export ora_proc=`ps -edf | grep pmon | grep $ORACLE_SID | grep -v grep`


But for fex days i have two new oracle instances named like XXXXX and XXXXXPP. So when i grep XXXXX i have two replies XXXXX and XXXXXPP instead of the only instance i want to stop. The script stop the two instances anf i dont want that.


I tried to use egrep -x to solve my problem but for the moment it still remain.

What should i use to get my script run correctly ??

I'm sure script masters will have a reply.

Thank's in advance
 
Can you post the output of this command ?
ps -edf | grep pmon

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
oracle 29160 1 0 15 fév - 0:00 ora_pmon_FARRSBPP
oracle 44274 1 0 09:50:02 - 0:00 ora_pmon_FARRSB
 
You may try this:
export ora_proc=`ps -edf | awk '/pmon/ && /'$ORACLE_SID'/ && $NF!~/PP$/'`

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thank's but my script have to be a generic script not dependending on the instance name then, i can't filter on XXXX and excluding XXXXPP.

If the instance i want to stop is ABCDE i should only stop ABCDE and not thinking about others instance names even if i have XXABCDE or ABCDEXX
 
And this ?
[tt]export ora_proc=`ps -edf | awk '$NF=="ora_pmon_'$ORACLE_SID'"'`[/tt]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top