DB2 Event Monitor使用与查询

环境: db2v9.7,  RedHat 5

首先创建一个目录用于存放事件监控,例:
[db2inst1@esi-202 ~]$ mkdir emondir

创建一个sql语句的事件监控
[db2inst1@esi-202 ~]$ db2 “create event monitor emon1 for statements write to file ‘/home/db2inst1/emondir'”

启动emon1
[db2inst1@esi-202 ~]$ db2 “set event monitor emon1 state 1”

查看事件监控生成的内容:
[db2inst1@esi-202 ~]$db2evmon -path emondir

查看事件监控启动情况:
[db2inst1@esi-202 ~]$db2 “select evmonname, event_mon_state(evmonname) from syscat.eventmonitors

关闭emon1
[db2inst1@esi-202 ~]$ db2 “set event monitor emon1 state 1”

删除emon1
[db2inst1@esi-202 ~]$ db2 “drop event monitor emon1′”

作者: hqiang1984

量化自我,极简主义