CA7 or CA11 provides DBUTLTY BACKUP job samples which include LOCK and UNLOCK clauses around the BACKUP statement.
These DBUTLTY Backup jobs have two steps, one to take the Backup and one to UNLOCK any pending LOCKs in case the first step has failed.
In a recent case a customer reported the UNLOCK step did not run and the BACKUP failed, the question was:
How can the outstanding LOCKs be listed?
The DBUTLTY COMM STATUS console command did not show all the LOCKs.
DBUTLTY COMM STATUS is a diagnostic tool to display activities at some point in time.
If a job is hanging due to a LOCK or LOCKs then DBUTLTY COMM STATUS will display details about the first LOCK the job is waiting for.
If the job is canceled for any reason then DBUTLTY COMM STATUS will not display the pending LOCKs if any.
The best way to display these LOCKs is by using the following SQL request:
SELECT MUF_NAME, LOCK_VALUE FROM sysadm.MUF_LOCKS_VALUE
WHERE SUBSTR(LOCK_VALUE,1,6) = 'DBSMVR';
The LOCK_VALUE will include “DBSMVR” followed by the DBID and Area involved.
You need to have as many UNLOCKs than LOCKs to get rid of any LOCK situation.
If there were two previous LOCKs done then you would need at least two UNLOCKs to get rid of the hang situation.
The number of UNLOCKs done does not matter as long as it is greater than the number of LOCKs.