WLM_GET_WORKLOAD_OCCURRENCE_ACTIVITIES_V97 table function - Return a list of activities
The WLM_GET_WORKLOAD_OCCURRENCE_ACTIVITIES_V97 table function returns the list of all activities that were submitted by a specified application on a specified member and have not yet been completed.
Note: This table function has been deprecated and replaced
by the WLM_GET_WORKLOAD_OCCURRENCE_ACTIVITIES
table function.
Refer to Table 1 for a complete list of information that can be returned.
Syntax
The schema is SYSPROC.
Table function parameters
-
application_handle
- An input argument of type BIGINT that specifies an application handle for which a list of activities is to be returned. If the argument is null, the data is retrieved for all the applications in the database. member
- An input argument of type INTEGER that specifies a valid member number in the same instance as the currently connected database. Specify -1 for the current member, or -2 for all members. If the null value is specified, -1 is set implicitly.
Authorization
One of the following authorities is required to execute the routine:
- EXECUTE privilege on the routine
- DATAACCESS authority
- DBADM authority
- SQLADM authority
- WLMADM authority
Default PUBLIC privilege
None
Example 1: Activities currently running with a known application handle
After you identify the application handle,
you can look up all the activities currently running in this application.
For example, suppose that an administrator wants to list the activities
of an application whose application handle, determined by using the LIST APPLICATIONS command, is 1. The administrator runs
the following query:
SELECT SUBSTR(CHAR(COORD_PARTITION_NUM),1,5) AS COORD,
SUBSTR(CHAR(DBPARTITIONNUM),1,4) AS PART,
SUBSTR(CHAR(UOW_ID),1,5) AS UOWID,
SUBSTR(CHAR(ACTIVITY_ID),1,5) AS ACTID,
SUBSTR(CHAR(PARENT_UOW_ID),1,8) AS PARUOWID,
SUBSTR(CHAR(PARENT_ACTIVITY_ID),1,8) AS PARACTID,
ACTIVITY_TYPE AS ACTTYPE,
SUBSTR(CHAR(NESTING_LEVEL),1,7) AS NESTING
FROM TABLE(WLM_GET_WORKLOAD_OCCURRENCE_ACTIVITIES_V97(1, -2)) AS WLOACTS
ORDER BY PART, UOWID, ACTID
Sample output from
the query is as follows:
COORD PART UOWID ACTID PARUOWID PARACTID ACTTYPE NESTING
----- ---- ----- ----- -------- -------- -------- -------
0 0 2 3 - - CALL 0
0 0 2 5 2 3 READ_DML 1
Example 2: Activities currently running on the system
The following query joins the WLM_GET_WORKLOAD_OCCURRENCE_ACTIVITIES_V97
output with the MON_GET_PKG_CACHE_STMT output on EXECUTABLE_ID to
provide statement text for all the SQL activities currently running
on the system:
SELECT t.application_handle,
t.uow_id,
t.activity_id,
varchar(p.stmt_text, 256) as stmt_text
FROM table(wlm_get_workload_occurrence_activities_v97(NULL, -1)) as t,
table(mon_get_pkg_cache_stmt(NULL, NULL, NULL, -1)) as p
WHERE t.executable_id = p.executable_id
Sample
output is as follows:
APPLICATION_HANDLE UOW_ID ACTIVITY_ID STMT_TEXT
------------------ ----------- -------------- ------------------------------
1 1 1 SELECT * FROM SYSCAT.TABLES
47 1 36 INSERT INTO T1 VALUES(123)
Information returned
Column name | Data type | Description |
---|---|---|
APPLICATION_HANDLE | BIGINT | application_handle - Application handle monitor element |
MEMBER | SMALLINT | member - Database member monitor element |
COORD_PARTITION_NUM | SMALLINT | coord_partition_num - Coordinator partition number monitor element |
LOCAL_START_TIME | TIMESTAMP | local_start_time - Local start time monitor element |
UOW_ID | INTEGER | uow_id - Unit of work ID monitor element |
ACTIVITY_ID | INTEGER | activity_id - Activity ID monitor element |
PARENT_UOW_ID | INTEGER | parent_uow_id - Parent unit of work ID monitor element |
PARENT_ACTIVITY_ID | INTEGER | parent_activity_id - Parent activity ID monitor element |
ACTIVITY_STATE | VARCHAR(32) | activity_state - Activity state monitor element |
ACTIVITY_TYPE | VARCHAR(32) | Activity type. Possible values are as follows:
Refer to Identify types of work with work classes for a description of the different types of SQL statements that are associated with each activity type. |
NESTING_LEVEL | INTEGER | nesting_level - Nesting level monitor element |
INVOCATION_ID | INTEGER | invocation_id - Invocation ID monitor element |
ROUTINE_ID | INTEGER | routine_id - Routine ID monitor element |
UTILITY_ID | INTEGER | utility_id - Utility ID monitor element |
SERVICE_CLASS_ID | INTEGER | service_class_id - Service class ID monitor element |
DATABASE_WORK_ACTION_SET_ID | INTEGER | One of the following values:
|
DATABASE_WORK_CLASS_ID | INTEGER | One of the following values:
|
SERVICE_CLASS_WORK_ACTION_SET_ID | INTEGER | One of the following values:
|
SERVICE_CLASS_WORK_CLASS_ID | INTEGER | One of the following values:
|
EXECUTABLE_ID | VARCHAR(32) FOR BIT DATA | executable_id - Executable ID monitor element |
TOTAL_CPU_TIME | BIGINT | |
ROWS_READ | BIGINT | |
ROWS_RETURNED | BIGINT | |
QUERY_COST_ESTIMATE | BIGINT | |
DIRECT_READS | BIGINT | |
DIRECT_WRITES | BIGINT |