The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

db2_check_lock -- Check database blocking and generate alert email

SYNOPSIS

  db2_check_lock [ -D<database> ]
                 [ -k<agent id> ]
                 [ -t<block time> ]
                 [ -d ]

DESCRIPTION

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.

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.

OPTIONS

This script takes the following command-line options:

-D'database'

The physical database name. This optional parameter is used to restrict the check to just that one database.

-k'agent id'

The agent id to kill (actually, force). In order to prevent accidents, the script verifies this agent id is actually holding a lock.

-t'block time in seconds'

In the absence of -k, this script only generates email if blocking exceeds a specified time. The default is 120 seconds.

-d

Enable debugging (verbose output).