我如何找到 DB2 10.5 及更高版本中最旧的活动事务?
How can I find the oldest active transaction in DB2 10.5 and up?
由于 SNAPAPPL 管理视图和 SNAP_GET_APPL table 功能已弃用,在 10.5 及更高版本中,如何通过其他方式找到最旧的活动事务?
您可以使用以下函数获取以前由已弃用的"snap" 管理视图
提供的信息
MON_GET_TRANSACTION_LOG
MON_GET_UNIT_OF_WORK
MON_GET_DATABASE
查询可能如下所示:
select integer(mtl.applid_holding_oldest_xact) as "Oldest Transaction",
integer(muow.uow_log_space_used /1024 / 1024) as "Log used(Mb)",
integer(muow.num_locks_held) as "Locks Held",
integer(muow.client_idle_wait_time) as "Idle (seconds)",
time(muow.uow_stop_time) as "UOW Stop Time",
muow.rows_returned as "Rows Returned",
muow.rows_read as "Rows Read",
integer(muow.rows_inserted) as "Rows Inserted",
integer(muow.rows_updated) as "Rows Updated",
integer(muow.rows_deleted) as "Rows Deleted"
from table(mon_get_transaction_log(-1)) mtl
inner join
table(mon_get_unit_of_work(null,-1)) muow
on muow.member = mtl.member
and muow.application_handle = mtl.applid_holding_oldest_xact
正确!您可以使用 MON_GET_TRANSACTION_LOG
table 函数。这是在知识中心 (link) 中找到的另一个查询:
Select MEMBER, CUR_COMMIT_DISK_LOG_READS, CURRENT_ACTIVE_LOG,
APPLID_HOLDING_OLDEST_XACT from table(mon_get_transaction_log(-1)) as t
order by member asc
输出:
MEMBER CUR_COMMIT_DISK_LOG_READS CURRENT_ACTIVE_LOG APPLID_HOLDING_OLDEST_XACT
------ ------------------------- ------------------ --------------------------
0 9999 1 7
由于 SNAPAPPL 管理视图和 SNAP_GET_APPL table 功能已弃用,在 10.5 及更高版本中,如何通过其他方式找到最旧的活动事务?
您可以使用以下函数获取以前由已弃用的"snap" 管理视图
提供的信息MON_GET_TRANSACTION_LOG
MON_GET_UNIT_OF_WORK
MON_GET_DATABASE
查询可能如下所示:
select integer(mtl.applid_holding_oldest_xact) as "Oldest Transaction",
integer(muow.uow_log_space_used /1024 / 1024) as "Log used(Mb)",
integer(muow.num_locks_held) as "Locks Held",
integer(muow.client_idle_wait_time) as "Idle (seconds)",
time(muow.uow_stop_time) as "UOW Stop Time",
muow.rows_returned as "Rows Returned",
muow.rows_read as "Rows Read",
integer(muow.rows_inserted) as "Rows Inserted",
integer(muow.rows_updated) as "Rows Updated",
integer(muow.rows_deleted) as "Rows Deleted"
from table(mon_get_transaction_log(-1)) mtl
inner join
table(mon_get_unit_of_work(null,-1)) muow
on muow.member = mtl.member
and muow.application_handle = mtl.applid_holding_oldest_xact
正确!您可以使用 MON_GET_TRANSACTION_LOG
table 函数。这是在知识中心 (link) 中找到的另一个查询:
Select MEMBER, CUR_COMMIT_DISK_LOG_READS, CURRENT_ACTIVE_LOG,
APPLID_HOLDING_OLDEST_XACT from table(mon_get_transaction_log(-1)) as t
order by member asc
输出:
MEMBER CUR_COMMIT_DISK_LOG_READS CURRENT_ACTIVE_LOG APPLID_HOLDING_OLDEST_XACT
------ ------------------------- ------------------ --------------------------
0 9999 1 7