| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: How can I get a transaction's session id from inside the transaction ?
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
![]() |
![]() |