Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am no DBA and very much a novice when it comes to DB2 so even 'obvious' answers are welcome to this question:

I love db2top but sometimes I cannot get it to run if the load average is high on a db2 LUW.

This morning I was looking at an issue where load average shot up suddenly, I could not get db2top to come up and I needed to find out what was happening.

What can I do to find out who is doing what in this situation? I suspected a horribly bad query was being run by someone...is there a good way to find information on poor performing SQL on the fly in that type of situation?

Are there any good ways to collect good, actionable stats who/where bad sql is coming from in the event that load average is so high? I know about db2pd but I am not sure how to use it effectively and slogging through tens of thousands of lines of raw data is probably not the most efficient way to get at the heart of a problem.

Any tips or resources?

share|improve this question

I am not a DB2 guy either. But my goodle fu is strong. Searching for

force db2 LUW long running query

Finds TONS of great data, including one that looks like exactly what you want, a well written tutorial on how to learn:

http://www.dbisoftware.com/blog/db2_performance.php?id=122

They also sell some crazily overpriced software that does the same thing for you. Here are the juicy bits:

db2 "list applications show detail"

This will give you a hint as to which connections are currently executing and if there are a number of connections in a lock wait status.

If you observe lock waits, you should next take a deeper look into the lock contention with the command:

db2 "get snapshot for locks on DBNAME"

This verbose report will show you which application connections are holding locks and which are waiting. Compounding matters, some of the connections that are waiting may have other connections waiting on them. A real snowball effect can occur if you have LOCKTIMEOUT set to -1 (infinity, never time out) or set higher than 30 seconds.

In the case of lock contention, your remedy usually involves killing the elephant with the command:

db2 "force application (application-handle) "
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.
{"cc_re__cc_re__cc_by_sa_3_0": ["                       <li><a href=\"//area51.stackexchange.com\" title=\"proposing new sites in the Stack Exchange network\">Area 51</a></li>\r\n                        <li><a href=\"//careers.stackoverflow.com\">Stack Overflow Careers</a></li>\r\n                    \r\n                </ol>\r\n            </td>\r\n    </tr>\r\n</table>\n                </div>\n            </div>\n\n            <div id=\"copyright\">\n                site design / logo &#169; 2016 Stack Exchange Inc; user contributions licensed under <a href=\"https://creativecommons.org/licenses/by-sa/3.0/\" rel=\"license\">cc by-sa 3.0</a> \n                with <a href=\"http://blog.stackoverflow.com/2009/06/attribution-required/\" rel=\"license\">attribution required</a>\n            </div>\n            <div id=\"svnrev\">\n                rev 2016.2.14.3249\n            </div>\n            \n        </div>\n    </div>\n    <noscript>\n        <div id=\"noscript-warning\">Server Fault works best with JavaScript enabled<img src=\"http://pixel.quantserve.com/pixel/p-c1rF4kxgLUzNc.gif\" alt=\"\" class=\"dno\"></div>\n    </noscript>\n<scrip"], "copyright__copyright__copyright": [" them. A real snowball effect can occur if you have LOCKTIMEOUT set to -1 (infinity, never time out) or set higher than 30 seconds.\n\nIn the case of lock contention, your remedy usually involves killing the elephant with the command:\n\ndb2 \"force application (application-handle) \"\nshare|improve this answer\n\nYour Answer\n\n\u00a0\ndiscard\n\nBy posting your answer, you agree to the privacy policy and terms of service.\n\nNot the answer you're looking for? Browse other questions tagged or ask your own question."]}