Skip to Main Content
  • Questions
  • The First culprit and the others too

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question.

Asked: December 15, 2004 - 7:59 pm UTC

Last updated: December 17, 2004 - 12:33 pm UTC

Version: 9.2

Viewed 1000+ times

You Asked

Hello Tom,

If we have multiple sessions blocking or waiting on one another.
1) How do we find the First culprit session that made this occur
( Any queries for that). Though I saw somewhere on your site who is blocking who query.. but I want to know who started the mess.
2) Also If possible know all such related sessions in the ascending order of the time they started blocking.

3) How to correct this problem.
If we Kill or commit or rollback the first session which caused this to happen will it solve the problem.

Thanx

and Tom said...

1) utllockt.sql found in $ORACLE_HOME/rdbms/admin does just this...


WAITING_S LOCK_TYPE MODE_REQUESTED MODE_HELD LOCK_ID1 LOCK_ID2
--------- -------------- -------------- -------------- ----------------- --------
20 None
18 Transaction Exclusive Exclusive 65568 28615
19 Transaction Exclusive Exclusive 65568 28615

it prints out a lockee-locker graph. You might have to run catblock.sql before using this.

2) v$session has a column, last_call_et -- that shows how long that session has been blocked in their current call...

3) well, generally this is an "application issue". Think about it -- there is no general purpose solution. Given the nature of your application -- this could be a very natural, expected situation (eg: you have a conference room scheduling system and a very very very popular conference room).

On the other hand, it could be a missing index on a foreign key causing a child table to become fully locked whenever the parent table is deleted from or has its primary key updated.

Or it could be a serious application design flaw and the only fix is to correct the flawed application logic.

Killing the blockee will move everyone up a level perhaps, but it certainly won't "fix" anything (you have a really mad end user -- you killed them, and you probably just promoted the first blocked session into the "blockee" session now)

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Thanx Sir

A reader, December 17, 2004 - 12:33 pm UTC

Thanx a lot for all your help all these years