Customer said, they got the following Errors in applications logs

Caused by: financing.tools.hub.shared.exception.R2FException: com.ibm.db2.jcc.am.SqlTransactionRollbackException: DB2 SQL Error: SQLCODE=-911, SQLSTATE=40001, SQLERRMC=68, 
DRIVER=4.15.146

I checked the db2diag.log, there is no any logs related with the error. then I check the dbm cfg

Diagnostic error capture level              (DIAGLEVEL) = 3

DBM configure Parameter

# db2 get dbm cfg | grep -i lock
Lock (DFT_MON_LOCK) = OFF

DB  configure Parameter

 Max storage for lock list (4KB)              (LOCKLIST) = 12000
Percent. of lock lists per application (MAXLOCKS) = 80
Interval for checking deadlock (ms) (DLCHKTIME) = 10000
Lock timeout (sec) (LOCKTIMEOUT) = 600
Block log on disk full (BLK_LOG_DSK_FUL) = NO
Block non logged operations (BLOCKNONLOGGED) = NO
Lock timeout events (MON_LOCKTIMEOUT) = NONE
Deadlock events (MON_DEADLOCK) = WITHOUT_HIST
Lock wait events (MON_LOCKWAIT) = NONE
Lock wait event threshold (MON_LW_THRESH) = 4294967295
Lock event notification level (MON_LCK_MSG_LVL) = 1

I advice customer to use event monitor  to monitor the database.

Step 1:  check event and drop the not useful event

SET EVENT MONITOR DB2DETAILDEADLOCK state 0
DROP EVENT MONITOR DB2DETAILDEADLOCK

Keep in mind that monitor events are a heap_size consuming memory. So verify that mon_heap_sz is set correctly (e.g. automatic )

Step 2:  create an tablespace used by event monitor

db2 "CREATE BUFFERPOOL BP32K_LOCK  IMMEDIATE SIZE 2500 AUTOMATIC PAGESIZE 32K"
db2 "CREATE LARGE TABLESPACE TSTLOCK PAGESIZE 32K MANAGED BY DATABASE
USING (FILE '/db/a3inr2f/db2data/r2fapp/a3inr2f/NODE0000/tstlock' 100M)
AUTORESIZE yes
BUFFERPOOL BP32K_LOCK dropped table recovery on" db2 "CREATE EVENT MONITOR locktimeoutevm for locking write to unformatted event table (table AUTOMON.TLOCKS in TSTLOCK) MANUALSTART "
db2 "set event monitor locktimeoutevm state=1" db2 "CREATE SYSTEM TEMPORARY TABLESPACE TEMPSYS32K PAGESIZE 32 K BUFFERPOOL BP32K_LOCK"

Step 3: verify the creation of event monitor

db2 "select VARCHAR(evmonname,30) as evmonname, EVENT_MON_STATE(evmonname) as state from syscat.eventmonitors"

Step 4: Now we have the monitor for locking, but we need to setup some parameters:
— Set up the MON_LOCKTIMEOUT

— By default, this parameter is set to NONE. Possible values include:

NONE no data is collected on lock timeouts (DEFAULT)
WITHOUT_HIST data about lock timeout events is sent to any active event monitor tracking locking events
HISTORY the last 250 activities performed in the same
UOW are tracked by event monitors tracking locking events, in addition
to the data about lock timeout events.
HIST_AND_VALUES In addition to the the last 250
activities perfromed in the same UOW and the data about lock timeout
events, values that are not long or xml data are also sent to any active
event monitor tracking locking events

step 5: Open the monitor

update db cfg for <dbname> using MON_LOCKTIMEOUT HIST_AND_VALUES immediate

step 6:  解析日志

方法一:

format the unformatted event to the table we have create in precedence

db2 "call EVMON_FORMAT_UE_TO_TABLES ('LOCKING', NULL, NULL, NULL, 'AUTOMON ', NULL, NULL, -1, 'SELECT * FROM AUTOMON.TLOCKS ORDER BY event_timestamp')"

extract and delete the data from the UE table

db2 "call EVMON_FORMAT_UE_TO_TABLES ('LOCKING', NULL, NULL, NULL, 'AUTOMON ', NULL, 'PRUNE_UE_TABLE', -1, 'SELECT * FROM AUTOMON.TLOCKS ORDER BY event_timestamp')"
db2 "call EVMON_FORMAT_UE_TO_TABLES ('LOCKING', NULL, NULL, NULL, 'AUTOMON ', NULL, 'recreate_force', -1, 'SELECT * FROM AUTOMON.TLOCKS ORDER BY event_timestamp')"

if you run the procedure "EVMON_FORMAT_UE_TO_TABLES",  DB will create the following tables

LOCK_ACTIVITY_VALUES
LOCK_EVENT
LOCK_PARTICIPANTS
LOCK_PARTICIPANT_ACTIVITIES
List all locking event:
-----------------------------------------------------------------------
db2 "select event_id
, substr(event_type,1,18) as event_type
, event_timestamp, dl_conns
, rolled_back_participant_no
from db2inst1.LOCK_EVENT
order by event_id
, event_timestamp
with ur" To summarize counts according to event_type: ----------------------------------------------------------------------- db2 "select substr(event_type,1,18) as event_type
, count(*) as count
, sum(dl_conns) sum_involved_connections
from db2inst1.LOCK_EVENT
group by event_type
with ur" To summarize counts according to day: ----------------------------------------------------------------------- db2 "select substr(event_type,1,18) as event_type , year(event_timestamp) as year , month(event_timestamp) as month , day(event_timestamp) as day , hour(event_timestamp) as hour ,
count(*) as count
from db2inst1.LOCK_EVENT
group by year(event_timestamp) , month(event_timestamp) , day(event_timestamp) , hour(event_timestamp) , event_type
order by year(event_timestamp) , month(event_timestamp) , day(event_timestamp) , hour(event_timestamp) , event_type with ur" To summarize counts according to table:
db2 "select substr(lp.table_schema,1,18) as table_schema , substr(lp.table_name,1,30) as table_name , substr(le.event_type,1,18) as lock_event , count(*)/2 as count
from db2inst1.LOCK_PARTICIPANTS lp, db2inst1.LOCK_EVENT le where lp.xmlid=le.xmlid
group by lp.table_schema, lp.table_name, le.event_type order by lp.table_schema, lp.table_name, le.event_type with ur" To summarize counts according to statement:
db2 "with t1 as ( select STMT_PKGCACHE_ID as STMT_PKGCACHE_ID , count(*) as stmt_count
from db2inst1.lock_participant_activities where activity_type='current' group by STMT_PKGCACHE_ID)
select t1.stmt_count , (select substr(STMT_TEXT,1,100) as stmt_text from db2inst1.lock_participant_activities a1 where a1.STMT_PKGCACHE_ID=t1.STMT_PKGCACHE_ID fetch first 1 row only)
from t1 order by t1.stmt_count desc with ur"

方法二:

a. locate to $HOME/sqllib/samples/java/jdbc
    b. compile the source code : $HOME/sqllib/java/jdk64/bin/javac db2evmonfmt.java

    c. run the tool : $HOME/sqllib/java/jdk64/bin/java db2evmonfmt -d <dbname>  
-ue <unformatted evmon table name> -ftext -hours 1 -type LOCKTIMEOUT

        (For db2jcct error, export LIBPATH=$HOME/sqllib/lib64:$LIBPATH)

Collecting data: DB2 lock timeouts

DB2 Event monitor for deadlock and lock timeout

Locks – Timeout vs. Deadlock

Collecting data: DB2 lock timeouts

【DB2】Event monitor for locking的更多相关文章

  1. 【DUBBO】Dubbo:monitor的配置

    [一]:配置项 <dubbo:monitor protocol="registry"/> [二]:配置解析器-->具体解析器为com.alibaba.dubbo. ...

  2. 【js】event(事件对象)详解

    1.事件对象 Event 对象代表事件的状态,比如事件在其中发生的元素.键盘按键的状态.鼠标的位置.鼠标按钮的状态. 什么时候会产生Event 对象呢? 例如: 当用户单击某个元素的时候,我们给这个元 ...

  3. 【DB2】表空间相关详细说明

    -.创建表空间 1.创建用户表空间 声明:在指定表空间创建路径的时候,需要指定空文件夹,非空文件夹会导致创建报错!!!如果文件夹不存在,那么在创建表空间的时候会自动创建文件夹! 1.1 创建SMS表空 ...

  4. 【DB2】监控临时表空间使用

    在我们使用数据库的时候,我们都知道应用程序在DB2上运行时,会产生临时表空间,我们想要监测这些临时表空间的使用情况,可以使用以下步骤: (1)打开monitor switches 中的table监视器 ...

  5. 【DB2】国标行业分类存储,通过SQL查询出层级关系

    新建表 DROP TABLE Industry; CREATE TABLE Industry( IndustryCode VARCHAR(40),IndustryName VARCHAR(100),P ...

  6. 【前端】event.target 和 event.currentTarget 的区别

    event.target 和 event.currentTarget 的区别 举例说明: <!DOCTYPE html> <html> <head> <tit ...

  7. 【MySQL】Event事件与游标

    MySQL的事件就像Linux系统上的定时任务,按照设置的时间或者间隔时间执行设置好的任务. 如果用SQLyog一类的写存储过程.触发器或者事件会省事一些,例如SQLyog就会生成一个大致的模板: D ...

  8. 【JAVASCRIPT】event对象

    一.preventDefault  与 stopPropagation event.preventDefault() 和 event.stopPropagation() 不是JQuery的方法,是JS ...

  9. 【转载】sql monitor

    来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/27067062/viewspace-2129635/ SQL Monitor Report 1. SQL Monit ...

随机推荐

  1. 网络文件系统NFS

    NFS介绍 什么是NFS? NFS是Network File System的缩写,即网络文件系统.它的主要功能是通过网络(一般是局域网)让不同的主机系统之间可以共享文件或目录.NFS客户端(一般为应用 ...

  2. 跑python用ThinkPad好还是MacBook好?

    跑Python,那肯定是服务器操作系统最好,找个方便安装Linux的本子. 我想题主的意图应该是做Python开发吧,如果是Python开发,还要看一下开发方向,如果是网络爬虫.服务器后端编程类的,那 ...

  3. wget下载指定URL下的特定属性文件

    例子:下载指定URL下的kernel开头的所有包 wget https://archives.fedoraproject.org/pub/fedora/linux/updates/28/Everyth ...

  4. spring mvc+mybatis 构建 cms + 实现UC浏览器文章功能

    最近公司在模拟UC浏览器做一个简单的cms系统,主要针对于企业内部的文章浏览需求,这边考虑用户大多用mobile浏览文章内容,故使用原生的ios和android进行开发,后面也会集成html5. 1. ...

  5. .net amr格式文件转换成mp3格式文件的方法

    前言:winform端对于音频文件的格式多有限制,大多数不支持amr格式的文件的播放.但是,手机端传过来的音频文件大多数是amr格式的文件,所以,要想在winform客户端支持音频文件的播放,可以通过 ...

  6. jQuery的事件,动画效果等

    一.事件 click(function(){}) 点击事件 hover(function(){})   悬浮事件,这是jQuery封装的,js没有不能绑定事件 focus(function(){}) ...

  7. Linux 下查看我们的不速之客

    我们通过下面这个命令,可以查看 VPS 上还有谁在登陆: w 输出类似下列信息: 23:20:00 up 960 days, 4:29, 2 user, load average: 0.05, 0.0 ...

  8. Forward团队-爬虫豆瓣top250项目-项目进度

    项目地址:https://github.com/xyhcq/top250 我们的项目是爬取豆瓣top250的电影的信息,在做这个项目前,我们都没有经验,完全是从零开始,过程中也遇到了很多困难,不过我们 ...

  9. 【python-appium】手机一直提示重新安装settings unlock 输入法等 注释掉以下代码

    注释掉目录:C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android.js this.initUnic ...

  10. Codeforces Round #512 (Div. 2) D. Vasya and Triangle

    参考了别人的思路:https://blog.csdn.net/qq_41608020/article/details/82827632 http://www.cnblogs.com/qywhy/p/9 ...