Finding problems with dynamic SQL
The BTHDASUM, BTHDADTL, THSQLDYN and THSQLDYS reports can help you find dynamic SQL that is causing a problem.
The reports run against historical data and are most effective when used together. BTHDASUM provides summary thread information, which can help you determine when a problem occurred. You can then run BTHDADTL for that time period to get detailed thread information. Similarly, THSQLDYN provides summary dynamic SQL and miniplan information, and then THSQLDYS provides more detailed information.
Running the detail reports (BTHDADTL and THSQLDYS) against a long time period of data can result in excessively long and cumbersome reports. To avoid this situation, be sure to run the summary reports first to determine how to best qualify the detail reports. For example, you might run the reports in the following sequence.
- Run the BTHDASUM report to determine the interval in which a problem occurred.
- Run the BTHDADTL detail report against the problem interval to determine which thread might be causing the problem.
- Run the THSQLDYN report to obtain SQL/miniplan summary information.
- Run the THSQLDYS report to identify the SQL and to expand the report to display the SQL text.
THSQLDYN can also be run online from the EZDEVENT view Dynamic Sql/Mini Plan option. From the online report, you can zoom on the SQL to explain it in even greater detail.
For samples of these reports, see Sample-Data-Collector-reports.
Related topic