How to find the process ID in unix

sakthikumar
sakthikumar used Ask the Experts™
on
There are a set of tables locked in my ORACLE user, from a process run by Unix cron job.

From the list of information available in
v$locked_object a,
v$session b

How to find which process has locked these tables? So that I can kill the process from unix.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2013
Top Expert 2013
Commented:
Once you have a PID you can do in Unix:

ps -f -p PID

Author

Commented:
I only have SID from v$locked_objects
Most Valuable Expert 2012
Distinguished Expert 2018
Commented:
SID is Oracle not OS.

You need SPID from v$process.  Link that with v$session and v$locked_object to get it.

How to link v$sesssion and v$process can be found here:
http://www.nixblog.org/post/2008/03/14/UNIX-ID-ORACLE-SESSION
Topic Advisor
Most Valuable Expert 2016
Commented:
PROCESS (id) is in v$session as well, this query just as an example of link posted above:

select a.USERNAME, a.OSUSER, a.PROCESS, a.MACHINE, a.PROGRAM
from v$session a, v$locked_object b
where b.SESSION_ID=a.SID;

Author

Commented:
need to check

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial