Kill Duplicated Process by shell in crontab

Hi!

I need your help, please.

I'm in AIX node and sometimes listener process from an oracle instance gets duplicated, i mean that it get spawned a second listener process. As we can't apply changes to the databases on this months, i want to build a shell that can identify the second listener (when it appears) and kill it.

Anyone can help me?

PS: Sorry about english, i'm from south america :slight_smile:

What version of Oracle. What Operating System and version? Which Shell?

Don't issue unix "kill" to Oracle processes.

Check whether the listener shows up in a "lstnrctl" command.
Lsnrctl - Oracle FAQ

Hi, thx for asking.

In this node there are four oracle 10g instances. The problem with the second listener is don't allow external connections. That problem is a bug for the version 10.2.0.2.

I can't make changes to the databases, but what i can do is build a shell to identify when a second listener process is running (every 10 minutes) but i don't know how to do it.

How do i know when is a second listener process? I received from ussers the errors on external connections, so i connect to the node (AIX 64-bits) and make a ps -fea|grep tns, where i found two listener process. So i kill one of them (the newest).

What i want is automatize that. Can you help me? Thanks!

There is an Oracle temporary fix mentioned in this blog (and many other blogs).
Solaris Mike R's Blog

Please mention what Shell you use for administrative scripts (ksh?) and post the output from :

ps -fea|grep tns

ps -ef|grep "tnslsnr"

ps -fu oracle | grep "tnslsnr"

Just want to be sure of the order of fields in your "ps" and whether the main Listener is correctly started in background and therefore has a PPID of 1 . Also looking for a "ps" command which is less likely to give accidental matches.

Do you take your databases (and listener) down at night for backup? If so, consider what commands might be visible in memory at the time (and which we don't want to kill).

Thanks por replying.

We used sh for administrative scripts

$ ps -fea|grep tns
oracle10 1175748       1   7   Dec 09      - 123:33 /oracle10g/oracle/product/10.2.0/db_1/bin/tnslsnr LISTENER -inherit
oracle10 1339466 1605770   0 12:07:31  pts/0  0:00 grep tns
$ ps -ef|grep "tnslsnr"
oracle10 1175748       1   5   Dec 09      - 123:33 /oracle10g/oracle/product/10.2.0/db_1/bin/tnslsnr LISTENER -inherit
oracle10 1679534 1605770   0 12:07:42  pts/0  0:00 grep tnslsnr
$ ps -fu oracle | grep "tnslsnr"
$

At this time, there is not a duplicate listener, and if occured i'll take a screenshot. But usually whe there is a second listener is below the onde who appears in the ps detailed above, with recent date and time, so that's the one i want to kill, when it appears, obviously.

Thanks again!! :b:

You probably need something like this. Test throughly before removing the "echo" and be careful about running this when the system is starting or stopping the listener normally.

ps -fu oracle10 | grep "tnslsnr" | grep -v "grep" | awk '{print $2,$3}' | \
     while read pid ppid
     do
           if [ $ppid -eq 1 ]
           then
                 continue
           fi
           echo kill ${pid}
     done

Thanks! :slight_smile: I will test it tomorrow. I let you know how it goes.

Thanks Again! :b: