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

Home -> Community -> Usenet -> c.d.o.server -> Re: what query to ID the specific DBMS session?

Re: what query to ID the specific DBMS session?

From: Brian Peasland <dba_at_nospam.peasland.net>
Date: Thu, 03 May 2007 09:39:12 -0500
Message-ID: <4639e7b4$0$16381$88260bb3@free.teranews.com>


joeNOSPAM_at_BEA.com wrote:

> On May 2, 1:46 pm, "fitzjarr..._at_cox.net" <fitzjarr..._at_cox.net> wrote:

>> On May 2, 3:37 pm, "joeNOS..._at_BEA.com" <joe.weinst..._at_gmail.com>
>> wrote:
>>
>>
>>
>>> On May 2, 1:19 pm, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
>>>> "joeNOS..._at_BEA.com" <joe.weinst..._at_gmail.com> a écrit dans le message de news:
>>>> 1178136264.220504.27..._at_c35g2000hsg.googlegroups.com...
>>>> | Hi all,
>>>> | This is a real basic Oracle ignorance of mine... What query can I
>>>> | run
>>>> | to get the unique ID of the current DBMS session, so if there's 100
>>>> | sessions, all logged in as scott/tiger, each one has it's own > > > | different
>>>> | ID?
>>>> | thanks
>>>> | Joe Weinstein at BEA Systems
>>>> |
>>>> v$session
>>>> Regards
>>>> Michel Cadot
>>> Thanks. "select * from v$session" gives many rows.
>>> What qualifier should I give to get only the row
>>> corresponding to my session?- Hide quoted text -
>>> - Show quoted text -
>> Use:
>>
>> select SYS_CONTEXT('USERENV','SID')
>> from dual;
>>
>> You might also want to read up on SYS_CONTEXT and see what else it can
>> report.
>>
>> David Fitzjarrell
> 
> thanks! I have tried "select  SYS_CONTEXT('USERENV','SESSIONID')  from
> dual"
> and it seems to work. I am not clear on the difference between SID and
> SESSIONID...
> 

SESSIONID returns the "auditing session identifier". This value corresponds to the AUDSID column of V$SESSION. So you can obtain the SID from V$SESSION as follows:

SELECT sid FROM v$session
WHERE audsid=SYS_CONTEXT('USERENV','SESSIONID');

This is just one more method to be lumped in with the others that have been offered in this thread....

Cheers,
Brian

-- 
===================================================================

Brian Peasland
dba_at_nospam.peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown

-- 
Posted via a free Usenet account from http://www.teranews.com
Received on Thu May 03 2007 - 09:39:12 CDT

Original text of this message

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