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: DBA_LOCK fields

Re: DBA_LOCK fields

From: Andrew Barnett <nobody_at_spamandeggs.bp.com>
Date: 1998/03/22
Message-ID: <01bd55e2$7db621e0$8c0564a1@azmelw1358.mel.az.bp.com>#1/1

ta for help guys.

so, if session1 locks a row, and session2 does "select ... for update nowait" on that row, which fails, the only practical way to tell session2 who has the lock is if session1 explicitly wrote that information to some centrally accessible area.

this is how I currently handle things: I have a daemon process running continuously under dbms_job, which accepts lock notifications, stores them in a pl/sql table, and returns that info to requesting session, all over db pipes.

I imagine a kludge solution would be to submit a job, using dbms_job, like: "begin select ... for update; rollback; end;" and query v$session while it's waiting.

-- 
Andrew - Wizzard

barnetaj_at_bp.com

Kristiaan J. Kolk <akolk_at_ix.netcom.com> wrote in article
<35140090.38E51A8D_at_ix.netcom.com>...

> x$kglck keeps only track of "library cache locks" not transaction locks.
Also
> there is no way of relating row level locks back to sessions. The info is
stored
> in the block (that is on disk) and you would have to read all the blocks
your
> database to find out what rows are block by which session.
>
> The information on the TX lock:
> id1 = undo segment number << 16 | slot
> id2 = sequence
>
> Anjo
>
> I work for Oracle, but speak for myself !
>
> MarkP28665 wrote:
>
> > From: "Andrew Barnett" <nobody_at_spamandeggs.bp.com> >>
> > say I update a row in table fred. there's now a row lock on that row,
and an
> > entry in v$lock that points to fred. say I now update a second row in
fred.
> > there's still only one entry in v$lock. my question is, since the
kernel can
> > keep track of individual row locks, where can I find out which rowid is
locked
> > by which session? I tried to make sense of x$kglck, or whatever it's
called,
> > but it seemed to also have only one row. <<
> >
> > Oracle stores row lock information in the data block of the locked row,
not in
> > memory. There is no way to determine if a row is locked without
quering it
> > unless someone else is already waiting on it. Since 7.2 the v$session
table
> > has contained columns for the file id, block, and row number of the
locked row
> > a session is waiting on.
> >
> > I hope this is helpful.
> >
> > Mark Powell -- Oracle 7 Certified DBA
> > - The only advice that counts is the advice that you follow so follow
your own
> > advice -
>
>
>
>
Received on Sun Mar 22 1998 - 00:00:00 CST

Original text of this message

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