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 > sql lock-wait

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-07-05, 03:55
AnilKale AnilKale is offline
Registered User
 
Join Date: Feb 2005
Posts: 118
sql lock-wait

Hi All !

Is it possible to determine the exact SQL that's waiting for locks (db2 ver 8 on AIX) ?
Using the list application, I managed to get the appl id waiting for locks.
I can determine the locks held using the get snapshot.
but i was wondering if there was a way to determine the exact sql (sql is in a java code using sqlj) that's waiting for locks ?

thanks

Anil
Reply With Quote
  #2 (permalink)  
Old 11-07-05, 08:50
juliane26 juliane26 is offline
Registered User
 
Join Date: Oct 2005
Posts: 109
Doing a lock snapshot you can find out about the objects being locked, that might help you getting to the SQL using the SQL snapshot ...
__________________
Juliane
Reply With Quote
  #3 (permalink)  
Old 11-07-05, 09:04
grahammartin grahammartin is offline
Registered User
 
Join Date: Apr 2005
Posts: 41
To capture the SQL, you will either need to have the DFT_MON_STMT parameter set to ON, or else have a session running with the statement monitor switch on (db2 update monitor switches using statement on).

You can then either use the snapshot output, or the db2pd command to determine the application ID holding the lock (e.g. db2 get snapshot for locks on $DBNAME).

Once you know the ID, you can run a:

db2 get snapshot for application agentid XXX

which should detail the SQL text.

You can also do this via the Control Centre GUI - right click database name -> Applications -> Show Lock Chains.

Graham Martin
http://www.ibm.com/software/data/db2/migration/
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