<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dm_os_performance_counters &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/dm_os_performance_counters/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Thu, 16 Nov 2017 10:17:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>SQL Server: The Important Performance Counters (dm_os_performance_counters)</title>
		<link>https://www.dbrnd.com/2016/04/sql-server-the-important-performance-counters-dm_os_performance_counters/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 20 Apr 2016 05:10:18 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[dm_os_performance_counters]]></category>
		<category><![CDATA[performance counter]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2426</guid>

					<description><![CDATA[The SQL Server Performance Counters are the bread and butter for performance tuning exercise. Using the performance counters, we can measure the current performance of the SQL Server basis on different criteria like Memory Information, Storage Information, CPU Information, Pages Information and other. In this post, I am going to share some of the important [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-the-important-performance-counters-dm_os_performance_counters%2F&amp;linkname=SQL%20Server%3A%20The%20Important%20Performance%20Counters%20%28dm_os_performance_counters%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-the-important-performance-counters-dm_os_performance_counters%2F&amp;linkname=SQL%20Server%3A%20The%20Important%20Performance%20Counters%20%28dm_os_performance_counters%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-the-important-performance-counters-dm_os_performance_counters%2F&amp;linkname=SQL%20Server%3A%20The%20Important%20Performance%20Counters%20%28dm_os_performance_counters%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-the-important-performance-counters-dm_os_performance_counters%2F&amp;linkname=SQL%20Server%3A%20The%20Important%20Performance%20Counters%20%28dm_os_performance_counters%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-the-important-performance-counters-dm_os_performance_counters%2F&amp;linkname=SQL%20Server%3A%20The%20Important%20Performance%20Counters%20%28dm_os_performance_counters%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-the-important-performance-counters-dm_os_performance_counters%2F&amp;linkname=SQL%20Server%3A%20The%20Important%20Performance%20Counters%20%28dm_os_performance_counters%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-the-important-performance-counters-dm_os_performance_counters%2F&#038;title=SQL%20Server%3A%20The%20Important%20Performance%20Counters%20%28dm_os_performance_counters%29" data-a2a-url="https://www.dbrnd.com/2016/04/sql-server-the-important-performance-counters-dm_os_performance_counters/" data-a2a-title="SQL Server: The Important Performance Counters (dm_os_performance_counters)"></a></p><p>The SQL Server Performance Counters are the bread and butter for performance tuning exercise.</p>
<p>Using the performance counters, we can measure the current performance of the SQL Server basis on different criteria like Memory Information, Storage Information, CPU Information, Pages Information and other. </p>
<p>In this post, I am going to share some of the important Performance Counters for monitoring the SQL Server Performance. </p>
<p><strong>Memory Information Counters:</strong></p>
<blockquote><p>Using this script, you can find the total amount of physical memory on the computer. </p>
<pre class="crayon-plain-tag">SELECT *FROM sys.dm_os_performance_counters 
WHERE counter_name = 'Total Server Memory (KB)'
GO</pre> </p></blockquote>
<blockquote><p>Using this script, you can find different memory-related counters and its information. </p>
<pre class="crayon-plain-tag">SELECT *FROM sys.dm_os_performance_counters 
WHERE counter_name LIKE '%Memory%'
GO</pre> </p></blockquote>
<p><strong>Page Information Counters:</strong></p>
<blockquote><p>Using this script, you can find that how long pages stay in the buffer cache in seconds. If the value is more significant, SQL Server does not read from disk, and it serves the request from the buffer only. </p>
<pre class="crayon-plain-tag">SELECT *FROM sys.dm_os_performance_counters 
WHERE counter_name = 'Page life expectancy'
GO</pre>
</p></blockquote>
<blockquote><p>It shows the value of the number of physical database page reads that are issued per second.<br />
Around 80 per second is normal, but if it is above, you may get a timeout in your application.</p>
<pre class="crayon-plain-tag">SELECT *FROM sys.dm_os_performance_counters 
WHERE counter_name = 'page reads/sec'
GO</pre>
</p></blockquote>
<blockquote><p>It shows the number of requests to find a page in the buffer pool.</p>
<pre class="crayon-plain-tag">SELECT *FROM sys.dm_os_performance_counters 
WHERE counter_name = 'Page lookups/sec'
GO</pre>
</p></blockquote>
<blockquote><p>Using below script, you can find a different page related counters and its information. </p>
<pre class="crayon-plain-tag">SELECT *FROM sys.dm_os_performance_counters 
WHERE counter_name LIKE '%Page%'
GO</pre>
</p></blockquote>
<p><strong>User Connection Counter:</strong></p>
<blockquote><p>It shows the number of different users that are connected to the SQL Server.</p>
<pre class="crayon-plain-tag">SELECT *FROM sys.dm_os_performance_counters 
WHERE counter_name = 'User Connections'
GO</pre>
</p></blockquote>
<p><strong>Buffer Information Counters:</strong></p>
<blockquote><p>A greater value indicates that more significant number of requests are satisfied with the data cache and SQL Server is getting queries data from the memory instead of disk. </p>
<pre class="crayon-plain-tag">SELECT *FROM sys.dm_os_performance_counters 
WHERE counter_name = 'Buffer Cache Hit Ratio'
GO</pre> </p></blockquote>
<blockquote><p>Using below script, You can find different information of the buffers. </p>
<pre class="crayon-plain-tag">SELECT *FROM sys.dm_os_performance_counters 
WHERE counter_name LIKE '%Buffer%'
GO</pre> </p></blockquote>
<p><strong>Batch Requests Counter: </strong></p>
<blockquote><p>It shows the number of batches per second, which are received by the SQL Server. If the number is high, more queries are executed in SQL Server. </p>
<pre class="crayon-plain-tag">SELECT *FROM sys.dm_os_performance_counters 
WHERE counter_name = 'Batch Requests/Sec'
GO</pre> </p></blockquote>
<p><strong>SQL Compilation Counter: </strong></p>
<blockquote><p>It shows the number of execution plan compilation per second by the SQL Server. The compilation of execution plan is resource intensive, and it should be lesser than the number of batches per second. </p>
<pre class="crayon-plain-tag">SELECT *FROM sys.dm_os_performance_counters 
WHERE counter_name = 'SQL Compilations/Sec'
GO</pre> </p></blockquote>
<p><strong>Block Transaction Information Counters: </strong></p>
<blockquote><p>This blocking related counters are essential for finding the different information of the blocked transactions so that as much as we can avoid the deadlock situation. </p>
<pre class="crayon-plain-tag">SELECT *FROM sys.dm_os_performance_counters 
WHERE counter_name LIKE '%block%'
GO</pre> </p></blockquote>
<p><strong>CPU Counters:</strong></p>
<blockquote><p>Using this script, You can find the usage of CPU in percentage. </p>
<pre class="crayon-plain-tag">SELECT *FROM sys.dm_os_performance_counters 
WHERE counter_name = 'CPU usage %'
GO</pre> </p></blockquote>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: 8 different ways to Detect a DeadLock in a Database</title>
		<link>https://www.dbrnd.com/2016/04/sql-server-8-different-ways-to-detect-a-deadlock-in-a-database/</link>
					<comments>https://www.dbrnd.com/2016/04/sql-server-8-different-ways-to-detect-a-deadlock-in-a-database/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 09 Apr 2016 19:00:49 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[DeadLock]]></category>
		<category><![CDATA[dm_os_performance_counters]]></category>
		<category><![CDATA[DMV]]></category>
		<category><![CDATA[extended event]]></category>
		<category><![CDATA[sp_lock]]></category>
		<category><![CDATA[SQL Profiler]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2341</guid>

					<description><![CDATA[In the previous post, I shared T-SQL script to generate a DeadLock situation in SQL Server Database. In this post, I am sharing different scripts to detect a Deadlock in SQL Server. 1. Using SP_LOCK, you can find the WAIT status for blocking sessions: [crayon-6ab4177ff1465428722063/] 2. Using sys.sysprocesses: [crayon-6ab4177ff1467055347703/] 3. Using common DMV: [crayon-6ab4177ff1468942385316/] 4. [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-8-different-ways-to-detect-a-deadlock-in-a-database%2F&amp;linkname=SQL%20Server%3A%208%20different%20ways%20to%20Detect%20a%20DeadLock%20in%20a%20Database" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-8-different-ways-to-detect-a-deadlock-in-a-database%2F&amp;linkname=SQL%20Server%3A%208%20different%20ways%20to%20Detect%20a%20DeadLock%20in%20a%20Database" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-8-different-ways-to-detect-a-deadlock-in-a-database%2F&amp;linkname=SQL%20Server%3A%208%20different%20ways%20to%20Detect%20a%20DeadLock%20in%20a%20Database" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-8-different-ways-to-detect-a-deadlock-in-a-database%2F&amp;linkname=SQL%20Server%3A%208%20different%20ways%20to%20Detect%20a%20DeadLock%20in%20a%20Database" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-8-different-ways-to-detect-a-deadlock-in-a-database%2F&amp;linkname=SQL%20Server%3A%208%20different%20ways%20to%20Detect%20a%20DeadLock%20in%20a%20Database" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-8-different-ways-to-detect-a-deadlock-in-a-database%2F&amp;linkname=SQL%20Server%3A%208%20different%20ways%20to%20Detect%20a%20DeadLock%20in%20a%20Database" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F04%2Fsql-server-8-different-ways-to-detect-a-deadlock-in-a-database%2F&#038;title=SQL%20Server%3A%208%20different%20ways%20to%20Detect%20a%20DeadLock%20in%20a%20Database" data-a2a-url="https://www.dbrnd.com/2016/04/sql-server-8-different-ways-to-detect-a-deadlock-in-a-database/" data-a2a-title="SQL Server: 8 different ways to Detect a DeadLock in a Database"></a></p><p>In the previous post, I shared T-SQL script to generate a DeadLock situation in SQL Server Database.<br />
In this post, I am sharing different scripts to detect a Deadlock in SQL Server. </p>
<p><strong>1. Using SP_LOCK, you can find the WAIT status for blocking sessions:</strong></p><pre class="crayon-plain-tag">SP_LOCK</pre><p>
<a href="https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerSP_Lock.png" rel="attachment wp-att-2344"><img fetchpriority="high" decoding="async" class="alignnone wp-image-2344 size-full" title="SQL Server SP_Lock" src="https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerSP_Lock.png" alt="SQL Server SP_Lock" width="401" height="218" srcset="https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerSP_Lock.png 401w, https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerSP_Lock-300x163.png 300w, https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerSP_Lock-150x82.png 150w" sizes="(max-width: 401px) 100vw, 401px" /></a></p>
<p><strong>2. Using sys.sysprocesses:</strong></p><pre class="crayon-plain-tag">SELECT * FROM sys.sysprocesses 
WHERE blocked &gt; 0</pre><p>
<p><strong>3. Using common DMV:</strong></p><pre class="crayon-plain-tag">SELECT 	
	der.blocking_session_id AS BlockingSessionID
	,dest.text AS BlockingStatement
FROM sys.dm_exec_connections AS sdec
INNER JOIN sys.dm_exec_requests AS der
    ON sdec.session_id = der.blocking_session_id
INNER JOIN sys.dm_os_waiting_tasks AS dowt
    ON der.session_id = dowt.session_id
CROSS APPLY sys.dm_exec_sql_text(sdec.most_recent_sql_handle) AS dest</pre><p>
<p><strong>4. Using sys.dm_tran_locks:</strong></p><pre class="crayon-plain-tag">SELECT 
	request_session_id AS SPID 
	,DB_NAME(resource_database_id) AS DatabaseName
	,resource_type AS LockedResource
	,request_mode AS LockType
FROM sys.dm_tran_locks</pre><p>
<p><strong>5. Enable required trace flags to log DeadLock related information in Tracefile:</strong></p><pre class="crayon-plain-tag">DBCC TRACEON (1204, -1)
DBCC TRACEON (1222, -1)</pre><p>
<p><strong>6. Count total number of DeadLock:</strong></p><pre class="crayon-plain-tag">SELECT cntr_value AS TotalNumberOfDeadLocks
FROM sys.dm_os_performance_counters
WHERE counter_name = 'Number of Deadlocks/sec'
   AND instance_name = '_Total'</pre><p>
<p><strong>7. Using Extended Events and below script to create Extended Event for monitoring the DeadLock:</strong></p><pre class="crayon-plain-tag">CREATE EVENT SESSION [Deadlock_Monitor] ON SERVER 
ADD EVENT sqlos.scheduler_monitor_deadlock_ring_buffer_recorded,
ADD EVENT sqlserver.lock_deadlock,
ADD EVENT sqlserver.lock_deadlock_chain,
ADD EVENT sqlserver.xml_deadlock_report 
ADD TARGET package0.event_file(SET filename=N'C:\Temp\Deadlock_Monitor.xel')
WITH (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=30 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=OFF,STARTUP_STATE=ON)
GO</pre><p>
<p><a href="https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerExtendedEventForDeadlock.png" rel="attachment wp-att-2345"><img decoding="async" class="alignnone wp-image-2345 size-full" title="SQL Server Extended Event For Deadlock" src="https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerExtendedEventForDeadlock.png" alt="SQL Server Extended Event For Deadlock" width="359" height="146" srcset="https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerExtendedEventForDeadlock.png 359w, https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerExtendedEventForDeadlock-300x122.png 300w, https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerExtendedEventForDeadlock-150x61.png 150w" sizes="(max-width: 359px) 100vw, 359px" /></a></p>
<p>You can also use SSMS to create Extended Events for DeadLock, and you can monitor the live status of the server.</p>
<p><a href="https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerExtendedEventForDeadlockInSSMS.png" rel="attachment wp-att-2346"><img decoding="async" class="alignnone wp-image-2346 size-full" title="SQL Server Extended Event For Deadlock In SSMS" src="https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerExtendedEventForDeadlockInSSMS.png" alt="SQL Server Extended Event For Deadlock In SSMS" width="208" height="167" srcset="https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerExtendedEventForDeadlockInSSMS.png 208w, https://www.dbrnd.com/wp-content/uploads/2016/04/SQLServerExtendedEventForDeadlockInSSMS-150x120.png 150w" sizes="(max-width: 208px) 100vw, 208px" /></a></p>
<p><strong>8. Using SQL Server Profiler: </strong><br />
SQL Server Profiler has three different events to capture a deadlock.<br />
<pre class="crayon-plain-tag">1.Deadlock graph
2.Lock: Deadlock
3.Lock: Deadlock Chain</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/04/sql-server-8-different-ways-to-detect-a-deadlock-in-a-database/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
