Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Processes/users blocking shutdown

Re: Processes/users blocking shutdown

From: Richard B. Kreckel <richard.kreckel_at_framatome-anp.com>
Date: 1 Oct 2003 09:37:04 -0700
Message-ID: <fdf52b9b.0310010837.359577b7@posting.google.com>


Daniel Morgan <damorgan_at_x.washington.edu> wrote in message news:<1064930417.825158_at_yasure>...
> Richard B. Kreckel wrote:

[...]
> >There sure must be an easy way to find out if someone is connected to
> >the database?
> >
> SELECT from v_$session.

Oh, thanks!

This, however, raises an interesting question: There are several sessions in the view v$session. If I want to query all these sessions but excluding the session doing the query itself, how can I do this?

Well, there is v$process, and there is a one-to-one relationship between v$process.addr and v$session.paddr. However, on a Unix system (Linux, actually), v$process.spid refers to the PID of the oracle child process of the session while v$session.process refers to the PID of the session itself.

So it is not possible to fetch the PID by querying SELECT p.spid FROM v$session s, v$process p WHERE p.addr=s.paddr AND ... and exclude that value from a query to v$session.process.

Subtracting one from v$process.spid is no solution, since other processes might have spawned in the meantime.

Is there another way to fetch the PID of the current session?

TIA
  -richy.

--
Dr. Richard B. Kreckel
Framatome ANP GmbH, NGLTS
<Richard.Kreckel_at_Framatome-ANP.COM>
Tel: (+49)9131/189-5275, Fax: (+49)9131/189-9908
Received on Wed Oct 01 2003 - 11:37:04 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US