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: Jusung Yang <JusungYang_at_yahoo.com>
Date: 12 Oct 2002 11:21:11 -0700
Message-ID: <130ba93a.0210121021.7cc48a71@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

Received on Sat Oct 12 2002 - 13:21:11 CDT

Original text of this message

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