DB2 Version 9.7 for Linux, UNIX, and Windows

agent_id - Application handle (agent ID) monitor element

A system-wide unique ID for the application. On a single-partitioned database, this identifier consists of a 16-bit counter. On a multi-partitioned database, this identifier consists of the coordinating partition number concatenated with a 16-bit counter. In addition, this identifier is the same on every partition where the application may make a secondary connection.

Table 1. Table Function Monitoring Information
Table Function Monitor Element Collection Level
MON_GET_CONNECTION table function - Get connection metrics Always collected
MON_GET_CONNECTION_DETAILS table function - Get detailed connection metrics (reported in DETAILS XML document) Always collected
MON_GET_UNIT_OF_WORK table function - Get unit of work metrics Always collected
MON_GET_UNIT_OF_WORK_DETAILS table function - Get detailed unit of work metrics (reported in DETAILS XML document) Always collected
MON_GET_ACTIVITY_DETAILS table function - Get complete activity details (reported in DETAILS XML document) Always collected
MON_GET_LOCKS table function - list all locks in the currently connected database Always collected
MON_GET_MEMORY_POOL - Get memory pool information Always collected
Table 2. Snapshot Monitoring Information
Snapshot Level Logical Data Grouping Monitor Switch
Application appl_id_info Basic
Lock appl_lock_list Basic
DCS Application dcs_appl_info Basic
Transaction event_xact -
Table 3. Event Monitoring Information
Event Type Logical Data Grouping Monitor Switch
Locking - -
Unit of work - -
Connections event_connheader -
Statements event_stmt -
Statements event_subsection -
Deadlocks1 event_dlconn -
Deadlocks with Details1 event_detailed_dlconn -
Threshold violations event_thresholdviolations -
Activities event_activity -
1
This option has been deprecated. Its use is no longer recommended and might be removed in a future release. Use the CREATE EVENT MONITOR FOR LOCKING statement to monitor lock-related events, such as lock timeouts, lock waits, and deadlocks.

Usage

The application handle, also known as the agent ID, can be used to uniquely identify an active application.

Note: The agent_id monitor element has different behavior depending on your version of DB2®. When taking snapshots from DB2 with version SQLM_DBMON_VERSION1 or SQLM_DBMON_VERSION2 to a DB2 (Version 5 or greater) database, the agent_id returned is not usable as an application identifier, rather it is the agent_pid of the agent serving the application. In these cases an agent_id is still returned for compatibility with earlier releases, but internally the DB2 database server will not recognize the value as an agent_id.

This value can be used as input to GET SNAPSHOT commands that require an agent ID or to the monitor table functions that require an application handle.

When reading event traces, it can be used to match event records with a given application.

It can also be used as input to the FORCE APPLICATION command or API. On multi-node systems this command can be issued from any node where the application has a connection. Its effect is global.