{"id":6379,"date":"2019-03-11T08:30:55","date_gmt":"2019-03-11T08:30:55","guid":{"rendered":"https:\/\/ittutorial.org\/?p=6379"},"modified":"2019-11-28T07:01:18","modified_gmt":"2019-11-28T07:01:18","slug":"sql-server-running-queries-monitoring","status":"publish","type":"post","link":"https:\/\/ittutorial.org\/sql-server-running-queries-monitoring\/","title":{"rendered":"SQL Server Running Queries Monitoring"},"content":{"rendered":"<p>Hi,<\/p>\n<p>SQL Server DBA should monitor database and running queries everytime.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5171\" src=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/01\/sql-server-perf-icon.jpg\" alt=\"\" width=\"870\" height=\"292\" srcset=\"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/01\/sql-server-perf-icon.jpg 870w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/01\/sql-server-perf-icon-300x101.jpg 300w, https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/01\/sql-server-perf-icon-768x258.jpg 768w\" sizes=\"auto, (max-width: 870px) 100vw, 870px\" \/><\/p>\n<p><!--more--><\/p>\n\n<p>&nbsp;<\/p>\n<p>To monitor running queries are very important for performance tuning criteria. Because if any query is running long time then you can warn application owner or customer. And you can ask yourself and customer why this query is running long time, is it normal or not ?<\/p>\n<p>You can monitor running queries in SQL Server with following script.<\/p>\n<pre>select text, \r\nSUBSTRING(st.text, (qs.statement_start_offset\/2)+1, \r\n((CASE qs.statement_end_offset\r\nWHEN -1 THEN DATALENGTH(st.text)\r\nELSE qs.statement_end_offset\r\nEND - qs.statement_start_offset)\/2) + 1) AS statement_text,\r\n* from sys.dm_exec_requests qs\r\ncross apply sys.dm_exec_sql_text(sql_handle) st\r\ncross apply sys.dm_exec_query_plan(plan_handle);\r\n\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<h4><span style=\"color: #ff0000;\">Do you want to learn Microsoft SQL Server DBA Tutorials for Beginners, then read the following articles.<\/span><\/h4>\n<p><a href=\"https:\/\/ittutorial.org\/sql-server-tutorials-microsoft-database-for-beginners\/\">https:\/\/ittutorial.org\/sql-server-tutorials-microsoft-database-for-beginners\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, SQL Server DBA should monitor database and running queries everytime.<\/p>\n","protected":false},"author":1,"featured_media":5171,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3828,2227,3827],"tags":[1028,1031,1600,1610,2231,2384,2243,2238,2383,2382,2237,2240,2239,2241,2242,2230,2229],"class_list":["post-6379","post","type-post","status-publish","format-standard","has-post-thumbnail","","category-sql-scripts","category-sql-server-2","category-sql-server-dba-scripts","tag-mehmet-deveci","tag-mehmet-salih-deveci","tag-sql-server-2012","tag-sql-server-2014","tag-sql-server-2019","tag-sql-server-monitor-database","tag-sql-server-performance-scripts","tag-sql-server-performance-top-cpu-query","tag-sql-server-running-queries","tag-sql-server-running-queries-monitoring","tag-sql-server-select-inventory","tag-sql-server-top-cpu","tag-sql-server-top-cpu-query","tag-sql-server-top-queries","tag-sql-server-top-query","tag-sql-server-useful-query","tag-sql-server-useful-script"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/ittutorial.org\/wp-content\/uploads\/2019\/01\/sql-server-perf-icon.jpg","jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/6379","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/comments?post=6379"}],"version-history":[{"count":2,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/6379\/revisions"}],"predecessor-version":[{"id":12954,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/6379\/revisions\/12954"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media\/5171"}],"wp:attachment":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media?parent=6379"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/categories?post=6379"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/tags?post=6379"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}