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:
Provide for exclusive access to an external device or service (e.g. a printer)
Coordinate or synchronize parallelized application processing
Signal the availability of services
Disable or enable program execution
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:
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.