Posted on 2008-07-31 09:09
默认为零 阅读(271)
评论(0) 编辑 收藏 所属分类:
技术
##使用eventor收集数据 ====
##设置工作参数
DB=dbname
WORKDIR=/home/event/
db2 connect to $DB
##创建event monitor
db2 "create event monitor evsql for statements write to file '$WORKDIR' replace"
##收集数据
##!/usr/bin/ksh
TIMESTAMP=`date +%H%M`
db2 connect to $DB
db2 set event monitor evsql state=1
##设置监控的时间,单位是秒
sleep 20
db2 set event monitor evsql state=0
db2evmon -db $DB -evm evsql > evsql.$DB.$TIMESTAMP.txt
#删除event monitor
db2 connect to $DB
db2 drop event monitor evsql
#result phase sample:
grep "Exec Time" evsql.$DB.$TIMESTAMP.txt |awk '{print $3}'|uniq|sort >sql.txt