DB2日常管理

 

执行时间最长的10条SQL语句(按时间降序排列),可保存为脚本方便调用:
db2 "SELECT rows_read / (num_executions + 1) as avg_rows_read,rows_written / (num_executions + 1) as avg_rows_written,stmt_sorts / (num_executions + 1) as avg_sorts,total_exec_time / (num_executions + 1) as avg_exec_time,substr(stmt_text,1,1000) as SQL_Stmt FROM SYSIBMADM.SNAPDYN_SQL ORDER BY avg_exec_time desc fetch first 10 rows only"

db2 "select agent_id,appl_status,elapsed_time_min from sysibmadm.long_running_sql order by elapsed_time_min desc fetch first 5 rows only"

db2 "select AGENT_ID,appl_name,stmt_text from sysibmadm.long_running_sql" |grep -i delete from TB_TMG_DEMO

DB2中如何快速定位锁等待语句
https://www.linuxidc.com/Linux/2014-01/95048.htm

DB2日常监控脚本:http://blog.itpub.net/22661144/viewspace-1477178/

posted on 2019-09-17 14:33  HelonTian  阅读(274)  评论(0编辑  收藏  举报