db2 trace all statements

1 connect to db

connect to EIA_OW user fred using secret

2 Create event monitor

  • make sure you've got write permissions to stated folder
db2 "CREATE EVENT MONITOR stmon FOR STATEMENTS WRITE TO FILE '/tmp'"

3 Turn on event monitor

db2 SET EVENT MONITOR stmon STATE = 1

4 Do stuff to the database that you want to monitor

5. Turn off event monitor

db2 SET EVENT MONITOR stmon STATE 0

6 Translate event monitor into readable stuff

db2evmon -path /tmp > /tmp/filtered.out

7 Read the events

vi /tmp/filtered.out

8 Delete event monitor

db2 DROP EVENT MONITOR stmon