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 locks the table?

Re: What locks the table?

From: rpr <r_p_renu_at_yahoo.com>
Date: 17 Nov 2003 09:20:35 -0800
Message-ID: <4db90929.0311170920.5afd02fd@posting.google.com>


Not always. Going to v$sqlarea or v$sqltext from v$session may not always works. In fact in most cases it will not.

v$sqlarea or v$sqltext will give you the current sql for the user. So if the user issued a update and then went on to execute other queries then you will get the latest sql for the user and not the sql that did the lock.

Michel : Also : I think you can go to v$session from v$locked_object using v$locked_object.session_id= v$session.sid  

Thanks

"Michel Cadot" <micadot2removethat_at_free.fr> wrote in message news:<3fb506ed$0$225$626a54ce_at_news.free.fr>...
> "Linda Lee" <goforticket_at_yahoo.com> a écrit dans le message de
> news:f901fb80.0311140834.64f09eea_at_posting.google.com...
> > One of our applications always go down on Thursday night. I checked
> > the locks on the database side and got a lock in a key table by using
> > following sql. What really does locked_mode 2 do? Is it possible to
> > trace the statement that locks the table?
> > Thanks a lot.
> > ~~~~~~~~~~~~~~~~~~~~~
> > SQL> select v.object_id, t.object_name,
> > 2 v.session_id, v.oracle_username,
> > 3 v.os_user_name, v.locked_mode
> > 4 from v$locked_object v, dba_objects T
> > 5 where v.object_id = t.object_id;
> >
> > OBJECT_ID OBJECT_NAME SESSION_ID ORACLE_USERNAME LOCKED_MODE
> > 193935 F91300 37 JDE 2
>
> Join v$locked_object to v$transaction to get the transaction.
> Then to v$session to get the session.
> Then to v$sqlarea or v$sqltext to get the sql.
>
> Hope this helps
> Michel Cadot
Received on Mon Nov 17 2003 - 11:20:35 CST

Original text of this message

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