{"id":452,"date":"2025-07-08T08:09:48","date_gmt":"2025-07-07T23:09:48","guid":{"rendered":"https:\/\/sejiwon.com\/?p=452"},"modified":"2025-07-09T08:33:46","modified_gmt":"2025-07-08T23:33:46","slug":"oracle%ec%9d%98-sql_id%ec%99%80-%eb%b9%84%ec%8a%b7%ed%95%9c-%ea%b0%9c%eb%85%90","status":"publish","type":"post","link":"https:\/\/sejiwon.com\/?p=452","title":{"rendered":"Oracle\uc758 SQL_ID\uc640 \ube44\uc2b7\ud55c \uac1c\ub150"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Oracle\uc758 <code>SQL_ID<\/code>\ub780?<\/h2>\n\n\n\n<ul>\n<li>Oracle\uc5d0\uc11c\ub294 <code>SQL_ID<\/code>\uac00 <strong>Shared Pool\uc5d0 \uc800\uc7a5\ub41c SQL \ubb38\uc7a5\uc758 \uace0\uc720 ID<\/strong>\ub85c, <code>V$SQL<\/code>, <code>V$SQLAREA<\/code> \ub4f1\uc5d0\uc11c \uc0ac\uc6a9\ub429\ub2c8\ub2e4.<\/li>\n\n\n\n<li>SQL ID\ub294 \ucffc\ub9ac\uc758 \ud574\uc2dc\ub97c \uae30\ubc18\uc73c\ub85c \ud55c \uace0\uc720\ud55c 13\uc790 \uc2dd\ubcc4\uc790\uc785\ub2c8\ub2e4.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u2705 SQL Server\uc5d0\uc11c \uc720\uc0ac\ud55c \uac1c\ub150<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>SQL Server \ud56d\ubaa9<\/th><th>\uc124\uba85<\/th><\/tr><\/thead><tbody><tr><td><code>sql_handle<\/code><\/td><td><strong>SQL \ud14d\uc2a4\ud2b8\ub97c \uc2dd\ubcc4<\/strong>\ud558\ub294 \uace0\uc720\ud55c \ud578\ub4e4<\/td><\/tr><tr><td><code>query_hash<\/code> \/ <code>query_plan_hash<\/code><\/td><td>\ucffc\ub9ac\uc758 <strong>\ud14d\uc2a4\ud2b8\ub098 \uc2e4\ud589 \uacc4\ud68d\uc758 \ud574\uc2dc\uac12<\/strong> (\uc720\uc0ac SQL \uadf8\ub8f9 \ud30c\uc545)<\/td><\/tr><tr><td><code>plan_handle<\/code><\/td><td><strong>\uc2e4\ud589 \uacc4\ud68d<\/strong>\uc744 \uc2dd\ubcc4\ud558\ub294 \uace0\uc720 \ud578\ub4e4<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u2705 \uc608\uc81c: <code>sql_handle<\/code> \uc0ac\uc6a9\ud558\uc5ec SQL \ubb38\uc7a5 \ucd94\uc801<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>SELECT \n    qs.sql_handle,\n    qs.plan_handle,\n    st.text AS sql_text,\n    qs.execution_count,\n    qs.total_worker_time,\n    qs.total_elapsed_time,\n    qs.query_hash,\n    qs.query_plan_hash\nFROM \n    sys.dm_exec_query_stats qs\nCROSS APPLY \n    sys.dm_exec_sql_text(qs.sql_handle) st\nORDER BY \n    qs.total_worker_time DESC;\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u2705 \uc8fc\uc694 \uc2dd\ubcc4\uc790 \uc124\uba85<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\ud56d\ubaa9<\/th><th>\uc124\uba85<\/th><\/tr><\/thead><tbody><tr><td><code>sql_handle<\/code><\/td><td>SQL \ubb38\uc7a5 \uc790\uccb4\uc758 \uace0\uc720 ID (\ubc14\uc774\ub108\ub9ac \uac12)<\/td><\/tr><tr><td><code>plan_handle<\/code><\/td><td>\uc2e4\ud589 \uacc4\ud68d\uc758 \uace0\uc720 ID<\/td><\/tr><tr><td><code>query_hash<\/code><\/td><td>\ucffc\ub9ac \ud14d\uc2a4\ud2b8 \uae30\ubc18 \ud574\uc2dc (\uc720\uc0ac \ucffc\ub9ac \uadf8\ub8f9 \ubd84\uc11d\uc5d0 \uc801\ud569)<\/td><\/tr><tr><td><code>query_plan_hash<\/code><\/td><td>\uc2e4\ud589 \uacc4\ud68d\uc758 \uad6c\uc870 \uae30\ubc18 \ud574\uc2dc (\uc720\uc0ac \uc2e4\ud589 \uacc4\ud68d \uc2dd\ubcc4\uc5d0 \uc801\ud569)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u2705 SQL ID\uc640 \uac00\uc7a5 \uc720\uc0ac\ud55c \uac83?<\/h2>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<p>SQL Server\uc5d0\uc11c\ub294 <code>sql_handle<\/code>\uc774 Oracle\uc758 <code>SQL_ID<\/code>\uc640 \uac00\uc7a5 \uc720\uc0ac\ud55c \uc5ed\ud560\uc744 \ud569\ub2c8\ub2e4.<\/p>\n<\/blockquote>\n\n\n\n<p>\uadf8\ub7ec\ub098 Oracle\uc740 SQL ID\uac00 <strong>\uc0ac\ub78c\uc774 \ubcf4\uae30 \uc26c\uc6b4 \ubb38\uc790\uc5f4<\/strong>\uc778 \ubc18\uba74, SQL Server\uc758 <code>sql_handle<\/code>\uc740 <strong>\ubc14\uc774\ub108\ub9ac \uac12<\/strong>\uc785\ub2c8\ub2e4.<\/p>\n\n\n\n<p>\uc6d0\ud55c\ub2e4\uba74 \uc544\ub798\ucc98\ub7fc \ubb38\uc790\uc5f4\ub85c \ubcc0\ud658\ud560 \uc218\ub3c4 \uc788\uc2b5\ub2c8\ub2e4:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>SELECT \n    CONVERT(VARCHAR(100), qs.sql_handle, 1) AS sql_handle_str,\n    st.text\nFROM \n    sys.dm_exec_query_stats qs\nCROSS APPLY \n    sys.dm_exec_sql_text(qs.sql_handle) st;\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u2705 \ucc38\uace0: \ud2b9\uc815 SQL \ubb38\uc73c\ub85c \ucd94\uc801<\/h2>\n\n\n\n<p>\ub9cc\uc57d \uc5b4\ub5a4 SQL \ubb38\uc744 \uae30\uc900\uc73c\ub85c \ucd94\uc801\ud558\uace0 \uc2f6\ub2e4\uba74, <code>query_hash<\/code>\ub85c \uadf8\ub8f9\ud551\ud558\uac70\ub098, <code>sql_handle<\/code>\ub85c \uc2dd\ubcc4\ud574\uc11c \ucd94\uc801 \uac00\ub2a5\ud569\ub2c8\ub2e4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Oracle\uc758 SQL_ID\ub780? \u2705 SQL Server\uc5d0\uc11c \uc720\uc0ac\ud55c \uac1c\ub150 SQL Server \ud56d\ubaa9 \uc124\uba85 sql_handle SQL \ud14d\uc2a4\ud2b8\ub97c \uc2dd\ubcc4\ud558\ub294 \uace0\uc720\ud55c \ud578\ub4e4 query_hash \/ query_plan_hash \ucffc\ub9ac\uc758 \ud14d\uc2a4\ud2b8\ub098 \uc2e4\ud589 \uacc4\ud68d\uc758 \ud574\uc2dc\uac12 (\uc720\uc0ac SQL \uadf8\ub8f9 \ud30c\uc545) plan_handle \uc2e4\ud589 \uacc4\ud68d\uc744 \uc2dd\ubcc4\ud558\ub294 \uace0\uc720 \ud578\ub4e4 \u2705 \uc608\uc81c: sql_handle \uc0ac\uc6a9\ud558\uc5ec SQL \ubb38\uc7a5 \ucd94\uc801 SELECT qs.sql_handle, qs.plan_handle, st.text AS sql_text, qs.execution_count, qs.total_worker_time, qs.total_elapsed_time, qs.query_hash, qs.query_plan_hash FROM sys.dm_exec_query_stats\u2026 <span class=\"read-more\"><a href=\"https:\/\/sejiwon.com\/?p=452\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[11],"tags":[],"_links":{"self":[{"href":"https:\/\/sejiwon.com\/index.php?rest_route=\/wp\/v2\/posts\/452"}],"collection":[{"href":"https:\/\/sejiwon.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sejiwon.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sejiwon.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sejiwon.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=452"}],"version-history":[{"count":2,"href":"https:\/\/sejiwon.com\/index.php?rest_route=\/wp\/v2\/posts\/452\/revisions"}],"predecessor-version":[{"id":481,"href":"https:\/\/sejiwon.com\/index.php?rest_route=\/wp\/v2\/posts\/452\/revisions\/481"}],"wp:attachment":[{"href":"https:\/\/sejiwon.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sejiwon.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=452"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sejiwon.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}