Lock

From Oracle FAQ

Jump to: navigation, search

Database locks are used to provide concurrency control. Locks are typically acquired at row or table level.

Common Lock types are: Shared, eXclusive, Row Share, Row eXclusive, etc.

Common uses of locks are:

  • ensure that only one user can modify a record at a time;
  • ensure that a table cannot be dropped if another user is querying it;
  • ensure that one user cannot delete a record while another is updating it.

Lock detection

This query will show locked objects with session details:

SELECT a.owner,a.object_name,b.sid,b.serial#,b.username,b.status
  FROM dba_objects a, v$session b, v$locked_object c
 WHERE a.object_id = c.object_id
   AND b.sid       = c.session_id;

Also see


Glossary of Terms
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #
Personal tools