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;
- Export from 11g and import to 19c
- Manual Reinstate old Primary Using Flashback
- How to reinstate the old Primary as a Standby after Failover in Oracle
- Oracle Dataguard Switchover with broker
- Oracle 19c Dataguard setup with PDB
- Delete RMAN Backups
- Why do we use FAL_SERVER and FAL_CLIENT parameters in Oracle dataguard
- How to Recover lost datafile with no backup
- Oracle RMAN Backup Types
- Rman full database backup script
Nice article Shripal, thanks for sharing.