Trace sql statements in DB2 database

30 January,2010 by Jack Vamvas

DB2 trace sql - how can I set up a trace to capture all sql statements?

Use this process to record all sql statements for a give period of time on DB2.

In other words , a DB2 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
vi /tmp/filtered.out

#7. Delete event monitor

db2 DROP EVENT MONITOR stmon

 

 

Read More

DB2 Query Tuning – db2expln - DBA DB2

Database Tuning as a process and automation - DBA DB2  

DB2 Tuning Tables - DBA DB2

 

Author: Jack Vamvas(http://www.dba-db2.com)

Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on Trace sql statements in DB2 database

Comments are moderated, and will not appear until the author has approved them.


dba-db2.com | DB2 Performance Tuning | DBA DB2:Everything | FAQ | Contact | Copyright