Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Help with Locking Issue

Re: Help with Locking Issue

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Fri, 19 Apr 2002 05:43:21 -0800
Message-ID: <F001.0044950B.20020419054321@fatcity.com>

This is hugely irritating, and I guess it may be a version-dependent thing, but I can't get the exact match for the quoted locks by setting up three tables in the manner described.

The locking information varies between 8.1.7.3 and 9.0.1.3, but I can't get a PK/FK issue to behave (mis-behave ?) properly.

Various failures include:

  1. Seeing a lock on the parent table
  2. Not seeing the TX mode 4 (share) lock at all
  3. See a TM mode 5 (share row exclusive) request on the child. (combined with a held mode 3 (row exclusive).

Which version of (exact) Oracle is this, and have you figured out the exact pattern of actions that make the problem appear.

My tables are:

    P1 (id_p1 number primary key ...)
    P2 (id_p2 number primary key ...)
    C(id_p1 references P1, id_p2 references P2, primary key (id_p1,id_p2) ...)

This seems to describe your scenario - two foreign keys, but only one of them index by virtue of the composite primary key.

Jonathan Lewis
http://www.jlcomp.demon.co.uk

Author of:
Practical Oracle 8i: Building Efficient Databases

Next Seminar - Australia - July/August
http://www.jlcomp.demon.co.uk/seminar.html

Host to The Co-Operative Oracle Users' FAQ http://www.jlcomp.demon.co.uk/faq/ind_faq.html

-----Original Message-----
To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> Date: 18 April 2002 19:45

I had already checked that, but since you asked, I double checked. The primary key on the FIXED_ASSET_ACTIV table has two columns - both are foreign keys from other tables. I created a separate index for the 2nd column in the PK. This fixed my problem!

So, the foreign key was indexed, it just wasn't indexed correctly.

Thanks,
Jay

>>> <Scott.Shafer_at_dcpds.cpms.osd.mil> 04/18/02 01:17PM >>>
Jay, do you have any unindexed foreign keys on those tables? If so, Oracle
>
> Sess Op Sys OBJ NAME or
> ID USERNAME User ID TERMINAL TRANS_ID TY Lock Mode
Req
> Mode
> ---- -------- ---------- -------- ----------------- -- -----------
> -----------
> 12 KEN468 ken468 KEN468-1 FIXED_ASSET_ACTIV TM Row Excl
> 12 KEN468 ken468 KEN468-1 Trans-196694 TX Exclusive
> 14 KEN468 Batch BATCH FIXED_ASSET_ACTIV TM Row Excl
> 14 KEN468 Batch BATCH Trans-196694 TX --Waiting--
Share
> 14 KEN468 Batch BATCH Trans-65597 TX Exclusive
>
>
> So session 14 is waiting for a share lock. Session 12 has an
exclusive
> lock that is blocking session 14. How do I find out what session 12
has
> locked that is needed by session 14?
>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Jonathan Lewis
  INET: jonathan_at_jlcomp.demon.co.uk

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Fri Apr 19 2002 - 08:43:21 CDT

Original text of this message

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