Quick steps to setup event monitoring to capture the db2 sql activity and get to the output to some readable format.
-- db2 event monitoring for tracking sql statements etc.
-- first created for troubleshooting PowerDesigner issue.
-- sql statement to create evt monitor
CREATE EVENT MONITOR evtmon_pd_issue
FOR STATEMENTS
WHERE AUTH_ID = 'USER_ID'
WRITE TO FILE '/home/db2admin' -- this is a directory path
MAXFILES 5
MAXFILESIZE 1024
NONBLOCKED
APPEND;
db2 "set event monitor evtmon_pd_issue state 1"
db2 "set event monitor evtmon_pd_issue state 0"
--After stopping the evt monitor you will see a file in "/home/db2admin" which has word "evt" in its name and has sequential number at the end if there are many files created
-- this will format out the evt monitor captured data
db2evmon -path '/home/db2admin' >> evtmon_pd_issue.out
-- in *.out file you see output in readable format (txt)
-- ones done with your experiements, drop the evt monitor(s)
db2 "drop event monitor evtmon_pd_issue"
No comments:
Post a Comment