Chapter 69

Using the DBMS_LOCK Built-In Package

John Beresniewicz

What Is DBMS_LOCK?

The Oracle RDBMS uses locks internally to provide serialized access to shared resources. DBAs and developers are most familiar with Oracle’s use of locking to control and manage concurrent access to data at the table and row levels. The DBMS_LOCK package makes the Oracle Kernel’s lock management services available to user-written applications.

Application locking implemented using DBMS_LOCK is functionally identical to native RDBMS locking at the levels of lock modes and compatibility, deadlock detection, and visibility through V$ views.

Some possible uses of DBMS_LOCK are to:

  • Provide for exclusive access to an external device or service (e.g., a printer) ...

Get Oracle Internals now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.