Oracle Locks   «Prev  Next»
Lesson 9 dbms_lock package
Objective Use dbms_lock package.

dbms_lock package

As you now know, the Oracle database internally issues locks to provide serialized access to shared resources. However, until recently it has not been possible for a developer or DBA to issue and control his or her own locks. Oracle has provided the dbms_lock[1]package to make Oracle kernel's lock management services available to user-written applications.

dbms_lock

Fortunately, application locking implemented using dbms_lock is functionally identical to native Oracle locking. They use the same lock modes and can be viewed with the same V$VIEWS.
Some possible uses of dbms_lock are to:
  1. Provide for exclusive access to an external device or service (e.g. a printer)
  2. Coordinate or synchronize parallelized application processing
  3. Signal the availability of services
  4. Disable or enable program execution
  5. Coordinate access to a shared database pipe

The dbms_lock package presents a relatively straightforward interface containing two procedures and three functions. These are summarized below:
Summary of dbms_lock package

The Oracle database is evolving many new features and capabilities beyond the original "tables of rows" relational. Applications will increasingly be faced with managing concurrent access to non-data services and facilities. dbms_lockdbms_lock provides the necessary tools to implement these requirements, and with a little help from an encapsulation package like DBLOCK it can become a relatively simple matter.
The next lesson concludes this module.

[1]dbms_lock: An Oracle packages that makes Oracle kernel's lock management services available to user-written applications.