Chinaunix

标题: Event Monitor [打印本页]

作者: toms1981    时间: 2007-11-16 10:18
标题: Event Monitor
Is anyone create an event monitor before?
I have created an event which will monitor on the statements and it's work fine for me.
But I couldn't see the value for those dynamic sql as it's only display ?
Anyone know how to get the value also???
Kindly pls advise.
作者: coolalibaba    时间: 2007-11-16 10:40
英语说不好就说中文好吧,这里不是老外论坛
作者: psc2001    时间: 2007-11-17 14:25
step
create event monitor
set state=1
flush event monitor
set state=0
db2evmon > file

attention: when your system runs many sql statements,please be careful  if the filesytem can put the so large file .(my system run event monitor for statements can create 2GB file log an hour)
作者: toms1981    时间: 2007-11-21 18:44
标题: 回复 #3 psc2001 的帖子
Belows are the steps to create an event monitor:

   1. Go to your RUN and enter db2cmd
   2. Connect to your database in the command prompt
          * db2 "connect to <DB NAME>"
   3. Create an event monitor, you may put any name for the <EVENT NAME>
          * db2 "create event monitor <EVENT NAME> for statements write to table"
   4. Turn on the monitor
          * db2 "set event monitor <EVENT NAME> state=1"
   5. Run any of your program or application which you want to monitor on the SQL.
   6. Turn off the monitor
          * db2 "set event monitor <EVENT NAME> state=0"
   7. View the executed SQL statement
          * db2 "select stmt_text from <SCHEMA NAME>.STMT_<EVENT NAME> order by sql_req_id"
   8. Terminate the connection
          * db2 "terminate"

This is how I did for the event monitor but I'm able to get the static and dynamic SQL but for dynamic SQL not able to get the value.
作者: toms1981    时间: 2007-11-21 18:51
原帖由 coolalibaba 于 2007-11-16 10:40 发表
英语说不好就说中文好吧,这里不是老外论坛


I'm from Malaysia where I don't know the term in Chinese therefore I forced to write in English.
Sorry about that...
作者: coolalibaba    时间: 2007-11-22 12:12
OK. no problem then. I misunderstood your question. I didn't hear there is any way to display the "?" in the event log or snapshot.

原帖由 toms1981 于 2007-11-21 18:51 发表


I'm from Malaysia where I don't know the term in Chinese therefore I forced to write in English.
Sorry about that...

作者: whiterain    时间: 2007-11-22 19:28
Belows are the steps to create an event monitor:

   1. Go to your RUN and enter db2cmd
   2. Connect to your database in the command prompt
          * db2 "connect to <DB NAME>"
   3. Create an event monitor, you may put any name for the <EVENT NAME>
          * db2 "create event monitor <EVENT NAME> for statements write to table"
   4. Turn on the monitor
          * db2 "set event monitor <EVENT NAME> state=1"
   5. Run any of your program or application which you want to monitor on the SQL.
   6. Turn off the monitor
          * db2 "set event monitor <EVENT NAME> state=0"
   7. View the executed SQL statement
          * db2 "select stmt_text from <SCHEMA NAME>.STMT_<EVENT NAME> order by sql_req_id"
   8. Terminate the connection
          * db2 "terminate"

This is how I did for the event monitor but I'm able to get the static and dynamic SQL but for dynamic SQL not able to get the value.

your function is right.i will have a test.if i have result,i will tell you,my msn : white_liu@hotmail.com




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2