How to Identify OS PID from SID in Oracle Database

Identify OS PID from SID

We want to find out OS PID against sid in the Oracle database to check the performance related to OS and Database. In the Linux platform, every process has its process ID (PID) and a user can easily get PID from SID (Identify OS PID from SID).

Query to check PID from sid in Oracle

Using the below query you will get PID against SID in the oracle database.

Set lines 300
col sid format 9999
col username format a20
col osuser format a20

select a.sid, a.serial#,a.username, a.osuser, b.spid
from v$session a, v$process b
where a.paddr= b.addr
and a.sid='&Enter_sid'
order by a.sid;

How to Identify SID Based on OS PID in Oracle

To perform database performance like CPU, MEMORY, AND I/O we need to check SID against OS PID (process ID).

Query To Check SID From OS PID

After getting the SID, you can check the sql_id in the database using v$session and also find SQL text using v$sql view in the database.

col sid format 9999
col username format a22
col osuser format a18

select p.spid,s.sid, s.serial#,s.username, s.osuser
from gv$session s, gv$process p
where s.paddr= p.addr
and p.spid='&Enter_spid'
order by p.spid;

One thought on “How to Identify OS PID from SID in Oracle Database

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top