Exclusive Lock


When a transaction sets an exclusive lock on a database object, then the database object in question is available only to this transaction, and can only be changed by this transaction. Other transactions that check for exclusive locks or that want to set exclusive or shared locks conflict with the existing exclusive lock for this transaction (lock collision). They are permitted neither shared nor exclusive access to the locked object.

Exclusive locks can be set for the database catalog, tables, or table rows.

An exclusive lock is released by the database system at the end of the transaction in question. It can also be released with the UNLOCK statement by the respective user. However, this is only possible when the database object has not been changed. If the database object has been changed with an SQL statement (for example, using the INSERT, UPDATE or DELETE statement), the exclusive lock remains in place until the end of the transaction.

See also:

Shared Lock

Optimistic Lock

Locking for Database Objects