Operating System - HP-UX
1832574 Members
5776 Online
110043 Solutions
New Discussion

How to kill a process by ip address

 
SOLVED
Go to solution
Randy Hagedorn
Regular Advisor

How to kill a process by ip address

Hi,

I have a PL/SQL script running on a Windows XP box that is connected to Oracle on HP-UX and appears to be running away, so would like to kill it. We used PL/SQL Developer to kill it, but it still will not go away.

Now I would like to try to find it on the HP-UX side and try to kill it from there. When I do a ps -ef | grep -i oracle, I can not differentiate which PID that we can kill.

Is there a method to associate an IP address to a PID and kill the PID? Is there any other way to kill a single network session on HP-UX?

Thanks in advance,
Huggy
7 REPLIES 7
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: How to kill a process by ip address

Howdy Huggy:

First you need to download and install the lsof utility.

http://gatekeep.cs.utah.edu/hppd/hpux/Sysadmin/lsof-4.67/

Next, invoke lsof looking for a specific ip address and also "oracle".

e.g.

lsof -i -n | grep "oracle" | grep "65.12.77.123"

That should yield a line with a process id which you can feed to kill.

The -n option instructs lsof to suppress hostname to ip address translation since you specifically asked for ip address.


That should get you started, Clay
If it ain't broke, I can fix that.
Randy Hagedorn
Regular Advisor

Re: How to kill a process by ip address

Hi Clay,

Is there a version of lsof for 64-bit O/S? The version I installed, seems to be for 32-bit HP-UX.

Thanks for your help anyway.
Huggy
A. Clay Stephenson
Acclaimed Contributor

Re: How to kill a process by ip address

I think some guys on the Forums have compiled and made available a 64-bit version of lsof but it's very easy to download the source and compile/link your own. That is what I do.
If it ain't broke, I can fix that.
Sandro Schaer_2
Occasional Advisor

Re: How to kill a process by ip address

hi

why would you kill a unix session rather than the oracle session itself ??

find out the hostname of your xp box by using 'hostname' in a cmd shell.

next connect to the database as dba.

select sid,serial# from v$session
where machine='windows xp box';
alter system kill session 'sid,serial#'


twang
Honored Contributor

Re: How to kill a process by ip address

I run cronjob to kill session which runing Long SQL(> 2 hrs):
select 'alter system kill session '||''''||s.sid||','||s.serial#||''';' "SS"
from v$session s, v$process p
where type='USER'
and p.addr=s.paddr
and status != 'KILLED'
AND LAST_CALL_ET > 60*60*2
order by last_call_et desc;
Stefan Farrelly
Honored Contributor

Re: How to kill a process by ip address

You can download a 64bit version of lsof here;

ftp://ftp.fu-berlin.de/pub/unix/tools/lsof/binaries/hpux/B.11.00/vxfs/64/9000_800/

Im from Palmerston North, New Zealand, but somehow ended up in London...
Pete Randall
Outstanding Contributor