By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,558 Members | 1,068 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,558 IT Pros & Developers. It's quick & easy.

How to find which SQL is causing the Lock

P: n/a
Hi,

Is there any way to find the SQL that is causing the Locks.

I am using SYSPROC.SNAPSHOT_LOCK to find out the locks on the table,
but i am unable to find out which SQL statement was responsible for
the lock.

Thanks a lot

Rahul
Nov 24 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Nov 24, 1:25 am, Rahul Babbar <rahul.babb...@gmail.comwrote:
Hi,

Is there any way to find the SQL that is causing the Locks.

I am using SYSPROC.SNAPSHOT_LOCK to find out the locks on the table,
but i am unable to find out which SQL statement was responsible for
the lock.

Thanks a lot

Rahul
When you say Locks, i assume you mean database deadlocks. The db2pd
utility (DB2 9) is an excellent utility to view the locks that have
been acquired at a particular instant in time.

DB2 also by default has an event monitor (DB2DETAILDEADLOCK) that
"catches" deadlocks and records information regarding them:

The output is in a directory like:
<instance owner home>/NODE0000/SQL00001/db2event/db2detaildeadlock

And you can mine this information with the db2evmon utility:
db2evmon -path . /tmp/deadlockoutput.txt

Finding database deadlocks is a nasty business. So good luck!

Nov 26 '07 #2

P: n/a
Rahul,

one possibility might be to join SNAPSHOT_LOCK to SNAPSHOT_STATEMENT.

/T

On Nov 23, 10:25 pm, Rahul Babbar <rahul.babb...@gmail.comwrote:
Hi,

Is there any way to find the SQL that is causing the Locks.

I am using SYSPROC.SNAPSHOT_LOCK to find out the locks on the table,
but i am unable to find out which SQL statement was responsible for
the lock.

Thanks a lot

Rahul
Nov 26 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.