Search code examples
db2db2-luwdatabase-locking

finding query that is holding lock


How can we find query and process id that is causing lock in DB2 10.5?

We can find table and tablespace name for "get snapshot for locks on dbname" command. But I want know about query and process id.


Solution

  • The probably best way for you is to look into db2pd, the command line tool for troubleshooting. I would recommend this document as it has examples for your diagnosing lock issues.

    Basically you obtain information on which locks are held and by whom and the details also provide the SQL query.