【发布时间】:2016-12-05 18:48:11
【问题描述】:
我有一个从 db2diag.log 中提取错误消息的脚本。我必须从下面的文件中提取导致死锁的 SQL 查询。
文件内容:log.txt
db2inst1 , WSCOMUSR , MESSAGE : ADM5501I DB2 is performing lock escalation. The affected application
is named "db2jcc_application", and is associated with the workload
name "SYSDEFAULTUSERWORKLOAD" and application ID
"173.10.105.33.59586.13011817552" at member "0". The total number of
locks currently held is "1249935", and the target number of locks to
hold is "624967". The current statement being executed is "delete
from DMEXPLOG where CREATED < ? ". Reason code "1"
db2inst1 , WSCOMUSR , MESSAGE : ADM5501I DB2 is performing lock escalation. The affected application
is named "db2jcc_application", and is associated with the workload
name "SYSDEFAULTUSERWORKLOAD" and application ID
"173.10.105.33.59586.13011817552" at member "0". The total number of
locks currently held is "1249935", and the target number of locks to
hold is "624967". The current statement being executed is "select
* from DMEXPLOG where CREATED < ?". Reason code "1"
需要的输出:所有的 sql 查询
1. delete
from DMEXPLOG where CREATED < ?
2. select
* from DMEXPLOG where CREATED < ?
像这样。我想要文件中的所有 sql 部分。有任何grep 或 Awk/sed 解决方案来获得所需的输出吗?
平台:Unix (AIX)
【问题讨论】: