In this article, we will know how to find PID by SID in oracle. To know about PID, we need to exucute the sql query to identify.
On daily basis we are checking the os pid from sid to check the performance issue. Some time user session got hung or blocked any objects and that is no longer required. So we have to identify the os pid from sid to kill the session.
Use Below Query to find out OS PID using SID in oracle.
select s.sid,s.serial#,p.spid os_pid,s.status, s.osuser ,s.username, s.COMMAND,s.MACHINE,s.MODULE, s.SCHEMANAME,s.LOCKWAIT,s.action from v$session s, v$process p WHERE s.paddr = p.addr and s.sid =&SID
If you have requirement to kill those session in database level, you may do it as below.
alter system kill session '240,4565';
In order to kill os pid, use command as below.
$kill -9 <os_pid>
- How to Create Oracle Wallet to Secure External Password Store
- Unable to Authenticate Session in EBS R12