{"id":609,"date":"2009-12-23T15:24:35","date_gmt":"2009-12-23T20:24:35","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=609"},"modified":"2011-07-06T10:18:46","modified_gmt":"2011-07-06T15:18:46","slug":"sql-bind-capture-part-3","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2009\/12\/23\/sql-bind-capture-part-3\/","title":{"rendered":"SQL Bind Capture \u2013 Part 3"},"content":{"rendered":"<p>I needed to find out which variables were producing a poor execution plan.  Short of enabling 10046 trace with binds enabled, I found the following is a good approximation.<\/p>\n<p>Basically:<\/p>\n<p>1.  Find the PLAN_HASH_VALUE for the SQL_ID with the poor plan<br \/>\n2.  Pass this value to V$SQL_BIND_CAPTURE and print the variables associated with this version (represented by CHILD_NUMBER)<\/p>\n<pre lang=\"sql\" line=\"1\">\r\nselect name || ' = ' || value_string from v$sql_bind_capture sbc, v$sql s\r\n  where plan_hash_value = 1229663947\r\n    and sbc.sql_id = s.sql_id\r\n    and sbc.child_number = s.child_number\r\n\/\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I needed to find out which variables were producing a poor execution plan. Short of enabling 10046 trace with binds enabled, I found the following is a good approximation. Basically: 1. Find the PLAN_HASH_VALUE for the SQL_ID with the poor&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2009\/12\/23\/sql-bind-capture-part-3\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[19,22],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/609"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=609"}],"version-history":[{"count":10,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/609\/revisions"}],"predecessor-version":[{"id":979,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/609\/revisions\/979"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=609"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}