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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.