MON_GET_ACTIVITY_DETAILS 表函数 - 返回有关活动的信息(采用 XML 文档格式)

MON_GET_ACTIVITY_DETAILS 表函数返回有关活动的信息,包括常规活动信息 (例如语句文本) 和该活动的一组指标。

将在 XML 文档中返回指标。

权限

需要下列其中一项权限才能执行此例程:
  • 对例程的 EXECUTE 特权
  • DATAACCESS 权限
  • DBADM 权限
  • SQLADM 权限

缺省 PUBLIC 特权

语法

Read syntax diagramSkip visual syntax diagramMON_GET_ACTIVITY_DETAILS(application_handle ,uow_id,activity_id,member)

模式为 SYSPROC。

例程参数

application_handle
类型为 BIGINT 的输入参数,该参数指定有效的应用程序句柄。 如果自变量为空,那么不会从此函数返回任何行,并且会返回 SQL0171N 错误。
uow_id
类型为 INTEGER 的输入参数,该参数指定应用程序内唯一的有效工作单元标识。 如果自变量为空,那么不会从此函数返回任何行,并且会返回 SQL0171N 错误。
activity_id
类型为 INTEGER 的输入参数,该参数指定工作单元内唯一的有效活动标识。 如果自变量为空,那么不会从此函数返回任何行,并且会返回 SQL0171N 错误。
成员
类型为 INTEGER 的输入参数,该参数指定在调用此函数时与当前所连接数据库在同一实例中的成员的有效编号。 指定 -1(表示当前数据库成员)或 -2(表示所有活动数据库成员)。 如果指定空值,那么会隐式设置 -1。

返回的信息

表 1. 针对 MON_GET_ACTIVITY_DETAILS 返回的信息
列名 数据类型 描述
APPLICATION_HANDLE BIGINT application_handle - 应用程序句柄
UOW_ID INTEGER uow_id - 工作单元标识
ACTIVITY_ID INTEGER activity_id - 活动标识
MEMBER SMALLINT 成员-数据库成员
详细信息 BLOB (8M) 包含活动详细信息的 XML 文档。 请参阅 表 2 以获取本文档中元素的描述。
以下示例显示在 DETAILS 列中返回的 XML 文档的结构。

<db2_activity_details xmlns="http://www.ibm.com/xmlns/prod/db2/mon" release="90700000">
  <member>0</member>
  <application_handle>70</application_handle>
  <activity_id>1</activity_id>
  <activity_state>IDLE</activity_state>
  <activity_type>READ_DML</activity_type>
  <uow_id>1</uow_id>
  ...
  <activity_metrics release="90700000">
    <lock_wait_time>2000</lock_wait_time>
    ...
  </activity_metrics>
</db2_activity_details>
对于完整模式,请参阅 sqllib/misc/DB2MonRoutines.xsd。 此文档使用以下 XML 非基本类型定义:
<xs:simpleType name = "executable_id_type" >
  <xs:annotation>
     <xs:documentation>
       The binary Executable ID
     </xs:documentation>
  </xs:annotation>
   <xs:restriction base = "xs:hexBinary" >
      <xs:maxLength value = "32" />
   </xs:restriction>
</xs:simpleType>

返回的详细度量值

表 2. MON_GET_ACTIVITY_DETAILS 返回的详细指标
元素名称 数据类型 描述或相应的监视元素
active_col_vector_consumers xs:long active_col_vector_services-活动 columnar_vector 使用者
active_col_vector_consumers_top xs:long active_col_vector_consumers_top-活动 columnar_vector 使用者高水位标记
active_hash_grpbys xs:long active_hash_grpbys -“活动散列 GROUP BY 操作次数”监视元素
active_hash_grpbys_top xs:long active_hash_grpbys_top - 活动散列 GROUP BY 操作次数高水位标记
active_hash_joins xs:long active_hash_joins - 活动散列连接数监视元素
active_hash_joins_top xs:long active_hash_joins_top-活动散列连接操作数高水位标记
active_olap_funcs xs:long active_olap_funcs -“活动 OLAP 函数”监视元素
active_olap_funcs_top xs:long active_olap_funcs_top-活动 OLAP 函数操作高水位标记
active_peas xs:long active_peas-活动部分提前聚集操作
active_peas_top xs:long active_广大-top-活动部分提前聚集操作次数高水位标记
active_peds xs:long active_peds - 活动部分提前相异操作次数
active_peds_top xs:long active_peds_top - 活动部分提前相异操作次数高水位标记
active_sort_consumers xs:long active_sort_members-活动排序使用者
active_sort_consumers_top xs:long active_sort_consumers_top - 活动排序使用者数高水位标记
active_sorts xs:long active_sorts -“活动排序数”监视元素
active_sorts_top xs:long active_sorts_top - 活动排序数高水位标记
activity_id xs:nonNegativeInteger activity_id - 活动标识
activity_state xs:string activity_state - 活动状态
activity_type xs:string activity_type - 活动类型
activitytotalruntime_threshold_id xs:int activitytotalruntime_threshold_id-"活动总运行时阈值标识" 监视元素
activitytotalruntime_threshold_value xs:dateTime activitytotalruntime_threshold_value-"活动总运行时阈值" 监视元素
activitytotalruntime_threshold_violated xs:short activitytotalruntime_threshold_violated-"违反活动总运行时阈值" 监视元素
activitytotalruntimeinallsc_threshold_id xs:int activitytotalruntimeinallsc_threshold_id-"所有服务类中的活动总运行时阈值标识" 监视元素
activitytotalruntimeinallsc_threshold_value xs:dateTime activitytotalruntimeinallsc_threshold_value-"所有服务类中的活动总运行时阈值" 监视元素
activitytotalruntimeinallsc_threshold_violated xs:short activitytotalruntimeinallsc_threshold_violated-"违反所有服务类中的活动总运行时阈值" 监视元素
activitytotaltime_threshold_id xs:int activitytotaltime_threshold_id - 活动总时间阈值标识
activitytotaltime_threshold_value xs:dateTime activitytotaltime_threshold_value - 活动总时间阈值
activitytotaltime_threshold_violated xs: short (1 = yes , 0 = no) activitytotaltime_threshold_violated - 违反活动总时间阈值
adm_bypassed xs:short 保留以供将来使用。
adm_bypass_act_total xs:long 保留以供将来使用。
adm_overflows xs:long 保留以供将来使用。
agents_top xs:long agents_top -“创建的代理程序数”监视元素
AGGSQLTEMPSPACE_THRESHOLD_ID xs:int aggsqltempspace_threshold_id- AggSQL 临时空间阈值标识
aggsqltempspace_threshold_value xs:long aggsqltempspace_threshold_value - AggSQL 临时空间阈值
aggsqltempspace_threshold_violated xs: short (1 = yes , 0 = no) aggsqltempspace_threshold_violated - 违反 AggSQL 临时空间阈值
application_handle xs:nonNegativeInteger application_handle - 应用程序句柄
audit_events_total xs:nonNegativeInteger audit_events_total - 审计事件总数
audit_file_write_wait_time xs:nonNegativeInteger audit_file_write_wait_time - 审计文件写等待时间
audit_file_writes_total xs:nonNegativeInteger audit_file_writes_total - 写审计文件总次数
audit_subsystem_wait_time xs:nonNegativeInteger audit_subsystem_wait_time - 审计子系统等待时间
audit_subsystem_waits_total xs:nonNegativeInteger audit_subsystem_waits_total - 审计子系统等待总次数
cf_wait_time xs:long cf_wait_time -“集群高速缓存设施等待时间”监视元素
cf_waits xs:long cf_waits -“集群高速缓存设施等待时间”监视元素
client_acctng xs:string(255) client_acctng -“客户机记帐字符串”监视元素
client_applname xs:string(255) client_applname -“客户机应用程序名称”监视元素
client_userid xs:string(255) client_userid -“客户机用户标识”监视元素
client_wrkstnname xs:string(255) client_wrkstnname -“客户机工作站名称”监视元素
col_synopsis_rows_inserted xs:nonNegativeInteger col_synopsis_rows_inserted -“插入的列组织概要表行数”监视元素
col_vector_consumer_overflows xs:long col_vector_consumer_overflows-"Columnar 向量使用者溢出数" 监视元素。
comm_exit_wait_time xs:long comm_exit_wait_time -“通信出口等待时间”监视元素
comm_exit_waits xs:long comm_exit_waits -“通信出口等待数”监视元素
concurrentdbcoordactivities_db_threshold_id xs:int concurrentdbcoordactivities_db_threshold_id-并行数据库协调程序活动阈值标识
concurrentdbcoordactivities_db_threshold_queued xs: short (1 = yes , 0 = no) concurrentdbcoordactivities_db_threshold_queued-并行数据库协调程序活动数
concurrentdbcoordactivities_db_threshold_value xs:long concurrentdbcoordactivities_db_threshold_value-并行数据库协调程序活动数
concurrentdbcoordactivities_db_threshold_violated xs: short (1 = yes , 0 = no) concurrentdbcoordactivities_db_threshold_violated-违反并行数据库协调程序活动阈值
concurrentdbcoordactivities_subclass_threshold_id xs:int concurrentdbcoordactivities_subclass_threshold_id-并行数据库协调程序活动数的子类阈值标识
concurrentdbcoordactivities_subclass_threshold_queued xs: short (1 = yes , 0 = no) concurrentdbcoordactivities_subclass_threshold_queued-并行数据库协调程序活动数的子类阈值已排队
concurrentdbcoordactivities_subclass_threshold_value xs:long concurrentdbcoordactivities_subclass_threshold_value-并行数据库协调程序活动数的子类阈值
concurrentdbcoordactivities_subclass_threshold_violated xs: short (1 = yes , 0 = no) concurrentdbcoordactivities_subclass_threshold_violated-违反并行数据库协调程序活动子类阈值
concurrentdbcoordactivities_superclass_threshold_id xs:int concurrentdbcoordactivities_superclass_threshold_id-并行数据库协调程序活动超类
concurrentdbcoordactivities_superclass_threshold_queued xs: short (1 = yes , 0 = no) concurrentdbcoordactivities_superclass_threshold_queued-已排队的并行数据库协调程序活动超类阈值
concurrentdbcoordactivities_superclass_threshold_value xs:long concurrentdbcoordactivities_superclass_threshold_value-并行数据库协调程序活动数的超类阈值
concurrentdbcoordactivities_superclass_threshold_violated xs: short (1 = yes , 0 = no) concurrentdbcoordactivities_superclass_threshold_violated-违反并行数据库协调程序活动超类阈值
concurrentdbcoordactivities_wl_was_threshold_id xs:int concurrentdbcoordactivities_wl_was_threshold_id - 并行数据库协调程序活动数的工作负载工作操作集阈值标识
concurrentdbcoordactivities_wl_was_threshold_queued xs: short (1 = yes , 0 = no) concurrentdbcoordactivities_wl_was_threshold_queued - 已按并行数据库协调程序活动数的工作负载工作操作集阈值排队
concurrentdbcoordactivities_wl_was_threshold_value xs:long concurrentdbcoordactivities_wl_was_threshold_value - 并行数据库协调程序活动数的工作负载工作操作集阈值
concurrentdbcoordactivities_wl_was_threshold_violated xs: short (1 = yes , 0 = no) concurrentdbcoordactivities_wl_was_threshold_violated - 违反并发数据库协调程序活动数的工作负载工作操作集阈值
concurrentdbcoordactivities_work_action_set_threshold_id xs:int concurrentdbcoordactivities_work_action_set_threshold_id - 并行数据库协调程序活动数的工作操作集阈值标识
concurrentdbcoordactivities_work_action_set_threshold_queued xs: short (1 = yes , 0 = no) concurrentdbcoordactivities_work_action_set_threshold_queued - 已由并行数据库协调程序活动数的工作操作集阈值排队
concurrentdbcoordactivities_work_action_set_threshold_value xs:long concurrentdbcoordactivities_work_action_set_threshold_value - 并行数据库协调程序活动数的工作操作集阈值
concurrentdbcoordactivities_work_action_set_threshold_violated xs: short (1 = yes , 0 = no) concurrentdbcoordactivities_work_action_set_threshold_violated - 违反并行数据库协调程序活动数的工作操作集阈值
concurrentworkloadactivities_threshold_id xs:int concurrentworkloadactivities_threshold_id -“并行工作负载活动阈值标识”监视元素
concurrentworkloadactivities_threshold_value xs:long concurrentworkloadactivities_threshold_value -“并行工作负载活动阈值”监视元素
concurrentworkloadactivities_threshold_violated xs:short concurrentworkloadactivities_threshold_violated -“违反并行工作负载活动阈值”监视元素
coord_member xs:nonNegativeInteger coord_member - 协调程序成员
coord_stmt_exec_time xs:nonNegativeInteger coord_stmt_exec_time - 协调代理程序执行语句的时间
cputime_threshold_id xs:int cputime_threshold_id - CPU 时间阈值标识
cputime_threshold_value xs:long cputime_threshold_value - CPU 时间阈值
cputime_threshold_violated xs: short (1 = yes , 0 = no) cputime_threshold_violated - 违反 CPU 时间阈值
cputimeinsc_threshold_id xs:int cputimeinsc_threshold_id-服务阈值标识中的 CPU 时间
cputimeinsc_threshold_value xs:long cputimeinsc_threshold_value-服务阈值中的 CPU 时间
cputimeinsc_threshold_violated xs: short (1 = yes , 0 = no) cputimeinsc_threshold_violated-违反的服务阈值中的 CPU 时间
DATABASE_WORK_ACTION_SET_ID xs:nonNegativeInteger db_work_action_set_id - 数据库工作操作集标识
DATABASE_WORK_CLASS_ID xs:nonNegativeInteger db_work_class_id - 数据库工作类标识
datataginsc_threshold_id xs:int datataginsc_threshold_id-阈值标识中的 Datataginsc
datataginsc_threshold_value xs:string(32) datataginsc_threshold_value-阈值中的 Datataginsc
datataginsc_threshold_violated xs: short (1 = yes , 0 = no) datataginsc_threshold_violated-违反阈值中的 Datataginsc
datatagnotinsc_threshold_id xs:int datatagnotinsc_threshold_id-Datatagnotinsc 不在阈值标识中
datatagnotinsc_threshold_value xs:string(32) datatagnotinsc_threshold_value-Datatagnotinsc 不在阈值中
datatagnotinsc_threshold_violated xs: short (1 = yes , 0 = no) datatagnotinsc_threshold_violations-未违反阈值中的 Datatagnotinsc
死锁 xs:nonNegativeInteger deadlocks - 检测到的死锁数
diaglog_write_wait_time xs:nonNegativeInteger diaglog_write_wait_time-Diag 日志写入时间
diaglog_writes_total xs:nonNegativeInteger diaglog_writes_total-Diag 日志总写入数
direct_read_reqs xs:nonNegativeInteger direct_read_reqs - 直接读请求数
direct_read_time xs:nonNegativeInteger direct_read_time - 直接读时间
direct_reads xs:nonNegativeInteger direct_reads - 直接读取数据库的次数
direct_write_reqs xs:nonNegativeInteger direct_write_reqs - 直接写请求数
direct_write_time xs:nonNegativeInteger direct_write_time - 直接写时间
direct_writes xs:nonNegativeInteger direct_writes - 直接写至数据库的次数
disabled_peds xs:long disabled_peds -“已禁用部分提前相异数”监视元素
eff_stmt_text xs:string eff_stmt_text-有效语句文本 。 在语句集中器执行的任何文字替换之后,集中语句文本的前 1024 个字符。 仅当语句集中器已启用并且此语句已被语句集中器改变时才存在。
effective_isolation xs:string effective_isolation - 有效隔离级别
effective_lock_timeout xs:integer effective_lock_timeout-有效锁定超时
effective_query_degree xs:integer effective_query_degree - 有效查询并行度
entry_time xs:dateTime entry_time-Entry 时间此活动到达系统的时间。
estimated_runtime xs:long 保留以供将来使用。
estimated_sort_consumers_top xs:long 保留以供将来使用。
estimated_sort_shrheap_top xs:long 保留以供将来使用。
estimatedsqlcost_threshold_id xs:int estimatedsqlcost_threshold_id - 估计 SQL 成本阈值标识
estimatedsqlcost_threshold_value xs:long estimatedsqlcost_threshold_value - 估计 SQL 成本阈值
estimatedsqlcost_threshold_violated xs: short (1 = yes , 0 = no) estimatedsqlcost_threshold_violated - 违反估计 SQL 成本阈值
evmon_wait_time xs:nonNegativeInteger evmon_wait_time - 事件监视器等待时间
evmon_waits_total xs:nonNegativeInteger evmon_waits_total - 事件监视器总等待时间
executable_id executable_id_type executable_id - 可执行文件标识
ext_table_read_volume xs:nonNegativeInteger ext_table_read_volume -“外部表阅读器读取的数据总量”监视元素
ext_table_recv_volume xs:nonNegativeInteger ext_table_recv_volume -“从外部表阅读器接收到的数据总量”监视元素
ext_table_recv_wait_time xs:nonNegativeInteger ext_table_recv_wait_time -“代理程序等待外部表阅读器的时间总量”监视元素
ext_table_recvs_total xs:nonNegativeInteger ext_table_recvs_total -“从外部表阅读器接收到的行批处理总数”监视元素
ext_table_send_volume xs:nonNegativeInteger ext_table_send_volume -“发送至外部表写程序的数据总量”监视元素
ext_table_send_wait_time xs:nonNegativeInteger ext_table_send_wait_time -“代理程序等待外部表写程序的时间总量”监视元素
ext_table_sends_total xs:nonNegativeInteger ext_table_sends_total -“发送至外部表写程序的行批处理总数”监视元素
ext_table_write_volume xs:nonNegativeInteger ext_table_write_volume -“外部表写程序写入的数据总量”监视元素
fcm_message_recv_volume xs:nonNegativeInteger fcm_message_recv_volume-FCM 消息接收卷
fcm_message_recv_wait_time xs:nonNegativeInteger fcm_message_recv_wait_time-FCM 消息接收等待时间
fcm_message_recv_waits_total xs:nonNegativeInteger fcm_message_recv_waits_total -“等待 FCM 回复消息所花时间”监视元素
fcm_message_recvs_total xs:nonNegativeInteger fcm_message_recvs_total-FCM 消息接收总数
fcm_message_send_volume xs:nonNegativeInteger fcm_message_send_volume - 发送 FCM 消息量
fcm_message_send_wait_time xs:nonNegativeInteger fcm_message_send_wait_time - 发送 FCM 消息等待时间
fcm_message_send_waits_total xs:nonNegativeInteger fcm_message_send_waits_total -“执行 FCM 消息发送操作时被阻塞的时间”监视元素
fcm_message_sends_total xs:nonNegativeInteger fcm_message_sends_total-FCM 消息发送总数
fcm_recv_volume xs:nonNegativeInteger fcm_recv_volume-FCM 接收卷
fcm_recv_wait_time xs:nonNegativeInteger fcm_recv_wait_time-FCM 接收等待时间
fcm_recv_waits_total xs:nonNegativeInteger fcm_recv_waits_total -“等待通过 FCM 接收数据所花时间”监视元素
fcm_recvs_total xs:nonNegativeInteger fcm_recvs_total-FCM 接收总次数
fcm_send_volume xs:nonNegativeInteger fcm_send_volume - FCM 发送量
fcm_send_wait_time xs:nonNegativeInteger fcm_send_wait_time - FCM 发送等待时间
fcm_send_waits_total xs:nonNegativeInteger fcm_send_waits_total -“执行 FCM 发送操作时被阻塞的时间”监视元素
fcm_sends_total xs:nonNegativeInteger fcm_sends_total - FCM 发送总计
fcm_tq_recv_volume xs:nonNegativeInteger fcm_tq_recv_volume-FCM 表队列接收卷
fcm_tq_recv_wait_time xs:nonNegativeInteger fcm_tq_recv_wait_time-FCM 表队列接收等待时间
fcm_tq_recv_waits_total xs:nonNegativeInteger fcm_tq_recv_waits_total -“等待接收下一个缓冲区所花时间”监视元素
fcm_tq_recvs_total xs:nonNegativeInteger fcm_tq_recvs_total-FCM 表队列接收总数
fcm_tq_send_volume xs:nonNegativeInteger fcm_tq_send_volume-FCM 表队列发送卷
fcm_tq_send_wait_time xs:nonNegativeInteger fcm_tq_send_wait_time-FCM 表队列发送等待时间
fcm_tq_send_waits_total xs:nonNegativeInteger fcm_tq_send_waits_total -“等待发送下一个缓冲区所花时间”监视元素
fcm_tq_sends_total xs:nonNegativeInteger fcm_tq_sends_total-FCM 表队列发送总数
fed_rows_deleted xs:nonNegativeInteger fed_rows_deleted -“联合系统删除的行数”监视元素
fed_rows_inserted xs:nonNegativeInteger fed_rows_inserted -“联合系统插入的行数”监视元素
fed_rows_read xs:nonNegativeInteger fed_rows_read -“联合系统读取的行数”监视元素
fed_rows_updated xs:nonNegativeInteger fed_rows_updated -“联合系统更新的行数”监视元素
fed_wait_time xs:nonNegativeInteger fed_wait_time -“联合服务器所花费的时间”监视元素
fed_waits_total xs:nonNegativeInteger fed_waits_total -“联合服务器的总执行时间”监视元素
hash_grpby_overflows xs:long hash_grpby_overflows - 散列 GROUP BY 溢出次数
hash_join_overflows xs:long hash_join_overflows -“散列连接溢出数”监视元素
hash_join_small_overflows xs:long hash_join_small_overflows -“散列连接小溢出数”监视元素
ida_recv_volume xs:nonNegativeInteger ida_recv_volume -“接收的总数据量”监视元素

数据库服务器从数据库内分析进程中接收的总数据量。 此值以字节计。

ida_recv_wait_time xs:nonNegativeInteger ida_recv_wait_time -“等待接收数据时所耗用的时间”监视元素

等待从数据库内分析进程接收数据所耗用的总时间量。

ida_recvs_total xs:nonNegativeInteger ida_recvs_total -“接收数据的次数”监视元素

从数据库内分析进程中接收数据的总次数。

ida_send_volume xs:nonNegativeInteger ida_send_volume -“发送的总数据量”监视元素

从数据库服务器发送至数据库内分析进程的总数据量。 此值以字节计。

ida_send_wait_time xs:nonNegativeInteger ida_send_wait_time -“等待发送数据时所耗用的时间”监视元素

等待将数据发送至数据库内分析进程所耗用的总时间量。

ida_sends_total xs:nonNegativeInteger ida_sends_total -“发送数据的次数”监视元素

将数据发送至数据库内分析进程的总次数。

int_rows_deleted xs:long int_rows_deleted -“删除的内部行数”监视元素
int_rows_inserted xs:long int_rows_inserted - 插入的内部行数监视元素
int_rows_updated xs:long int_rows_updated -“更新的内部行数”监视元素
intra_parallel_state xs:string intra_parallel_state -“分区内并行性的当前状态”监视元素
invocation_id xs:nonNegativeInteger invocation_id -“调用标识”监视元素
is_system_appl xs:short is_system_appl -“是系统应用程序”监视元素
last_reference_time xs:dateTime last_reference_time-上次引用时间。 每次在此活动中发生请求时,都会更新此字段。
lob_prefetch_reqs xs:nonNegativeInteger lob_prefetch_reqs -“LOB 预取程序请求计数”监视元素
lob_prefetch_wait_time xs:nonNegativeInteger lob_prefetch_wait_time-"LOB 预取等待时间" 监视元素
LOCAL_START_TIME xs:dateTime local_start_time-本地开始时间
lock_escals xs:nonNegativeInteger lock_escals - 锁定升级次数
lock_escals_global xs:long lock_escals_global -“全局锁定升级数”监视元素
lock_escals_locklist xs:long lock_escals_locklist -“locklist 锁定升级数”监视元素
lock_escals_maxlocks xs:long lock_escals_maxlocks -“maxlocks 锁定升级数”监视元素
lock_timeouts xs:nonNegativeInteger lock_timeouts - 锁定超时次数
lock_timeouts_global xs:long lock_timeouts_global -“锁定超时全局”监视元素
lock_wait_time xs:nonNegativeInteger lock_wait_time - 等待锁定时间
lock_wait_time_global xs:long lock_wait_time_global -“锁定等待时间全局”监视元素
lock_waits xs:nonNegativeInteger lock_waits - 等待锁定次数
lock_waits_global xs:long lock_waits_global -“锁定等待全局”监视元素
log_buffer_wait_time xs:nonNegativeInteger log_buffer_wait_time - 日志缓冲区等待时间
log_disk_wait_time xs:nonNegativeInteger log_disk_wait_time - 日志磁盘等待时间
log_disk_waits_total xs:nonNegativeInteger log_disk_waits_total-日志磁盘等待总数
成员 xs:nonNegativeInteger 成员-数据库成员
nesting_level xs:nonNegativeInteger nesting_level -“嵌套级别”监视元素
num_agents xs:long num_agents - 正在处理语句的代理程序数监视元素
num_log_buffer_full xs:nonNegativeInteger num_log_buffer_full - 完整日志缓冲区的数量
num_lw_thresh_exceeded xs:nonNegativeInteger num_lw_thresh_out- 超出阈值数
num_routines xs:int num_routines - 例程数
olap_func_overflows xs:long olap_func_overflows -“OLAP 函数溢出次数”监视元素
package_name xs:string(128) package_name - 程序包名
package_schema xs:string(128) package_schema - 程序包模式
package_version_id xs:string(128) package_version_id - 程序包版本
parent_activity_id xs:nonNegativeInteger parent_activity_id - 父活动标识
parent_uow_id xs:nonNegativeInteger parent_uow_id - 父工作单元标识
planid xs:long planid -“查询计划标识”监视元素
pool_col_gbp_indep_pages_found_in_lbp xs:nonNegativeInteger pool_col_gbp_indep_pages_found_in_lbp - 本地缓冲池中发现的独立于缓冲池按列组织 GBP 的页面数
pool_col_gbp_invalid_pages xs:nonNegativeInteger pool_col_gbp_invalid_pages - 缓冲池按列组织 GBP 无效数据页面数
pool_col_gbp_l_reads xs:nonNegativeInteger pool_col_gbp_l_reads - 缓冲池按列组织 GBP 逻辑读取次数
pool_col_gbp_p_reads xs:nonNegativeInteger pool_col_gbp_p_reads - 缓冲池按列组织 GBP 物理读取次数
pool_col_l_reads xs:nonNegativeInteger pool_col_l_reads - 缓冲池按列组织逻辑读取次数
pool_col_lbp_pages_found xs:nonNegativeInteger pool_col_lbp_pages_found - 发现的缓冲池中按列组织的 LBP 页面数
pool_col_p_reads xs:nonNegativeInteger pool_col_p_reads - 缓冲池按列组织物理读取次数
pool_col_writes xs:nonNegativeInteger pool_col_writes - 缓冲池按列组织写入次数
pool_data_gbp_indep_pages_found_in_lbp xs:nonNegativeInteger pool_data_gbp_indep_pages_found_in_lbp -“本地缓冲池中发现的独立于组缓冲池的数据页数”监视元素
pool_data_gbp_invalid_pages xs:long pool_data_gbp_invalid_pages -“组缓冲池无效数据页数”监视元素
pool_data_gbp_l_reads xs:long pool_data_gbp_l_reads -“组缓冲池数据逻辑读取数”监视元素
pool_data_gbp_p_reads xs:long pool_data_gbp_p_reads -“组缓冲池数据物理读取数”监视元素
pool_data_l_reads xs:nonNegativeInteger pool_data_l_reads - 缓冲池数据逻辑读取数
pool_data_lbp_pages_found xs:long pool_data_lbp_pages_found -“本地缓冲池发现的数据页数”监视元素
pool_data_p_reads xs:nonNegativeInteger pool_data_p_reads - 缓冲池数据物理读取数
pool_data_writes xs:nonNegativeInteger pool_data_writes - 缓冲池数据写次数
pool_failed_async_col_reqs xs:nonNegativeInteger pool_failed_async_col_reqs - 失败的按列组织预取请求数
pool_failed_async_data_reqs xs:nonNegativeInteger pool_failed_async_data_reqs -“失败数据预取请求数”监视元素
pool_failed_async_index_reqs xs:nonNegativeInteger pool_failed_async_index_reqs -“失败的索引预取请求数”监视元素
pool_failed_async_other_reqs xs:nonNegativeInteger pool_failed_async_other_reqs -“失败的非预取请求数”监视元素
pool_failed_async_temp_data_reqs xs:nonNegativeInteger pool_failed_async_temp_data_reqs -“失败的临时表空间数据预取请求数”监视元素
pool_failed_async_temp_index_reqs xs:nonNegativeInteger pool_failed_async_temp_index_reqs -“失败的临时表空间索引预取请求数”监视元素
pool_failed_async_temp_xda_reqs xs:nonNegativeInteger pool_failed_async_temp_xda_reqs -“失败的临时表空间 XDA 预取请求数”监视元素
pool_failed_async_temp_col_reqs xs:nonNegativeInteger pool_failed_async_temp_col_reqs - 失败的按列组织临时预取请求数
pool_failed_async_xda_reqs xs:nonNegativeInteger pool_failed_async_xda_reqs -“失败的 XDA 预取请求数”监视元素
pool_index_gbp_indep_pages_found_in_lbp xs:nonNegativeInteger pool_index_gbp_indep_pages_found_in_lbp -“本地缓冲池中发现的独立于组缓冲池的索引页数”监视元素
pool_index_gbp_invalid_pages xs:long pool_index_gbp_invalid_pages -“组缓冲池无效索引页数”监视元素
pool_index_gbp_l_reads xs:long pool_index_gbp_l_reads -“组缓冲池索引逻辑读取数”监视元素
pool_index_gbp_p_reads xs:long pool_index_gbp_p_reads -“组缓冲池索引物理读取数”监视元素
pool_index_l_reads xs:nonNegativeInteger pool_index_l_reads - 缓冲池索引逻辑读取数
pool_index_lbp_pages_found xs:long pool_index_lbp_pages_found -“发现的本地缓冲池索引页数”监视元素
pool_index_p_reads xs:nonNegativeInteger pool_index_p_reads - 缓冲池索引物理读取数
pool_index_writes xs:nonNegativeInteger pool_index_writes - 缓冲池索引写次数
pool_queued_async_col_pages xs:nonNegativeInteger pool_queued_async_col_pages - 按列组织页面预取请求数
pool_queued_async_col_reqs xs:nonNegativeInteger pool_queued_async_col_reqs - 按列组织预取请求数
pool_queued_async_data_pages xs:nonNegativeInteger pool_queued_async_data_pages -“预取请求的数据页数”监视元素
pool_queued_async_data_reqs xs:nonNegativeInteger pool_queued_async_data_reqs -“数据预取请求数”监视元素
pool_queued_async_index_pages xs:nonNegativeInteger pool_queued_async_index_pages -“预取请求的索引页数”监视元素
pool_queued_async_index_reqs xs:nonNegativeInteger pool_queued_async_index_reqs -“索引预取请求数”监视元素
pool_queued_async_temp_col_pages xs:nonNegativeInteger pool_queued_async_temp_col_pages - 按列组织的页面临时预取请求数
pool_queued_async_temp_col_reqs xs:nonNegativeInteger pool_queued_async_temp_col_reqs - 按列组织临时预取请求数
pool_queued_async_other_reqs xs:nonNegativeInteger pool_queued_async_other_reqs-"非预取请求数" 监视元素
pool_queued_async_temp_data_pages xs:nonNegativeInteger pool_queued_async_temp_data_pages -“预取请求的临时表空间数据页数”监视元素
pool_queued_async_temp_data_reqs xs:nonNegativeInteger pool_queued_async_temp_data_reqs -“临时表空间数据预取请求数”监视元素
pool_queued_async_temp_index_pages xs:nonNegativeInteger pool_queued_async_temp_index_pages -“预取请求的临时表空间索引页数”监视元素
pool_queued_async_temp_index_reqs xs:nonNegativeInteger pool_queued_async_temp_index_reqs -“临时表空间索引预取请求数”监视元素
pool_queued_async_temp_xda_pages xs:nonNegativeInteger pool_queued_async_temp_xda_pages -“预取请求的临时表空间 XDA 数据页数”监视元素
pool_queued_async_temp_xda_reqs xs:nonNegativeInteger pool_queued_async_temp_xda_reqs -“临时表空间 XDA 数据预取请求数”监视元素
pool_queued_async_xda_pages xs:nonNegativeInteger pool_queued_async_xda_pages - 预取请求的 XDA 页数
pool_queued_async_xda_reqs xs:nonNegativeInteger pool_queued_async_xda_reqs -“XDA 预取请求数”监视元素
pool_read_time xs:nonNegativeInteger pool_read_time - 缓冲池物理读总时间
pool_temp_col_l_reads xs:nonNegativeInteger pool_temp_col_l_reads - 缓冲池按列组织临时逻辑读取次数
pool_temp_col_p_reads xs:nonNegativeInteger pool_temp_col_p_reads - 缓冲池按列组织临时物理读取次数
pool_temp_data_l_reads xs:nonNegativeInteger pool_temp_data_l_reads - 缓冲池临时数据逻辑读取数
pool_temp_data_p_reads xs:nonNegativeInteger pool_temp_data_p_reads - 缓冲池临时数据物理读取数
pool_temp_index_l_reads xs:nonNegativeInteger pool_temp_index_l_reads - 缓冲池临时索引逻辑读取数
pool_temp_index_p_reads xs:nonNegativeInteger pool_temp_index_p_reads - 缓冲池临时索引物理读取数
pool_temp_xda_l_reads xs:nonNegativeInteger pool_temp_xda_l_reads - 缓冲池临时 XDA 数据逻辑读取数
pool_temp_xda_p_reads xs:nonNegativeInteger pool_temp_xda_p_reads - 缓冲池临时 XDA 数据物理读取数
pool_write_time xs:nonNegativeInteger pool_write_time - 缓冲池物理写总时间
pool_xda_gbp_indep_pages_found_in_lbp xs:nonNegativeInteger pool_xda_gbp_indep_pages_found_in_lbp -“本地缓冲池中发现的独立于组缓冲池的 XDA 页数”监视元素
pool_xda_gbp_invalid_pages xs:nonNegativeInteger pool_xda_gbp_invalid_pages - 组缓冲池无效 XDA 数据页数
pool_xda_gbp_l_reads xs:nonNegativeInteger pool_xda_gbp_l_reads - 组缓冲池 XDA 数据逻辑读取请求数
pool_xda_gbp_p_reads xs:nonNegativeInteger pool_xda_gbp_p_reads - 组缓冲池 XDA 数据物理读取请求数
pool_xda_l_reads xs:nonNegativeInteger pool_xda_l_reads - 缓冲池 XDA 数据逻辑读取数
pool_xda_lbp_pages_found xs:nonNegativeInteger pool_xda_lbp_pages_found - 发现的本地缓冲池 XDA 数据页数
pool_xda_p_reads xs:nonNegativeInteger pool_xda_p_reads - 缓冲池 XDA 数据物理读取数
pool_xda_writes xs:nonNegativeInteger pool_xda_writes - 缓冲池 XDA 数据写次数
post_shrthreshold_hash_joins xs:long post_shrthreshold_hash_joins - 阈值后散列连接数监视元素
post_shrthreshold_sorts xs:nonNegativeInteger post_shrthreshold_sorts - 后共享阈值排序数
post_threshold_col_vector_consumers xs:long post_threshold_col_vector_services-事后阈值 columnar_vector 使用者
post_threshold_hash_grpbys xs:long post_threshold_hash_grpbys-按阈值划分的散列组post_threshold_hash_grpbys-按阈值划分的散列组
post_threshold_hash_joins xs:long post_threshold_hash_joins - 散列连接阈值监视元素
post_threshold_olap_funcs xs:long post_threshold_olap_funcs -“OLAP 函数阈值”监视元素
post_threshold_peas xs:long post_threshold_peas -“部分提前聚集阈值”监视元素
post_threshold_peds xs:long post_threshold_peds -“部分提前相异数阈值”监视元素
post_threshold_sorts xs:nonNegativeInteger post_threshold_sorts - 后阈值排序数
prefetch_wait_time xs:nonNegativeInteger prefetch_wait_time - 等待预取的时间
prefetch_waits xs:nonNegativeInteger prefetch_waits -“预取程序等待计数”监视元素
query_actual_degree xs:int query_actual_degree -“实际运行时分区内并行度”监视元素
query_card_estimate xs:long query_card_estimate -“行查询数估计”监视元素
query_cost_estimate xs:integer query_cost_estimate - 查询估算成本
query_data_tag_list xs:string(32) query_data_tag_list-查询数据标记列表
reclaim_wait_time xs:long reclaim_wait_time -“回收等待时间”监视元素
routine_id xs:nonNegativeInteger routine_id - 例程标识
rows_deleted xs:long rows_deleted -“删除行数”监视元素
rows_inserted xs:long rows_inserted -“插入行数”监视元素
rows_modified xs:nonNegativeInteger rows_modified - 修改的行数
rows_read xs:nonNegativeInteger rows_read - 读取行数
rows_returned xs:nonNegativeInteger rows_returned - 返回的行数
rows_updated xs:long rows_updated -“更新行数”监视元素
section_number xs:integer section_number - 节号
semantic_env_id xs:long semantic_env_id -“查询语义编译环境标识”监视元素
service_class_id xs:integer service_class_id-服务类
service_class_work_class_id xs:nonNegativeInteger service_class_work_class_id -“服务类工作类标识”监视元素
service_class_work_action_set_id xs:nonNegativeInteger service_class_work_action_set_id -“服务类工作操作集标识”监视元素
sort_consumer_heap_top xs:long sort_consumer_heap_top - 单个专用排序堆使用者高水位标记
sort_consumer_shrheap_top xs:long sort_consumer_shrheap_top - 单个共享排序堆使用者高水位标记
sort_heap_allocated xs:long sort_heap_allocated -“分配的总排序堆”监视元素
sort_heap_top xs:long sort_heap_top -“排序专用堆高水位标记”监视元素
sort_overflows xs:nonNegativeInteger sort_overflows - 排序溢出数
sort_shrheap_allocated xs:long sort_shrheap_allocated -“当前分配的共享排序堆”监视元素
sort_shrheap_top xs:long sort_shrheap_top -“共享排序堆高水位标记”监视元素
spacemappage_reclaim_wait_time xs:long spacemappage_reclaim_wait_time -“空间映射页回收等待时间”监视元素
sqlrowsread_threshold_id xs:int sqlrowsread_threshold_id -“读取 SQL 行数阈值标识”监视元素
sqlrowsread_threshold_value xs:long sqlrowsread_threshold_value - 读取 SQL 行数阈值
sqlrowsread_threshold_violated xs: short (1 = yes , 0 = no) sqlrowsread_threshold_violated - 违反读取 SQL 行数阈值
sqlrowsreadinsc_threshold_id xs:int sqlrowsreadinsc_threshold_id-在服务阈值标识中读取的 SQL 行数
sqlrowsreadinsc_threshold_value xs:long sqlrowsreadinsc_threshold_value-在服务阈值中读取的 SQL 行数
sqlrowsreadinsc_threshold_violated xs: short (1 = yes , 0 = no) sqlrowsreadinsc_threshold_violated-违反在服务阈值中读取的 SQL 行数
sqlrowsreturned_threshold_id xs:int sqlrowsreturned_threshold_id - 返回所读取 SQL 行数阈值标识
sqlrowsreturned_threshold_value xs:long sqlrowsreturned_threshold_value - 返回所读取 SQL 行数阈值
sqlrowsreturned_threshold_violated xs: short (1 = yes , 0 = no) sqlrowsreturned_threshold_violated - 违反返回所读取 SQL 行数阈值
sqltempspace_threshold_id xs:int sqltempspace_threshold_id - SQL 临时空间阈值标识
sqltempspace_threshold_value xs:long sqltempspace_threshold_value - SQL 临时空间阈值
sqltempspace_threshold_violated xs: short (1 = yes , 0 = no) sqltempspace_threshold_violated - 违反 SQL 临时空间阈值
stmt_exec_time xs:nonNegativeInteger stmt_exec_time - 语句执行时间
stmt_pkg_cache_id xs:nonNegativeInteger stmt_pkgcache_id - 语句程序包高速缓存标识
stmt_text xs:string stmt_text-SQL 语句文本。 如果活动是动态 SQL 或它是语句文本可用的静态 SQL ,那么此字段包含语句文本的前 1024 个字符。 否则,它包含空字符串。
stmtid xs:long stmtid -“查询语句标识”监视元素
stmtno xs:int stmtno -“语句号”监视元素
thresh_violations xs:nonNegativeInteger thresh_violations - 阈值违例次数
total_act_time xs:nonNegativeInteger total_act_time - 活动总时间
total_act_wait_time xs:nonNegativeInteger total_act_wait_time - 活动等待总时间
total_app_section_executions xs:nonNegativeInteger total_app_section_间执行数-段执行总数
total_col_executions xs:nonNegativeInteger total_col_executions - 按列组织的总计执行次数
total_col_proc_time xs:nonNegativeInteger total_col_proc_time - 按列组织的总计处理时间
total_col_synopsis_executions xs:nonNegativeInteger total_col_synopsis_executions -“列组织概要表执行总次数”监视元素
total_col_synopsis_proc_time xs:nonNegativeInteger total_col_synopsis_proc_time -“列组织概要表处理时间总计”监视元素
total_col_synopsis_time xs:nonNegativeInteger total_col_synopsis_time -“列组织概要表时间总计”监视元素
total_col_time xs:nonNegativeInteger total_col_time - 散列循环总数
total_col_vector_consumers xs:long total_col_vector_使用者-columnar_vector 使用者总数
total_cpu_time xs:nonNegativeInteger total_cpu_time - CPU 总时间
total_disp_run_queue_time xs:long total_disp_run_queue_time-"分派器运行队列总时间" 监视元素 (以微秒为单位)
total_extended_latch_wait_time xs:nonNegativeInteger total_extended_latch_wait_time -“扩展锁存器等待总时间”监视元素
total_extended_latch_waits xs:nonNegativeInteger total_extended_latch_waits -“扩展锁存器等待总计”监视元素
total_hash_grpbys xs:long total_hash_grpbys - 散列 GROUP BY 操作总数
total_hash_joins xs:long total_hash_joins -“散列连接总数”监视元素
total_hash_loops xs:long total_hash_loops -“总散列循环数”监视元素
total_index_build_proc_time xs:long total_index_build_proc_time-由于创建索引而构建索引所耗用的非等待总时间
total_index_build_time xs:long total_index_build_time-由于创建索引而构建索引所耗用的总时间
total_indexes_built xs:long total_indexes_built - 构建的索引总数
total_olap_funcs xs:long total_olap_funcs -“OLAP 函数总数”监视元素
total_peas xs:long total_peas -“部分提前聚集总数”监视元素
total_peds xs:long total_peds -“部分提前相异总数”监视元素
total_routine_invocations xs:nonNegativeInteger total_routine_invocations - 例程调用总计
total_routine_non_sect_proc_time xs:nonNegativeInteger total_routine_non_sect_proc_time - 非部分处理时间
total_routine_non_sect_time xs:nonNegativeInteger total_routine_non_sect_time - 非部分例程执行时间
total_routine_time xs:nonNegativeInteger total_routine_time - 例程总时间
total_routine_user_code_proc_time xs:nonNegativeInteger total_routine_user_code_proc_time - 例程用户代码处理总时间
total_routine_user_code_time xs:nonNegativeInteger total_routine_user_code_time - 例程用户代码总时间
total_section_proc_time xs:nonNegativeInteger total_section_proc_time - 部分处理总时间
total_section_sort_proc_time xs:nonNegativeInteger total_section_sort_proc_time - 节排序处理总时间
total_section_sort_time xs:nonNegativeInteger total_section_sort_time-段排序总时间
total_section_sorts xs:nonNegativeInteger total_section_orders-节排序总数
total_section_time xs:nonNegativeInteger total_section_time - 部分总时间
total_sorts xs:nonNegativeInteger total_sorts - 排序总数
total_sync_runstats xs:nonNegativeInteger total_sync_runstats -“同步 RUNSTATS 活动总数”监视元素
tq_sort_heap_rejections xs:long tq_sort_heap_rejections -“表队列排序堆拒绝数”监视元素
tq_sort_heap_requests xs:long tq_sort_heap_requests -“表队列排序堆请求数”监视元素
tq_tot_send_spills xs:nonNegativeInteger tq_tot_send_spills-溢出的表队列缓冲区总数
uow_id xs:nonNegativeInteger uow_id - 工作单元标识
utility_id xs:nonNegativeInteger utility_id - 实用程序标识
utility_invocation_id xs:hexBinary utility_invocation_id -“实用程序调用标识”监视元素
wl_work_action_set_id xs:nonNegativeInteger wl_work_action_set_id -“工作负载工作操作集标识”
wl_work_class_id xs:nonNegativeInteger wl_work_class_id - 工作负载工作类标识
wlm_queue_assignments_total xs:nonNegativeInteger wlm_queue_assignments_total - 工作负载管理器队列分配总次数
wlm_queue_time_total xs:nonNegativeInteger wlm_queue_time_total - 工作负载管理器队列总时间

使用说明

MON_GET_ACTIVITY_DETAILS 函数为格式化输出提供了最大的灵活性,因为它将单个活动的详细信息作为 XML 文档返回。 XML 输出包含描述性信息 (例如,语句文本) 和度量。 可以通过 XML 解析器直接解析输出,也可以通过 XMLTABLE 函数将输出转换为关系格式,如示例中所示。

通过此函数报告的度量 (例如, CPU 使用率) 将在活动生存期内定期汇总到活动中。 因此,此表函数报告的值反映最新汇总时系统的当前状态。

活动度量通过工作负载上的 COLLECT ACTIVITY METRICS 子句或数据库级别的 mon_act_metrics 数据库配置参数进行控制。 如果提交活动的连接与启用了活动度量值的工作负载或数据库相关联,那么将收集度量值。 如果未针对某个活动收集活动度量值,那么会将所有度量值报告为 0。

MON_GET_ACTIVITY_DETAILS 表函数针对存在该活动的每个成员返回一行数据。 不会对度量值执行跨成员的聚集。 但是,可以通过 SQL 查询来实现聚集。

在 DETAILS 列中返回的 XML 文档的模式在文件 sqllib/misc/DB2MonRoutines.xsd 中可用。 可以在 sqllib/misc/DB2MonCommon.xsd 文件中找到更多详细信息。

示例

调查长时间运行的查询,以确定它是否正在花费时间执行或等待 (例如,锁定或 I/O 被阻塞)。

注: 可以将以下查询组合到一个语句中,并在 2 步骤中显示,以了解清楚的原因。 此外,如果要检索完整文本,可以使用可执行标识从 MON_GET_PKG_CACHE_STMT 表函数获取语句文本。

  1. 首先使用 WLM_GET_WORKLOAD_OCCURRENCE_ACTIVITIES 表函数来列出活动及其开始时间。
    SELECT application_handle, 
           activity_id, 
           uow_id, 
           local_start_time 
    FROM TABLE(
       WLM_GET_WORKLOAD_OCCURRENCE_ACTIVITIES(
          cast(NULL as bigint), -1)
    ) AS T
    下列是从此查询输出的示例。
    APPLICATION_HANDLE   ACTIVITY_ID UOW_ID      LOCAL_START_TIME          
    -------------------- ----------- ----------- --------------------------
                       7           1           2 2008-06-10-10.06.55.675668
                      16           1           7 2008-06-10-10.08.38.613610
    
      2 record(s) selected.
    
  2. 然后使用 MON_GET_ACTIVITY_DETAILS 表函数来查看活动等待的时间百分比。
    SELECT actmetrics.application_handle,
      actmetrics.activity_id,
      actmetrics.uow_id,
      varchar(actmetrics.stmt_text, 50) as stmt_text,
      actmetrics.total_act_time,
      actmetrics.total_act_wait_time,
      CASE WHEN actmetrics.total_act_time > 0
        THEN DEC((
          FLOAT(actmetrics.total_act_wait_time) / 
          FLOAT(actmetrics.total_act_time)) * 100, 5, 2)
        ELSE NULL
      END AS PERCENTAGE_WAIT_TIME 
    FROM TABLE(MON_GET_ACTIVITY_DETAILS(7, 2, 1, -2)) AS ACTDETAILS,
    XMLTABLE (XMLNAMESPACES( DEFAULT 'http://www.ibm.com/xmlns/prod/db2/mon'),
      '$actmetrics/db2_activity_details' 
      PASSING XMLPARSE(DOCUMENT ACTDETAILS.DETAILS) as "actmetrics"
      COLUMNS "APPLICATION_HANDLE" INTEGER PATH 'application_handle', 
        "ACTIVITY_ID" INTEGER PATH 'activity_id',
        "UOW_ID" INTEGER PATH 'uow_id',
        "STMT_TEXT" VARCHAR(1024) PATH 'stmt_text',
        "TOTAL_ACT_TIME" INTEGER PATH 'activity_metrics/total_act_time',
        "TOTAL_ACT_WAIT_TIME" INTEGER PATH 'activity_metrics/total_act_wait_time'
      ) AS ACTMETRICS;
    

    下列是从此查询输出的示例。

    APPLICATION_HANDLE ACTIVITY_ID UOW_ID      ... 
    ------------------ ----------- ----------- ... 
                     7           1           2 ... 
    
      1 record(s) selected.
    

    查询的输出(继续)。

    ... STMT_TEXT                                          ... 
    ... -------------------------------------------------- ... 
    ... select * from syscat.tables optimize for 1 row     ... 

    查询的输出(继续)。

    ... TOTAL_ACT_TIME TOTAL_ACT_WAIT_TIME PERCENTAGE_WAIT_TIME
    ... -------------- ------------------- --------------------
    ...            459                   0                 0.00

使用 MON_GET_ACTIVITY_DETAILS 表函数可创建用于捕获有关系统上当前正在运行的所有活动的信息的查询。

  • 示例 1: 使用命令行处理器 (CLP) 运行以下命令
    WITH A1 AS 
       (SELECT * FROM TABLE(wlm_get_workload_occurrence_activities(null, -1)) 
        WHERE activity_id > 0 ) 
    SELECT A1.application_handle, 
      A1.activity_id, 
      A1.uow_id, 
      total_act_time, 
      total_act_wait_time, 
      varchar(actmetrics.stmt_text, 50) AS stmt_text FROM A1, 
    TABLE(MON_GET_ACTIVITY_DETAILS(A1.application_handle, A1.uow_id,A1.activity_id, -1)) 
        AS ACTDETAILS, 
    XMLTABLE (XMLNAMESPACES( DEFAULT 'http://www.ibm.com/xmlns/prod/db2/mon'), 
     '$actmetrics/db2_activity_details' 
     PASSING XMLPARSE(DOCUMENT ACTDETAILS.DETAILS) AS "actmetrics" 
     COLUMNS "STMT_TEXT" VARCHAR(1024) PATH 'stmt_text', 
     "TOTAL_ACT_TIME" INTEGER PATH 'activity_metrics/total_act_time', 
     "TOTAL_ACT_WAIT_TIME" INTEGER PATH 'activity_metrics/total_act_wait_time' ) 
     AS ACTMETRICS

    以下是此查询的输出的示例:

    APP...HANDLE  A..._ID  UOW_ID  T...ACT_TIME  T...WAIT_TIME  
    ------------  -------  ------  ------------  -------------  
    15            1        5       16            5              
    15            1        3       17            5              
    7             1        49      0             0              
    SQL0445W Value "with A1 as (select * from table(wlm_get_workload
    3 record(s) selected with 1 warning messages printed.

    以下样本继续此查询的输出:

    ... STMT_TEXT
    ... -------------------------------------------------
    ... select name from sysibm.systables
    ... select * from sysibm.systables
    ... with A1 as (select * from table(wlm_get_workload_o
    _occurrence_" has been truncated. SQLSTATE=01004
    
    3 record(s) selected with 1 warning messages printed.