RE: How to derive the process ID of its own session?

If you are interested in the OS foreground process then see the following 
article:

Is there a way to trace a unix process id to a SID and SERIAL# ? 
http://www.jlcomp.demon.co.uk/faq/sid_from_proc.html

The article is going the other way, from pid to sid, but the information you 
need is identified in the covered material.   


HTH -- Mark D Powell --

-----Original Message-----
From: Peter Teoh [mailto:htmldeveloper@xxxxxxxxx]
Sent: Sat 2/23/2008 10:11 AM
To: Powell, Mark D
Cc: oracle-l@xxxxxxxxxxxxx
Subject: Re: How to derive the process ID of its own session?
 
On Fri, Feb 22, 2008 at 10:32 PM, Powell, Mark D <mark.powell@xxxxxxx> wrote:
>
>  Note if the complete query that errored with ORA-01427 was something
>  like
>
>  select paddr from v$session
>  where sid = (select sid from v$mystat where rownum = 1)
>
>  It can be fixed by adding
>  and rownum =1
>  as the third line
>
>  Normally, if dedicated sessions are used, only one session will exist
>  for a specific process however Oracle will use a second session to run
>  recursive SQL so you can sometimes get two sessions for a background
>  process.
>
>  -- Mark D Powell --
>  Phone (313) 592-5148
>

Thank you for the answer, it is more surprising than I thought.   But
the spid I was looking for was the foreground OS process which I
thought should not be shared right?   Ie, different foreground process
using the same background process in a shared server scenario -
correct?

Other related posts: