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: How can I get a transaction's session id from inside the transaction ?

Re: How can I get a transaction's session id from inside the transaction ?

From: Ban Spam <ban-spam_at_operamail.com>
Date: Sat, 12 Oct 2002 19:55:00 GMT
Message-ID: <Xns92A583660ABA6SunnySD@68.6.19.6>


JusungYang_at_yahoo.com (Jusung Yang) wrote in news:130ba93a.0210121021.7cc48a71_at_posting.google.com:

> Let's try this again:
>
> JusungYang_at_yahoo.com (Jusung Yang) wrote in message
> news:<130ba93a.0210111755.47d083ae_at_posting.google.com>...

>> > How can I find out if an Oracle object is accessed simultanously by
>> > multiple transactions ?
>> 
>> Look up v$locked_object. Though if you explicitly lock a table, it
>> would also show up in this view.

>
> select t1.sid from v$transaction_enqueue t1, v$locked_object where
> XIDSQN=id2
> and object_id=<your object id>;
>
> v$transaction_enqueue links transactions to locks, v$locked_object
> identifies locked objects. Seems to work for update, insert, delete.
>
>> > How can I get a transaction's session id from inside the
>> > transaction? 
>> 
>> select sid from v$session, v$transaction where saddr=ses_addr and
>> audsid=userenv('sessionid');
>> 

>
> This query does not make much sense, since V$transaction is redundent.
>
> The question probably should have been:
>
> How do I find the current session id?
> select sid from v$session where audsid=userenv('sessionid');
> or
> How do I find the session ID of the current transaction I am in?
> This is the same as the previous question.
> or
> How can I get a transaction's session id?
> You tie transaction and session with
> V$transaction.ses_addr=v$session.saddr
>
>
> - Jusung Yang
>

select sid from v$mystats
where rowid = 1; Received on Sat Oct 12 2002 - 14:55:00 CDT

Original text of this message

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