If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Track SQL Statements

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-02-09, 07:14
frun frun is offline
Registered User
 
Join Date: Apr 2009
Posts: 21
Question Track SQL Statements

HI all,

is there a way how to track SQL statements sent to the server?

I'm using ADO.NET Entities Tool which generates these statements automatically (based on entity model etc...), so I can't check them and I don't know how they look like.

I know about possibility to create Event Monitors, but it seems to me too complicated to define, filter, manage and analyze records.

Isn't there another easier way how to track them?

Thanks a lot!

Frantisek

---
DB2 v9.5.0.808 (Express), OS Win 2003 Server
Reply With Quote
  #2 (permalink)  
Old 06-02-09, 18:10
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Easiest way is to "Get snapshot for dynamic SQL" (see Command Reference). You will have to turn on the statement monitor.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 06-03-09, 02:37
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
db2pd is your friend
Reply With Quote
  #4 (permalink)  
Old 06-03-09, 03:36
frun frun is offline
Registered User
 
Join Date: Apr 2009
Posts: 21
I'm probably missing something, but when i run command db2pd in the interactive mode and then enter -db DBNAME -dynamic command, the tool displays tons of statistics from the past.

When I enter the command db2pd -db DBNAME -dynamic, the output is Option -dynamic requires -db <database> or -alldbs option and active database.

I'm DB2 greenhorn, so I'd like a tool like a MS SQL Profiler - it is a windows application with disagnostic window and when it is active, it monitors activity and displays SQL statements immediately after they are sent to the SQL server, so it is easy fo find last command and assign it to the correct UI action.
MS SQL Profiler Screenshot
Reply With Quote
  #5 (permalink)  
Old 06-03-09, 04:02
frun frun is offline
Registered User
 
Join Date: Apr 2009
Posts: 21
Quote:
Originally Posted by Marcus_A
Easiest way is to "Get snapshot for dynamic SQL" (see Command Reference). You will have to turn on the statement monitor.
Do you mean some special SQL statemenet?
Reply With Quote
  #6 (permalink)  
Old 06-03-09, 04:08
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
You could flush the package cache if you do not want the "SQL history lesson". To look at the SQL currently execuitng I'd recomment db2mon.
Reply With Quote
  #7 (permalink)  
Old 06-03-09, 04:37
frun frun is offline
Registered User
 
Join Date: Apr 2009
Posts: 21
Thumbs up

Quote:
Originally Posted by dr_te_z
You could flush the package cache if you do not want the "SQL history lesson". To look at the SQL currently execuitng I'd recomment db2mon.
Yep, that's the tool i was looking for :-) It is based on snapshots also, but it has functionality to show differences between them. It has potential to become my favorite tool :-) Thanks a lot.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On