The unit of work event monitor records an event whenever a unit of work is completed, that is, whenever there is a commit or a rollback. This historical information about individual units of work is useful for chargeback purposes (charging by CPU usage) and for monitoring compliance with response time service level objectives.
The unit of work event monitor is one way to perform system perspective monitoring with request metrics. The most closely related alternatives or complements to the unit of work event monitor are either the statistics event monitor or the MON_GET_UNIT_OF_WORK and MON_GET_UNIT_OF_WORK_DETAILS table functions.
Starting with DB2 Version 9.7 Fix Pack 1, using the unit of work event monitor, you can collect a listing of packages used within a unit of work, as well as the nesting level at which it was used, to help facilitate stored procedure troubleshooting.
To create the unit of work event monitor and collect unit of work event monitor data, you must have DBADM or SQLADM authority.
Before you create a unit of work event monitor, identify the table space where you plan to store the unformatted event table for your event monitor. The recommended practice is to have a table space dedicated and configured to store the unformatted event table associated with any event monitor. Create the unit of work event monitor in a tablespace with at least 8K pagesize to ensure that the event data is contained within the inlined BLOB column of the unformatted event table. If the BLOB column is not inlined, then the performance of writing and reading the events to the unformatted event table might not be efficient.
The database manager attempts to inline the event_data BLOB column in the unformatted event table, but this is not always possible. To check that the rows in the unformatted event table have been inlined, use the ADMIN_IS_INLINED function. If the rows have not been inlined, use the ADMIN_EST_INLINE_LENGTH functions to determine how much space the rows need.
Your other options when you create an event monitor are to specify any existing table space or to not specify any and have one chosen by default.
CREATE EVENT MONITOR MY_UOW_EVMON
FOR UNIT OF WORK
WRITE TO UNFORMATTED EVENT TABLE (IN MY_EVMON_TABLESPACE)
db2 update db cfg for dbname using mon_uow_data base
If either the mon_uow_data database configuration parameter or the COLLECT UNIT OF WORK DATA clause of the CREATE/ALTER WORKLOAD statement is set to BASE, then that is the effective setting for the workload.
If you want to enable data collection for only selected workloads, then set mon_uow_data database configuration parameter to NONE and set the level to BASE for the desired workloads.
Use these table functions to specify the data to extract using a SELECT statement. You have full control over selection, ordering, and other aspects provided by the SELECT statement.
If you are generating package listing information, EVMON_FORMAT_UE_TO_XML generates a single XML document that contains both the basic unit of work event monitor data as well as the package listing. EVMON_FORMAT_UE_TO_TABLES produces two tables, one for the base unit of work event monitor information, and another for the package listing information. You can join the two using the values contained in the MEMBER, APPLICATION_ID and UOW_ID columns.
java db2evmonfmt -d SAMPLE -ue SAMPLE_UOW_EVENTS -ftext -ss DB2EvmonUOW.xsl -hours 24