问题:

最近遇到一个问题,Db2应用状态是UOW Waiting,但Most recent operation是Fetch,并且Rows fetched在不断增加,于是模拟了这一现象。

完整的应用快照如下:

inst105@NODE01:~> db2 get snapshot for application agentid 27385Application SnapshotApplication handle                         = 27385
Application status                         = UOW Waiting
Status change time                         = 05/21/2020 13:38:24.897981
Application code page                      = 1208
Application country/region code            = 0
DUOW correlation token                     = 197.0.0.1.45730.200521052846
Application name                           = db2jcc_application
Application ID                             = 197.0.0.1.45730.200521052846
Sequence number                            = 00002
TP Monitor client user ID                  =
TP Monitor client workstation name         = 197.0.0.1
TP Monitor client application name         =
TP Monitor client accounting string        =Connection request start timestamp         = 05/21/2020 13:28:44.273888
Connect request completion timestamp       = 05/21/2020 13:28:44.274760
Application idle time                      = 6 seconds
CONNECT Authorization ID                   = inst105
Client login ID                            = inst105
Configuration NNAME of client              = 197.0.0.1
Client database manager product ID         = JCC03690
Process ID of client application           = 0
Platform of client application             = Unknown via DRDA
Communication protocol of client           = TCP/IPInbound communication address              = 197.0.0.1 45730Database name                              = SAMPLE
Database path                              = /home/inst105/inst105/NODE0000/SQL00001/MEMBER0000/
Client database alias                      = SAMPLE
Input database alias                       =
Last reset timestamp                       =
Snapshot timestamp                         = 05/21/2020 13:38:30.142379
Authorization level granted                =User authority:DBADM authoritySECADM authorityDATAACCESS authorityACCESSCTRL authorityGroup authority:SYSADM authoritySYSMAINT authorityCREATETAB authorityBINDADD authorityCONNECT authorityIMPLICIT_SCHEMA authoritySYSMON authority
Coordinator member number                  = 0
Current member number                      = 0
Coordinator agent process or thread ID     = 11759
Current Workload ID                        = 1
Agents stolen                              = 0
Agents waiting on locks                    = 0
Maximum associated agents                  = 1
Priority at which application agents work  = 0
Priority type                              = DynamicLock timeout (seconds)                     = -1
Locks held by application                  = 3
Lock waits since connect                   = 0
Time application waited on locks (ms)      = 0
Deadlocks detected                         = 0
Lock escalations                           = 0
Exclusive lock escalations                 = 0
Number of Lock Timeouts since connected    = 0
Total time UOW waited on locks (ms)        = 0Total sorts                                = 0
Total sort time (ms)                       = 0
Total sort overflows                       = 0Buffer pool data logical reads             = 6
Buffer pool data physical reads            = 0
Buffer pool temporary data logical reads   = 0
Buffer pool temporary data physical reads  = 0
Buffer pool data writes                    = 0
Buffer pool index logical reads            = 4
Buffer pool index physical reads           = 0
Buffer pool temporary index logical reads  = 0
Buffer pool temporary index physical reads = 0
Buffer pool index writes                   = 0
Buffer pool xda logical reads              = 0
Buffer pool xda physical reads             = 0
Buffer pool temporary xda logical reads    = 0
Buffer pool temporary xda physical reads   = 0
Buffer pool xda writes                     = 0
Total buffer pool read time (milliseconds) = 0
Total buffer pool write time (milliseconds)= 0
Time waited for prefetch (ms)              = 0
Unread prefetch pages                      = 0
Direct reads                               = 0
Direct writes                              = 0
Direct read requests                       = 0
Direct write requests                      = 0
Direct reads elapsed time (ms)             = 0
Direct write elapsed time (ms)             = 0Number of SQL requests since last commit   = 61
Commit statements                          = 1
Rollback statements                        = 0
Dynamic SQL statements attempted           = 1
Static SQL statements attempted            = 1
Failed statement operations                = 1
Select SQL statements executed             = 1
Xquery statements executed                 = 0
Update/Insert/Delete statements executed   = 0
DDL statements executed                    = 0
Inactive stmt history memory usage (bytes) = 0
Internal automatic rebinds                 = 0
Internal rows deleted                      = 0
Internal rows inserted                     = 0
Internal rows updated                      = 0
Internal commits                           = 1
Internal rollbacks                         = 0
Internal rollbacks due to deadlock         = 0
Binds/precompiles attempted                = 0
Rows deleted                               = 0
Rows inserted                              = 0
Rows updated                               = 0
Rows selected                              = 590
Rows read                                  = 590
Rows written                               = 0UOW log space used (Bytes)                 = 0
Previous UOW completion timestamp          = 05/21/2020 13:28:44.390162
Elapsed time of last completed uow (sec.ms)= 0.022277
UOW start timestamp                        = 05/21/2020 13:28:44.398776
UOW stop timestamp                         =
UOW completion status                      =Open remote cursors                        = 1
Open remote cursors with blocking          = 1
Rejected Block Remote Cursor requests      = 0
Accepted Block Remote Cursor requests      = 1
Open local cursors                         = 0
Open local cursors with blocking           = 0
Total User CPU Time used by agent (s)      = 0.057733
Total System CPU Time used by agent (s)    = 0.000000
Host execution elapsed time                = 0.003211Package cache lookups                      = 1
Package cache inserts                      = 0
Application section lookups                = 61
Application section inserts                = 0
Catalog cache lookups                      = 30
Catalog cache inserts                      = 0
Catalog cache overflows                    = 0
Catalog cache high water mark              = 0Workspace InformationMost recent operation                      = Fetch
Cursor name                                = SQL_CURSH200C1
Most recent operation start timestamp      = 05/21/2020 13:28:44.399010
Most recent operation stop timestamp       = 05/21/2020 13:38:24.897980
Agents associated with the application     = 1
Number of hash joins                       = 0
Number of hash loops                       = 0
Number of hash join overflows              = 0
Number of small hash join overflows        = 0
Number of OLAP functions                   = 0
Number of OLAP function overflows          = 0Statement type                             = Dynamic SQL Statement
Statement                                  = Fetch
Section number                             = 1
Application creator                        = NULLID
Package name                               = SYSSH200
Consistency Token                          =
Package Version ID                         =
Cursor name                                = SQL_CURSH200C1
Statement member number                    = 0
Statement start timestamp                  = 05/21/2020 13:28:44.399010
Statement stop timestamp                   = 05/21/2020 13:38:24.897980
Elapsed time of last completed stmt(sec.ms)= 0.000104
Total Statement user CPU time              = 0.053066
Total Statement system CPU time            = 0.000000
SQL compiler cost estimate in timerons     = 81
SQL compiler cardinality estimate          = 10000
Degree of parallelism requested            = 1
Number of agents working on statement      = 1
Number of subagents created for statement  = 1
Statement sorts                            = 0
Total sort time                            = 0
Sort overflows                             = 0
Rows read                                  = 590
Rows written                               = 0
Internal rows deleted                      = 0
Internal rows updated                      = 0
Internal rows inserted                     = 0
Rows fetched                               = 590
Buffer pool data logical reads             = 6
Buffer pool data physical reads            = 0
Buffer pool temporary data logical reads   = 0
Buffer pool temporary data physical reads  = 0
Buffer pool index logical reads            = 0
Buffer pool index physical reads           = 0
Buffer pool temporary index logical reads  = 0
Buffer pool temporary index physical reads = 0
Buffer pool xda logical reads              = 0
Buffer pool xda physical reads             = 0
Buffer pool temporary xda logical reads    = 0
Buffer pool temporary xda physical reads   = 0
Blocking cursor                            = YES
Dynamic SQL statement text:
select * from t1_bakAgent process/thread ID                       = 11759
Memory usage for application:Memory Pool Type                         = Application HeapCurrent size (bytes)                  = 131072High water mark (bytes)               = 131072Configured size (bytes)               = 1048576Agent process/thread ID                    = 11759Agent Lock timeout (seconds)             = -1Memory usage for agent:Memory Pool Type                       = Other MemoryCurrent size (bytes)                = 327680High water mark (bytes)             = 524288Configured size (bytes)             = 3741052928

过一小会再次查看快照,发现Rows fetch会发生变化,如下:

inst105@NODE01:~> db2 get snapshot for application agentid 27385Application SnapshotApplication handle                         = 27385
Application status                         = UOW Waiting
Status change time                         = 05/21/2020 13:39:14.925468
Application code page                      = 1208
Application country/region code            = 0
DUOW correlation token                     = 197.0.0.1.45730.200521052846
Application name                           = db2jcc_application
Application ID                             = 197.0.0.1.45730.200521052846
Sequence number                            = 00002
TP Monitor client user ID                  =
TP Monitor client workstation name         = 197.0.0.1
TP Monitor client application name         =
TP Monitor client accounting string        =Connection request start timestamp         = 05/21/2020 13:28:44.273888
Connect request completion timestamp       = 05/21/2020 13:28:44.274760
Application idle time                      = 5 seconds
CONNECT Authorization ID                   = inst105
Client login ID                            = inst105
Configuration NNAME of client              = 197.0.0.1
Client database manager product ID         = JCC03690
Process ID of client application           = 0
Platform of client application             = Unknown via DRDA
Communication protocol of client           = TCP/IPInbound communication address              = 197.0.0.1 45730Database name                              = SAMPLE
Database path                              = /home/inst105/inst105/NODE0000/SQL00001/MEMBER0000/
Client database alias                      = SAMPLE
Input database alias                       =
Last reset timestamp                       =
Snapshot timestamp                         = 05/21/2020 13:39:19.321331
Authorization level granted                =User authority:DBADM authoritySECADM authorityDATAACCESS authorityACCESSCTRL authorityGroup authority:SYSADM authoritySYSMAINT authorityCREATETAB authorityBINDADD authorityCONNECT authorityIMPLICIT_SCHEMA authoritySYSMON authority
Coordinator member number                  = 0
Current member number                      = 0
Coordinator agent process or thread ID     = 11759
Current Workload ID                        = 1
Agents stolen                              = 0
Agents waiting on locks                    = 0
Maximum associated agents                  = 1
Priority at which application agents work  = 0
Priority type                              = DynamicLock timeout (seconds)                     = -1
Locks held by application                  = 3
Lock waits since connect                   = 0
Time application waited on locks (ms)      = 0
Deadlocks detected                         = 0
Lock escalations                           = 0
Exclusive lock escalations                 = 0
Number of Lock Timeouts since connected    = 0
Total time UOW waited on locks (ms)        = 0Total sorts                                = 0
Total sort time (ms)                       = 0
Total sort overflows                       = 0Buffer pool data logical reads             = 6
Buffer pool data physical reads            = 0
Buffer pool temporary data logical reads   = 0
Buffer pool temporary data physical reads  = 0
Buffer pool data writes                    = 0
Buffer pool index logical reads            = 4
Buffer pool index physical reads           = 0
Buffer pool temporary index logical reads  = 0
Buffer pool temporary index physical reads = 0
Buffer pool index writes                   = 0
Buffer pool xda logical reads              = 0
Buffer pool xda physical reads             = 0
Buffer pool temporary xda logical reads    = 0
Buffer pool temporary xda physical reads   = 0
Buffer pool xda writes                     = 0
Total buffer pool read time (milliseconds) = 0
Total buffer pool write time (milliseconds)= 0
Time waited for prefetch (ms)              = 0
Unread prefetch pages                      = 0
Direct reads                               = 0
Direct writes                              = 0
Direct read requests                       = 0
Direct write requests                      = 0
Direct reads elapsed time (ms)             = 0
Direct write elapsed time (ms)             = 0Number of SQL requests since last commit   = 66
Commit statements                          = 1
Rollback statements                        = 0
Dynamic SQL statements attempted           = 1
Static SQL statements attempted            = 1
Failed statement operations                = 1
Select SQL statements executed             = 1
Xquery statements executed                 = 0
Update/Insert/Delete statements executed   = 0
DDL statements executed                    = 0
Inactive stmt history memory usage (bytes) = 0
Internal automatic rebinds                 = 0
Internal rows deleted                      = 0
Internal rows inserted                     = 0
Internal rows updated                      = 0
Internal commits                           = 1
Internal rollbacks                         = 0
Internal rollbacks due to deadlock         = 0
Binds/precompiles attempted                = 0
Rows deleted                               = 0
Rows inserted                              = 0
Rows updated                               = 0
Rows selected                              = 640
Rows read                                  = 640
Rows written                               = 0UOW log space used (Bytes)                 = 0
Previous UOW completion timestamp          = 05/21/2020 13:28:44.390162
Elapsed time of last completed uow (sec.ms)= 0.022277
UOW start timestamp                        = 05/21/2020 13:28:44.398776
UOW stop timestamp                         =
UOW completion status                      =Open remote cursors                        = 1
Open remote cursors with blocking          = 1
Rejected Block Remote Cursor requests      = 0
Accepted Block Remote Cursor requests      = 1
Open local cursors                         = 0
Open local cursors with blocking           = 0
Total User CPU Time used by agent (s)      = 0.062408
Total System CPU Time used by agent (s)    = 0.000000
Host execution elapsed time                = 0.003211Package cache lookups                      = 1
Package cache inserts                      = 0
Application section lookups                = 66
Application section inserts                = 0
Catalog cache lookups                      = 30
Catalog cache inserts                      = 0
Catalog cache overflows                    = 0
Catalog cache high water mark              = 0Workspace InformationMost recent operation                      = Fetch
Cursor name                                = SQL_CURSH200C1
Most recent operation start timestamp      = 05/21/2020 13:28:44.399010
Most recent operation stop timestamp       = 05/21/2020 13:39:14.925466
Agents associated with the application     = 1
Number of hash joins                       = 0
Number of hash loops                       = 0
Number of hash join overflows              = 0
Number of small hash join overflows        = 0
Number of OLAP functions                   = 0
Number of OLAP function overflows          = 0Statement type                             = Dynamic SQL Statement
Statement                                  = Fetch
Section number                             = 1
Application creator                        = NULLID
Package name                               = SYSSH200
Consistency Token                          =
Package Version ID                         =
Cursor name                                = SQL_CURSH200C1
Statement member number                    = 0
Statement start timestamp                  = 05/21/2020 13:28:44.399010
Statement stop timestamp                   = 05/21/2020 13:39:14.925466 <-----
Elapsed time of last completed stmt(sec.ms)= 0.000106
Total Statement user CPU time              = 0.057741
Total Statement system CPU time            = 0.000000
SQL compiler cost estimate in timerons     = 81
SQL compiler cardinality estimate          = 10000
Degree of parallelism requested            = 1
Number of agents working on statement      = 1
Number of subagents created for statement  = 1
Statement sorts                            = 0
Total sort time                            = 0
Sort overflows                             = 0
Rows read                                  = 640
Rows written                               = 0
Internal rows deleted                      = 0
Internal rows updated                      = 0
Internal rows inserted                     = 0
Rows fetched                               = 640 <-----
Buffer pool data logical reads             = 6
Buffer pool data physical reads            = 0
Buffer pool temporary data logical reads   = 0
Buffer pool temporary data physical reads  = 0
Buffer pool index logical reads            = 0
Buffer pool index physical reads           = 0
Buffer pool temporary index logical reads  = 0
Buffer pool temporary index physical reads = 0
Buffer pool xda logical reads              = 0
Buffer pool xda physical reads             = 0
Buffer pool temporary xda logical reads    = 0
Buffer pool temporary xda physical reads   = 0
Blocking cursor                            = YES
Dynamic SQL statement text:
select * from t1_bakAgent process/thread ID                       = 11759
Memory usage for application:Memory Pool Type                         = Application HeapCurrent size (bytes)                  = 131072High water mark (bytes)               = 131072Configured size (bytes)               = 1048576Agent process/thread ID                    = 11759Agent Lock timeout (seconds)             = -1Memory usage for agent:Memory Pool Type                       = Other MemoryCurrent size (bytes)                = 327680High water mark (bytes)             = 524288Configured size (bytes)             = 3741052928

每隔几秒钟看一次Rows Fetched,会发现每次都增加10:

inst105@NODE01:~> db2 get snapshot for application agentid 27385 | grep -i "Rows fetched"
Rows fetched                               = 1440
inst105@NODE01:~> db2 get snapshot for application agentid 27385 | grep -i "Rows fetched"
Rows fetched                               = 1440
inst105@NODE01:~> db2 get snapshot for application agentid 27385 | grep -i "Rows fetched"
Rows fetched                               = 1450
inst105@NODE01:~> db2 get snapshot for application agentid 27385 | grep -i "Rows fetched"
Rows fetched                               = 1450
inst105@NODE01:~> db2 get snapshot for application agentid 27385 | grep -i "Rows fetched"
Rows fetched                               = 1450
inst105@NODE01:~> db2 get snapshot for application agentid 27385 | grep -i "Rows fetched"
Rows fetched                               = 1460

下面是模拟上面问题的java程序的核心代码:

    PreparedStatement ps = conn.prepareStatement("select * from t1_bak");ps.setFetchSize(10);ResultSet rs = ps.executeQuery();  while (rs.next())  {   int id = rs.getInt("ID");String name = rs.getString("NAME");  System.out.println("ID: " + id );  System.out.println("NAME: " + name); System.out.println("-------------------");Thread.sleep(1000);}

可以看到,setFetchSize设置了每次取10条记录,所以我们看到快照中Rows Fetched每次变化都是增加10。每次读取完一条数据之后休息1秒,这样我们有时间查看快照,观察变化。

Db2应用状态为uow waiting,但快照显示却在不停地Fetch相关推荐

  1. 游戏提交已14天,状态仍是waiting for review,谁比我更惨

    游戏提交已14天,状态仍是waiting for review,谁比我更惨 7天的时候有发过加急处理邮件,既然回复说我的要求不合规..... 苹果这种效率,总有一天会被愤青们抛弃的

  2. android流量显示插件,[android]仿360状态,种流量监控桌面浮动显示

    [android]仿360状态,类流量监控桌面浮动显示 前两天看到部分音频播放器可以实现在桌面上显示歌词,360那个浮动的桌面提示,想不到怎么实现.然后查了些资料大致了解了下,比想象的简单多了.先看效 ...

  3. 快照问题site快照和点击百度快照显示的不一样 这是什么原因

    [快照问题]site快照和点击百度快照显示的不一样 这是什么原因 快照问题site快照和点击百度快照显示的不一样 这是什么原因 标签:内容一点点的仇恨,采花至尊率先发现顶住伏兵的这大批玩家似乎早就准备 ...

  4. DB2模拟一个状态是UOW Queued 应用

    需要先参考上一篇文章 https://blog.csdn.net/qingsong3333/article/details/102919671 方法参考如下: db2 attach to <实例 ...

  5. Java线程状态Jstack线程状态BLOCKED/TIMED_WAITING/WAITING解释

    一.线程5种状态 新建状态(New) 新创建了一个线程对象. 就绪状态(Runnable) 线程对象创建后,其他线程调用了该对象的start()方法.该状态的线程位于可运行线程池中,变得可运行,等待获 ...

  6. MySQL执行查询语句时出现停滞状态,出现Waiting for table metadata lock的问题

    背景:今天在用python往MySQL中写入数据时,出现程序启动后运行很久,发现没动静,一去客户端查询数据库,也发现查询语句出现停滞状态,怀疑是表被锁了,下面是这次问题的解决过程. 问题现象: 等了很 ...

  7. 笔记:DB2常见状态码

    笔记:DB常见状态码 sqlcode sqlstate 说明 000 00000 SQL语句成功完成 01xxx SQL语句成功完成,但是有警告 +012 01545 未限定的列名被解释为一个有相互关 ...

  8. Jstack线程状态BLOCKED/TIMED_WAITING/WAITING解释

    一.线程5种状态 1.新建状态(New) 新创建了一个线程对象. 2.就绪状态(Runnable) 线程对象创建后,其他线程调用了该对象的start()方法.该状态的线程位于可运行线程池中,变得可运行 ...

  9. collection中cell选中状态下分享图片的快照snapshot

    总结要点 注意: 1:shouldPerformSegue(withIdentifier:sender:) -> bool 方法控制segue的效能 2: let index = selecte ...

最新文章

  1. 删除单链表中的重复节点(c语言版本)
  2. 海翰聚焦:专家一天话,价值八千八?
  3. EntityFramework用法探索(二)CodeFirst
  4. Ubuntu设置root密码
  5. PHP 安全问题入门:10 个常见安全问题 + 实例讲解
  6. iBATIS.NET
  7. IBM软件服务创新运用 提升市民生活质量
  8. html5 table删除修改,一个可以增加和删除行的table并可编辑表格中内容
  9. 图解Python多修饰器时哪个先起作用
  10. Redis添加密码认证Cacti监控读取Redis状态值为-1的最快速解决方案
  11. Eclipse环境安装Python插件PyDev
  12. javaweb不同用户登录不同页面的页面_Java Web轻松学36 - 第二个Servlet应用租房网(1)...
  13. 2019年最新移动互联网全行业排行榜!
  14. 缩写月份单词python_月份的英文单词、缩写及由来
  15. 5分钟让你明白金融危机爆发原因
  16. 计算机应用基础(专)【7】
  17. 2022 最值得学习的编程语言:Python 高人气,Ruby 薪水最优渥
  18. Ubuntu安装opencv的viz模块
  19. 计算机累加器有加法器功能吗,累加器是什么_累加器的作用及原理介绍
  20. 「游戏」游戏服务器中AOI的原理及四叉树实现

热门文章

  1. Springboot超市收银管理系统java
  2. 人在国外能买阿里云服务器吗?
  3. 暴力搜索算法浅显易懂
  4. 360安全卫士关闭弹窗广告设置大全
  5. vivo手机怎么恢复信息_vivo手机短信删除了怎么恢复-互盾安卓恢复大师
  6. PD QC BC 充电协议的电流电压
  7. 武汉高职高专计算机专业分数线,武汉职业技术学院录取投档线
  8. Python对接钉钉接口 dingtalk-sdk
  9. 不想打工了,手里有10万,想回农村老家创业,却不知道做什么,请各位指点迷津,谢谢?
  10. 数据链路层的封装-HDLC协议