SQL> select b.sid, b.serial#, a.spid processid, b.process clientpid from v$process a, v$session b
where a.addr = b.paddr
and b.audsid = userenv(‘sessionid’);

SID SERIAL# PROCESSID CLIENTPID
———- ———- ——— ———
43 52612 420734 5852:5460

V$SESSION.SID and V$SESSION.SERIAL# are database process id
V$PROCESS.SPID – Shadow process id on the database server
V$SESSION.PROCESS – Client process id, on windows it is “:” separated the first # is the process id on the client and 2nd one is the thread id.

One response to “How to get current session id, process id, client process id?”

  1. Tom Avatar
    Tom

    improvment :
    >> and b.audsid = userenv(‘sessionid’);

    and s.audsid = SYS_CONTEXT (‘userenv’, ‘sessionid’);

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.