Links
Home
Oracle DBA Forum
Frequent Oracle Errors
TNS:could not resolve the connect identifier specified
Backtrace message unwound by exceptions
invalid identifier
PL/SQL compilation error
internal error
missing expression
table or view does not exist
end-of-file on communication channel
TNS:listener unknown in connect descriptor
insufficient privileges
PL/SQL: numeric or value error string
TNS:protocol adapter error
ORACLE not available
target host or object does not exist
invalid number
unable to allocate string bytes of shared memory
resource busy and acquire with NOWAIT specified
error occurred at recursive SQL level string
ORACLE initialization or shutdown in progress
archiver error. Connect internal only, until freed
snapshot too old
unable to extend temp segment by string in tablespace
Credential retrieval failed
missing or invalid option
invalid username/password; logon denied
unable to create INITIAL extent for segment
out of process memory when trying to allocate string bytes
shared memory realm does not exist
cannot insert NULL
TNS:unable to connect to destination
remote database not found'>ora-02019
exception encountered: core dump
inconsistent datatypes
no data found
TNS:operation timed out
PL/SQL: could not find program
existing state of packages has been discarded
maximum number of processes exceeded
error signaled in parallel query server
ORACLE instance terminated. Disconnection forced
TNS:packet writer failure
see ORA-12699
missing right parenthesis
name is already used by an existing object
cannot identify/lock data file
invalid file operation
quoted string not properly terminated
Unindexed FK Cause Deadlock or Only Share Lock?

Unindexed FK Cause Deadlock or Only Share Lock?

2005-06-30       - By Jonathan Lewis

Reply:     1     2     3     4     5     6     7     8     9     10     >>  


If you attempt to delete a parent row,
or update the key value of a parent
row in a parent/child relationship where
the child DOES NOT HAVE an index
on the foreign key, then Oracle will
attempt to acquire a mode 4 lock
on the child table (or mode 5 if it
has previously modified the child
table).

If any other sessions are currently
modifying the child table, your session
will have to wait before it can acquire
its mode 4/5 as the other sessions will
be holding mode 3 and therefore will
be blocking you.

Anyone who tries to start a new transaction
on the child table (and therefore need to
acquire a mode 3) will be blocked behind
your request for a mode 4.


To engineer a deadlock:
   session A
       delete child row C1
       acquires mode 3 on child table

   session B
       delete child row C2
       acquires mode 3 on child table

   session A
       attempts to delete parent of C1
       attempts to convert mode 3 to mode 5
       blocked by session B holding mode 3
           therefore starts to wait

   session B
       attempts to delete parent of C2
       attempts to convert mode 3 to mode 5
       blocked by session A in the converters queue
           (viz: holding 3, and waiting to convert to 5)
           therefore start to wait

   Three seconds or less later, session a gets
   an ORA-00060 (See ORA-00060.ora-code.com) Deadlock detected.



Regards

Jonathan Lewis

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

http://www.jlcomp.demon.co.uk/appearances.html
Public Appearances - schedule updated June 22nd 2005






-- -- Original Message -- --
From: "Post, Ethan" <Ethan.Post@(protected)>
To: "Oracle-L@(protected) Org (E-mail)" <oracle-l@(protected)>
Sent: Thursday, June 30, 2005 7:32 PM
Subject: Unindexed FK Cause Deadlock or Only Share Lock?



I am trying to find out if a missing index on a foreign key would cause
a deadlock. I always thought is would only cause a share lock and hold
up other DML, not deadlock it.

This asktom link http://tinyurl.com/djgco (search for deadlock and read
comments/responses) seems to suggest you only get a share lock.

However I was sent these links also...some don't seem to support the
idea of deadlocks but others do. Anyone know the answer here? Anyone
think of a quick test case which demonstrates this?


--
http://www.freelists.org/webpage/oracle-l