Finding locked database object


Problem

Finding locked database object

What do you usually do when you detect a lock in your database? You have to get more information about the problem. Knowing about the object which caused the lock can often help you locate the problem very quickly.


Solution

Recipe #1 - Query locked database objects

The following queries shows you all locked object including some information about the session causing the lock. The combination of these things should make it easy to spot and fix the problem.

SELECT DO.owner,
       DO.object_name,
       DO.object_type,
       lo.session_id,
       lo.oracle_username
  FROM dba_objects DO, v$locked_object lo
WHERE DO.object_id = lo.object_id

Comments




Please sign-in to post a comment