Use this process to record all sql statements for a give period of time on DB2.
In other words, a trace
#connect to db
#1-Create event monitor- make sure you've got write permissions to stated folder
db2 "CREATE EVENT MONITOR stmon FOR STATEMENTS WRITE TO FILE '/tmp'"
#2 Turn on event monitor
db2 SET EVENT MONITOR stmon STATE = 1
#3. (Do stuff to the database that you want to monitor)
#4. Turn off event monitor
db2 SET EVENT MONITOR stmon STATE 0
#5. Translate event monitor into readable stuff
db2evmon -path /tmp > /tmp/filtered.out
#6. Read the events
#7. Delete event monitor
db2 DROP EVENT MONITOR stmon
Republished from http://www.dba-db2.com/.