Thursday, April 14, 2011

db2 luw 9.7 - Event monitors



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"


For more information on event monitors go to

No comments:

About Me

By profession I am a Database Administrator (DBA) with total 13 yrs. of experience in the field of Information Technology, out of that 9 yrs as SQL DBA and last 3 years in IBM System i/iSeries and DB2 LUW 9. I have handled Developer, plus production support roles, and I like both the roles. I love and live information technology hence the name "Techonologyyogi" Apart from that I am a small, retail investor, with small investments in India and United States in the form of Equity holdings via common stocks. Don't ask me if I have made money, I have been loosing money in stocks.