How to find PID for setospid in oradebug?
Doc ID: Note:105395.1

PURPOSE

The purpose of this bulletin is to instruct the user how to
get the correct pid for the oradebug command:

oradebug setospid

SCOPE & APPLICATION

This bulletin is directed to anyone using oradebug, possibly
to troubleshoot hanging issues.

How to Find the Right PID for oradebug setospid

There are ways to find the correct os pid from the Oracle
database, by querying v$session and v$process, but this method
gets the information strictly from the os.

1) At the Unix prompt, type who am i. For example:

[tiger5]/app/oracle/product/8.1.6> who am i
kfarmer pts/25 Apr 13 10:37 (rociblj-ppp-9.us.oracle.com)

Take note of the terminal, in this case pts/25.

2) Start server manager and connect internal.

[tiger5]/app/oracle/product/8.1.6> svrmgrl

Oracle Server Manager Release 3.1.6.0.0 – Production

Copyright (c) 1997, 1999, Oracle Corporation. All Rights Reserved.

Oracle8i Enterprise Edition Release 8.1.6.0.0 – Production
With the Partitioning option
JServer Release 8.1.6.0.0 – Production

SVRMGR> connect internal
Connected.

3) Issue this command from svrmgrl:
!ps -ef | grep svrmgrl

Your output will look something like this:

SVRMGR> !ps -ef | grep svrmgrl
kfarmer 3705 25983 0 15:27:52 pts/25 0:00 svrmgrl
kfarmer 2504 24262 0 14:43:57 pts/18 0:00 svrmgrl
kfarmer 3759 3757 0 15:29:52 pts/25 0:00 grep svrmgrl
jharwell 28026 27944 0 16:42:25 pts/17 0:00 svrmgrl

Look for the terminal that matches your terminal from the ‘who am i’
command. Note the pid that goes with it, in this case 3705. There will
be another process connected with this terminal, too, but that is the
grep, not server manager.

4) Issue this command from svrmgrl:
!ps -ef | grep 3705
Your output will look something like this:
SVRMGR> !ps -ef | grep 3705
oracle 3706 3705 0 15:27:52 ? 0:00 oracleV816 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
kfarmer 3705 25983 0 15:27:52 pts/25 0:00 svrmgrl
kfarmer 3856 3705 0 15:33:37 pts/25 0:00 [ sh ]
kfarmer 3859 3857 0 15:33:37 pts/25 0:00 grep 3705
5) Look for a process that has a parent process of 3705. There are 2 here.
One is 3706, a sqlnet connection, and 3856, a shell. In this case, I’m
searching for the sqlnet connection which is running svrmgrl, process
3706. This is the pid I would use for my oradebug setospid command:

oradebug setospid 3706