db2_check_lock -- Check database blocking and generate alert email
db2_check_lock [ -D<database> ] [ -k<agent id> ] [ -t<block time> ] [ -d ]
This script performs a database instance snapshot to determine blocking. If any agent process is blocked for over a specified time, an email is generated with information on the blocking process and its victims. Optionally, the blocking agent process can be killed. This script must be run on the database server.
This script first gets an application snapshot with basic locking information. If the -k parameter is specified, the script verifies whather the specified agent id still exists and still is holding a lock. If so, the application is forced.
-k
In the absence of a -k parameter, the script verifies whether any applications is blocked for over the specified time (taken from the JobParams table, defaulting to 120 seconds). If not, the script takes no action.
If there is long blocking, the script find the responsible agent process by following the lock chain. For each responsible agent, an email is generated that lists the agent, the locks it holds, the responsible SQL statement, client process information, plus a list of the victim processes.
This script takes the following command-line options:
The physical database name. This optional parameter is used to restrict the check to just that one database.
The agent id to kill (actually, force). In order to prevent accidents, the script verifies this agent id is actually holding a lock.
In the absence of -k, this script only generates email if blocking exceeds a specified time. The default is 120 seconds.
Enable debugging (verbose output).
To install DB2::Admin, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DB2::Admin
CPAN shell
perl -MCPAN -e shell install DB2::Admin
For more information on module installation, please visit the detailed CPAN module installation guide.