<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5406422383207371171</id><updated>2024-09-15T23:56:11.787-04:00</updated><category term="SQL Server 2008"/><category term="boilerplate code"/><category term="SQL Server 2005"/><category term="SQL Server 2000"/><category term="index"/><category term="DMV&#39;s"/><category term="DTS Packages"/><category term="Msg. 2627"/><category term="backups"/><category term="confio"/><category term="distribution agent error"/><category term="embarcadero"/><category term="idera"/><category term="maintenance"/><category term="monitoring"/><category term="performance"/><category term="quest"/><category term="red gate"/><category term="replication"/><category term="size"/><category term="software"/><category term="table"/><category term="violation of primary key constraint"/><title type='text'>Adventures of a SQL Server DBA</title><subtitle type='html'>SQL Server 2008 internals - setup, maintenance and troubleshooting for SQL Server, SSIS, SSRS, Service Broker, clustering and replication.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dbachman.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5406422383207371171/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://dbachman.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Deirdre Bachman</name><uri>http://www.blogger.com/profile/05542425173365143572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2gL1tPbZ10Ya9mFK47vSUcWmUr1zpZJIyagHnKAfnbPEmVPCx4P-Ph_BCoQycF_L7HVMnZ9lKG2xfosXUPOSXzKeYlA-txFDF5Jt98QHdbpsshPNgJnUqHTAxg0lWPQ/s220/d_redwood.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5406422383207371171.post-6562322268095544452</id><published>2010-01-09T16:09:00.001-05:00</published><updated>2010-01-09T16:10:22.197-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="boilerplate code"/><category scheme="http://www.blogger.com/atom/ns#" term="DMV&#39;s"/><category scheme="http://www.blogger.com/atom/ns#" term="index"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2005"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2008"/><title type='text'>Find index usage against a particular table, &amp; find all unused indexes in the database</title><content type='html'>&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;The environment: SQL Server 2005 or SQL Server 2008&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Maybe you have a large database, and you&#39;re looking for ways to save space.&amp;nbsp; Maybe you&#39;re seeing a large, heavily-used table with many indexes, and you&#39;re wondering if you could improve write performance by getting rid of some of the indexes.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;Before you start dropping indexes left and right, you should start by checking to see if, and how often, you&#39;d obviously like to check which indexes are actually being used.&amp;nbsp; Starting in SQL Server 2005, there are DMV&#39;s (Dynamic Management Views) that make this possible - namely, &lt;b&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;sys.dm_db_index_usage_stats&lt;/span&gt;&lt;/b&gt;.&amp;nbsp; This DMV holds a row for each index which has been used since the last time the SQL Service starts up.&amp;nbsp; This information does not persist across service restarts, so I generally like to wait at least a month before I start looking at this DMV to get an idea of which indexes are being used, and how.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;For more information on the SQL DMV&#39;s, check out Books Online:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms188754%28SQL.90%29.aspx&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;SQL Server 2005 Dynamic Management Views and Functions&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms188754.aspx&quot;&gt;SQL Server 2008 Dynamic Management Views and Functions&lt;/a&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Personal note: I&#39;ve found that a month&#39;s worth of data is reasonably representative of your actual index usage - for example, the table in question may have a large index which is only used once a month - but it happens to be used by a query that is critical to your monthly billing system.&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;1. Check all of the indexes on a given table:&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: #cccccc; text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: #cccccc; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;select &lt;/span&gt;t.[name],&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; i.[name],&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; s.*&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;from &lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;sys.tables&lt;/span&gt; t&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;left outer join&lt;/span&gt; &lt;span style=&quot;color: #38761d;&quot;&gt;sys.indexes&lt;/span&gt; i on t.&lt;span style=&quot;color: magenta;&quot;&gt;object_id&lt;/span&gt; = i.&lt;span style=&quot;color: magenta;&quot;&gt;object_id &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;left outer join&lt;/span&gt; &lt;span style=&quot;color: #38761d;&quot;&gt;sys.dm_db_index_usage_stats&lt;/span&gt; s &lt;span style=&quot;color: blue;&quot;&gt;on &lt;/span&gt;i.index_id = s.index_id&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;and &lt;/span&gt;i.&lt;span style=&quot;color: magenta;&quot;&gt;object_id&lt;/span&gt; = s.&lt;span style=&quot;color: magenta;&quot;&gt;object_id&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;and &lt;/span&gt;s.database_id = &lt;span style=&quot;color: magenta;&quot;&gt;db_id&lt;/span&gt;()&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;where &lt;/span&gt;i.is_hypothetical = 0&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #38761d;&quot;&gt;-- discard stats from consideration&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;and &lt;/span&gt;t.[name] = &lt;span style=&quot;color: red;&quot;&gt;&#39;TableName&#39;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #cccccc; font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;order by&lt;/span&gt; t.[name], i.[name]&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: #cccccc;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;b&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;2. Check all tables in the database for small numbers of total seeks, scans and updates against any of their indexes:&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: #cccccc; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;select &lt;/span&gt;t.[name],&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; i.index_id,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; i.[name],&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; s.*&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;from &lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;sys.tables&lt;/span&gt; t&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;left outer join&lt;/span&gt; &lt;span style=&quot;color: #38761d;&quot;&gt;sys.indexes&lt;/span&gt; i on t.&lt;span style=&quot;color: magenta;&quot;&gt;object_id&lt;/span&gt; = i.&lt;span style=&quot;color: magenta;&quot;&gt;object_id &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;left outer join &lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;sys.dm_db_index_usage_stats&lt;/span&gt; s &lt;span style=&quot;color: blue;&quot;&gt;on &lt;/span&gt;i.index_id = s.index_id&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;and &lt;/span&gt;i.&lt;span style=&quot;color: magenta;&quot;&gt;object_id&lt;/span&gt; = s.&lt;span style=&quot;color: magenta;&quot;&gt;object_id&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;and &lt;/span&gt;s.database_id = &lt;span style=&quot;color: magenta;&quot;&gt;db_id&lt;/span&gt;()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;where &lt;/span&gt;i.is_hypothetical = 0&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #38761d;&quot;&gt;--&amp;nbsp;&amp;nbsp;&amp;nbsp; not stats&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;and &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #38761d;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #38761d; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;--&amp;nbsp;&amp;nbsp;&amp;nbsp; has no index activity&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; s.index_id is null&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #cccccc; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #38761d;&quot;&gt;--&amp;nbsp;&amp;nbsp;&amp;nbsp; or has very little index activity&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; or ( s.user_seeks + s.user_scans + s.user_lookups ) &amp;lt; 100&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;and &lt;/span&gt;i.[name] is not null&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #38761d;&quot;&gt;--&amp;nbsp;&amp;nbsp;&amp;nbsp; has indexes&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;and &lt;/span&gt;i.index_id &amp;lt;&amp;gt; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #38761d;&quot;&gt;--&amp;nbsp;&amp;nbsp;&amp;nbsp; not a primary key&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;order by&lt;/span&gt; t.[name], i.[name]&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbachman.blogspot.com/feeds/6562322268095544452/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbachman.blogspot.com/2010/01/find-index-usage-against-particular.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5406422383207371171/posts/default/6562322268095544452'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5406422383207371171/posts/default/6562322268095544452'/><link rel='alternate' type='text/html' href='http://dbachman.blogspot.com/2010/01/find-index-usage-against-particular.html' title='Find index usage against a particular table, &amp; find all unused indexes in the database'/><author><name>Deirdre Bachman</name><uri>http://www.blogger.com/profile/05542425173365143572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2gL1tPbZ10Ya9mFK47vSUcWmUr1zpZJIyagHnKAfnbPEmVPCx4P-Ph_BCoQycF_L7HVMnZ9lKG2xfosXUPOSXzKeYlA-txFDF5Jt98QHdbpsshPNgJnUqHTAxg0lWPQ/s220/d_redwood.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5406422383207371171.post-7456369336422530026</id><published>2010-01-07T20:14:00.000-05:00</published><updated>2010-01-07T20:14:42.126-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="boilerplate code"/><category scheme="http://www.blogger.com/atom/ns#" term="DTS Packages"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2000"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2005"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2008"/><title type='text'>Migrating Legacy DTS packages</title><content type='html'>&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;The environment: SQL Server 2000, SQL Server 2005 and SQL Server 2008 &lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Consider an environment in which you&#39;re asked to migrate a large number of DTS packages from one of your servers onto another server.&amp;nbsp; You could manually move each package, but if the following conditions are met, a simple insert statement into msdb..sysdtspackages can make your life a lot easier:&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;ul&gt;&lt;li style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;you don&#39;t need to convert your DTS packages to SSIS packages&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;all of your packages are stored on the server (rather than as a file) &lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;use&lt;/span&gt; [msdb]&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #eeeeee; color: blue; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;go&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;insert into&lt;/span&gt; &lt;span style=&quot;color: #38761d;&quot;&gt;sysdtspackages&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select &lt;/span&gt;[name],&lt;/span&gt;&lt;br style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id,&lt;/span&gt;&lt;br style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; versionid,&lt;/span&gt;&lt;br style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; description,&lt;/span&gt;&lt;br style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; categoryid,&lt;/span&gt;&lt;br style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; createdate,&lt;/span&gt;&lt;br style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; owner,&lt;/span&gt;&lt;br style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; packagedata,&lt;/span&gt;&lt;br style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; owner_sid,&lt;/span&gt;&lt;br style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; packagetype&lt;/span&gt;&lt;br style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;from &lt;/span&gt;[linkedserver].msdb.dbo.&lt;span style=&quot;color: #38761d;&quot;&gt;sysdtspackages&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;          &lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/span&gt;&lt;br style=&quot;background-color: #eeeeee;&quot; /&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbachman.blogspot.com/feeds/7456369336422530026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbachman.blogspot.com/2010/01/migrating-legacy-dts-packages.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5406422383207371171/posts/default/7456369336422530026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5406422383207371171/posts/default/7456369336422530026'/><link rel='alternate' type='text/html' href='http://dbachman.blogspot.com/2010/01/migrating-legacy-dts-packages.html' title='Migrating Legacy DTS packages'/><author><name>Deirdre Bachman</name><uri>http://www.blogger.com/profile/05542425173365143572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2gL1tPbZ10Ya9mFK47vSUcWmUr1zpZJIyagHnKAfnbPEmVPCx4P-Ph_BCoQycF_L7HVMnZ9lKG2xfosXUPOSXzKeYlA-txFDF5Jt98QHdbpsshPNgJnUqHTAxg0lWPQ/s220/d_redwood.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5406422383207371171.post-2063015378650217567</id><published>2010-01-04T14:33:00.003-05:00</published><updated>2010-01-04T14:57:37.999-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="confio"/><category scheme="http://www.blogger.com/atom/ns#" term="embarcadero"/><category scheme="http://www.blogger.com/atom/ns#" term="idera"/><category scheme="http://www.blogger.com/atom/ns#" term="maintenance"/><category scheme="http://www.blogger.com/atom/ns#" term="monitoring"/><category scheme="http://www.blogger.com/atom/ns#" term="performance"/><category scheme="http://www.blogger.com/atom/ns#" term="quest"/><category scheme="http://www.blogger.com/atom/ns#" term="red gate"/><category scheme="http://www.blogger.com/atom/ns#" term="software"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2000"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2008"/><title type='text'>Choosing a monitoring solution for SQL Server</title><content type='html'>&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;Depending on the size of your environment, you might find yourself in need of third-party software to monitor you various SQL Servers.&amp;nbsp; I&#39;m going to examine various tools and outline my findings below.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS; font-size: x-small;&quot;&gt;It should be noted that there is not one solution for everyone - your solution can and should vary based on the size of your environment, budget, monitoring needs, and your personal preference.&amp;nbsp; I&#39;ve discarded several of the solutions below because I simply did not like either the implementation or the interface.&amp;nbsp; Also, this is not at all a comprehensive list of monitoring software - this represents the result of a quick search of several SQL forums&#39; recommendations, as well as a quick Google search.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS; font-size: x-small;&quot;&gt;I have need to monitor about 8-10 servers - 5 production clusters, 2 reporting repositories, and 1 dedicated replication distributor.&amp;nbsp; I need job monitoring, query collection, and counter monitoring.&amp;nbsp; Reports and trending would be nice (this is something I&#39;ve found a bit lacking with our current solution).&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS; font-size: x-small;&quot;&gt;** This post does not constitute a recommendation or endorsement of any of the products below.&amp;nbsp; I am not an employee or representative of any of the companies listed.&amp;nbsp; I am not being compensated in any fashion in conjunction with these recommendations.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;&lt;u&gt;Idera&lt;/u&gt;&lt;/strong&gt; (&lt;/span&gt;&lt;a href=&quot;http://www.idera.com/&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;http://www.idera.com&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;&lt;u&gt;SQL Diagnostic Manager&lt;/u&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;Pros&lt;/strong&gt;: relatively intuitive dashboard views, multi-server views, very usable interface&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;Cons&lt;/strong&gt;: occasionally buggy; I find some of the alerting annoying and obtrusive&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;Features&lt;/strong&gt;: query collection at configurable intervals, SQL and Windows counter alerting and collection, job monitoring and alerting&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;Price Point&lt;/strong&gt;: $2049 per instance, plus maintenance of $409.80&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;Notes&lt;/strong&gt;:&amp;nbsp;We are currently using this in our production environment (I&#39;m examining other solutions as the license is up for renewal)&amp;nbsp; There are a few bugs in our version, but I&#39;ve spoken with their support team, who is responsive and helpful, and it seems that these are resolved in the latest version they offer.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;&lt;u&gt;Confio&lt;/u&gt;&lt;/strong&gt; (&lt;/span&gt;&lt;a href=&quot;http://www.confio.com/&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;http://www.confio.com&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;&lt;u&gt;Ignite&lt;/u&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;Pros&lt;/strong&gt;: &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;Cons&lt;/strong&gt;: Java-based web client.&amp;nbsp; I prefer a standalone executable.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;Features&lt;/strong&gt;: Did not get as far as configuring this to run.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;Price Point&lt;/strong&gt;: N/A&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;Notes&lt;/strong&gt;:&amp;nbsp;As stated above, I&amp;nbsp;installed this, but did not get past the configuration&amp;nbsp;part&amp;nbsp;for reasons stated (this is a web client, rather than a standalone executable)&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;&lt;u&gt;Quest&lt;/u&gt;&lt;/strong&gt; (&lt;/span&gt;&lt;a href=&quot;http://www.quest.com/&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;http://www.quest.com&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;&lt;u&gt;Spotlight on SQL Server&lt;/u&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;Pros&lt;/strong&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;Cons&lt;/strong&gt;: The only con is that our shop is currently using Idera SQL Diagnostic Manager, which we can renew (and download the latest version) for far cheaper than we can purchase a new install of Spotlight for.&amp;nbsp; The outright purchase price is comparable with SQL Diagnostic Manger, though this seems to offer far more powerful tools with respect to reporting and trending.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;Features&lt;/strong&gt;:&amp;nbsp;&amp;nbsp;Configurable alarms for Windows and SQL Server counters, fully configurable data collection scheduling, configurable custom counters, file monitoring, job monitoring,&amp;nbsp;error log monitoring, and quite a bit more that I don&#39;t really have time to examine.&amp;nbsp; The&amp;nbsp;default view is a little confusing and uninformative (consists of a lot of large, brightly colored circles and arrows and animations simulating network traffic) but the other views are very slick - there is reporting and trending for any of the counters (ex: Database File IO Statistics, Plan Cache - 2000 and 2005 only, for now).&amp;nbsp; It looks like the reporting and trending relies on a statistics repository that I&#39;ve not yet configured.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;Price Point&lt;/strong&gt;: per server license of $1,995.00&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;&lt;u&gt;Red Gate&lt;/u&gt;&lt;/strong&gt; (&lt;/span&gt;&lt;a href=&quot;http://www.red-gate.com/&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;http://www.red-gate.com&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;&lt;u&gt;SQL Response&lt;/u&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;Pros&lt;/strong&gt;: Small, light-weight and easy-to-use.&amp;nbsp; Initial setup and configuration is minimal and intuituve.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;Cons&lt;/strong&gt;: lacks configurable trace - in the past, I have found it extremely useful to collect snapshots of running queries at set intervals, for the purpose of troubleshooting.&amp;nbsp; The &quot;enable trace&quot; option only collects for a given interval before/after an alert is raised, and retention is highly minimal.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;Features&lt;/strong&gt;: &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;Price Point&lt;/strong&gt;: $619, with support/upgrades&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS; font-size: x-small;&quot;&gt;&lt;strong&gt;Notes&lt;/strong&gt;: I really like Red Gate&#39;s other products (SQL Compare, SQL Backup, etc)&amp;nbsp;- they know how to create a good-looking, functional interface.&amp;nbsp; My experience with their sales and support staff&amp;nbsp;has been overwhelmingly positive.&amp;nbsp; This would be my tool of choice at a smaller shop with less rigorous performance monitoring&amp;nbsp;requirements.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS; font-size: x-small;&quot;&gt;&lt;strong&gt;&lt;u&gt;Embarcadero&lt;/u&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS; font-size: x-small;&quot;&gt;&lt;strong&gt;&lt;u&gt;Performance Center 2.7&lt;/u&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;, sans-serif; font-size: x-small;&quot;&gt;&lt;strong&gt;Pros&lt;/strong&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS; font-size: x-small;&quot;&gt;&lt;strong&gt;Cons&lt;/strong&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS; font-size: x-small;&quot;&gt;&lt;strong&gt;Features&lt;/strong&gt;:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS; font-size: x-small;&quot;&gt;&lt;strong&gt;Price Point&lt;/strong&gt;: &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Trebuchet MS; font-size: x-small;&quot;&gt;&lt;strong&gt;Notes&lt;/strong&gt;: cancelled install when it prompted to install Apache&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbachman.blogspot.com/feeds/2063015378650217567/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbachman.blogspot.com/2010/01/choosing-monitoring-solution-for-sql.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5406422383207371171/posts/default/2063015378650217567'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5406422383207371171/posts/default/2063015378650217567'/><link rel='alternate' type='text/html' href='http://dbachman.blogspot.com/2010/01/choosing-monitoring-solution-for-sql.html' title='Choosing a monitoring solution for SQL Server'/><author><name>Deirdre Bachman</name><uri>http://www.blogger.com/profile/05542425173365143572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2gL1tPbZ10Ya9mFK47vSUcWmUr1zpZJIyagHnKAfnbPEmVPCx4P-Ph_BCoQycF_L7HVMnZ9lKG2xfosXUPOSXzKeYlA-txFDF5Jt98QHdbpsshPNgJnUqHTAxg0lWPQ/s220/d_redwood.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5406422383207371171.post-3460965288629869799</id><published>2010-01-03T17:24:00.002-05:00</published><updated>2010-01-03T17:47:18.776-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="backups"/><category scheme="http://www.blogger.com/atom/ns#" term="boilerplate code"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2000"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2005"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2008"/><title type='text'>Find the last full backup date for all databases on a server</title><content type='html'>&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Consider a situation in which you&#39;re taking over a number of SQL Servers, and you find yourself wondering about the backup situation - maybe you need to pull a full backup history for each database on each server, or maybe you just need to verify that your databases are being backed up.&amp;nbsp; This is a quick script that pulls the last full backup date for each database on the server - I&#39;m including a SQL Server 2000-compatible version of the script:&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;b&gt;SQL Server 2000&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;select d.[name],&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; x.backup_date&lt;br /&gt;
from sysdatabases d &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; left outer join &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; select database_name,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; convert(varchar(50),max(backup_finish_date),110) as backup_date &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; from msdb..backupset&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; where [type] = &#39;D&#39;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; group by database_name&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ) x on x.database_name = d.[name]&lt;br /&gt;
order by d.[name]&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif; font-size: x-small;&quot;&gt;&lt;b&gt;SQL Server 2008 (should also work for SQL Server 2005)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: #eeeeee; text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;;&lt;span style=&quot;color: blue;&quot;&gt;with &lt;/span&gt;x &lt;span style=&quot;color: blue;&quot;&gt;as &lt;/span&gt;&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;(&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;select &lt;/span&gt;database_name,&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; backup_size&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;as &lt;/span&gt;backup_size_bytes,&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; backup_size / 1024&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;as &lt;/span&gt;backup_size_kbytes,&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; backup_size / (1024*1024)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;as &lt;/span&gt;backup_size_mbytes,&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; compressed_backup_size,&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;convert&lt;/span&gt;(&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;(50),backup_finish_date,110) &lt;span style=&quot;color: blue;&quot;&gt;as &lt;/span&gt;backup_date,&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; [type],&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;row_number&lt;/span&gt;() &lt;span style=&quot;color: blue;&quot;&gt;over &lt;/span&gt;( &lt;span style=&quot;color: blue;&quot;&gt;partition by&lt;/span&gt; database_name &lt;span style=&quot;color: blue;&quot;&gt;order by&lt;/span&gt; backup_finish_date &lt;span style=&quot;color: blue;&quot;&gt;desc &lt;/span&gt;) &lt;span style=&quot;color: blue;&quot;&gt;as &lt;/span&gt;rnk &lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;from &lt;/span&gt;msdb..backupset&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;where &lt;/span&gt;[type] = &lt;span style=&quot;color: red;&quot;&gt;&#39;D&#39;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;) &lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;select &lt;/span&gt;d.[name],&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; d.recovery_model_desc,&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; x.*&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;from &lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;sys.databases&lt;/span&gt; d&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #666666;&quot;&gt;left outer join &lt;/span&gt;x &lt;span style=&quot;color: blue;&quot;&gt;on &lt;/span&gt;x.database_name = d.[name]&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;and &lt;/span&gt;x.rnk = 1&lt;/span&gt;&lt;br style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;order by&lt;/span&gt; d.[name]&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot; /&gt;&lt;span style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;Note that this is only the first step in your due diligence - you still have to determine where your databases are being backed up to, your retention window (locally and on any off-site tapes or servers), and (of course) run periodic fire drills to make sure your backup solution is adequate to the task - more on that in a later post.&lt;/span&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbachman.blogspot.com/feeds/3460965288629869799/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbachman.blogspot.com/2010/01/find-last-full-backup-date-for-all.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5406422383207371171/posts/default/3460965288629869799'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5406422383207371171/posts/default/3460965288629869799'/><link rel='alternate' type='text/html' href='http://dbachman.blogspot.com/2010/01/find-last-full-backup-date-for-all.html' title='Find the last full backup date for all databases on a server'/><author><name>Deirdre Bachman</name><uri>http://www.blogger.com/profile/05542425173365143572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2gL1tPbZ10Ya9mFK47vSUcWmUr1zpZJIyagHnKAfnbPEmVPCx4P-Ph_BCoQycF_L7HVMnZ9lKG2xfosXUPOSXzKeYlA-txFDF5Jt98QHdbpsshPNgJnUqHTAxg0lWPQ/s220/d_redwood.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5406422383207371171.post-953536097200992383</id><published>2010-01-02T18:19:00.004-05:00</published><updated>2010-01-02T18:31:02.929-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="boilerplate code"/><category scheme="http://www.blogger.com/atom/ns#" term="index"/><category scheme="http://www.blogger.com/atom/ns#" term="size"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2005"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2008"/><category scheme="http://www.blogger.com/atom/ns#" term="table"/><title type='text'>Find disk space usage for all tables and their indexes</title><content type='html'>&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;The environment: SQL Server 2008 (this should work on SQL Server 2005 as well)&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif; text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Consider a scenario in which you inherit a large database, or in which you revisit a database which has been sitting quietly in production for a while, just accumulating data.&amp;nbsp; This script compiles a full list of all of the tables in the database, along with their total reserved size in KB, their total index size in KB, and their total data size in KB.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;create table&lt;/span&gt; #tmpsizes&lt;br /&gt;
(&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ID&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;int&amp;nbsp;&amp;nbsp;&amp;nbsp; identity(1,1) primary key&lt;/span&gt;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; [name]&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;nvarchar&lt;/span&gt;(128),&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; [rows]&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;char&lt;/span&gt;(11),&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; reserved&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;(18),&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; data&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;(18),&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; index_size&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;(18),&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; unused&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;(18),&lt;br /&gt;
)&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;create table&lt;/span&gt; #tmpsizes2&lt;br /&gt;
(&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ID&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;int&amp;nbsp;&amp;nbsp;&amp;nbsp; identity(1,1) primary key&lt;/span&gt;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; [name]&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;nvarchar&lt;/span&gt;(128),&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; [rows]&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; reserved_kb&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; data_kb&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; index_size_kb&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; unused_kb&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;br /&gt;
)&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #cccccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;declare &lt;/span&gt;@objname &lt;span style=&quot;color: blue;&quot;&gt;nvarchar&lt;/span&gt;(128)&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;declare &lt;/span&gt;sizeCur &lt;span style=&quot;color: blue;&quot;&gt;cursor forward_only for&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;select &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;[&#39;&lt;/span&gt; + s.[name] + &lt;span style=&quot;color: red;&quot;&gt;&#39;].&#39;&lt;/span&gt; + t.[name]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;from &lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;sys.tables&lt;/span&gt; t&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #444444;&quot;&gt;inner join&lt;/span&gt; &lt;span style=&quot;color: #38761d;&quot;&gt;sys.schemas&lt;/span&gt; s on t.&lt;span style=&quot;color: magenta;&quot;&gt;schema_id&lt;/span&gt; = s.&lt;span style=&quot;color: magenta;&quot;&gt;schema_id&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;open &lt;/span&gt;sizeCur&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;fetch next from&lt;/span&gt; sizeCur &lt;span style=&quot;color: blue;&quot;&gt;into &lt;/span&gt;@objname&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;while &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;@@fetch_status&lt;/span&gt; = 0&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;begin&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;insert into &lt;/span&gt;#tmpsizes&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;exec &lt;/span&gt;&lt;span style=&quot;color: #990000;&quot;&gt;sp_spaceused&lt;/span&gt; @objname&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;fetch next from&lt;/span&gt; sizeCur &lt;span style=&quot;color: blue;&quot;&gt;into &lt;/span&gt;@objname&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;end&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;close &lt;/span&gt;sizeCur&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;deallocate &lt;/span&gt;sizeCur&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;insert into&lt;/span&gt; #tmpsizes2&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;select &lt;/span&gt;[name],&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; [rows],&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #444444;&quot;&gt;left&lt;/span&gt;(reserved, &lt;span style=&quot;color: magenta;&quot;&gt;len&lt;/span&gt;(reserved)-3),&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #444444;&quot;&gt;left&lt;/span&gt;(data, &lt;span style=&quot;color: magenta;&quot;&gt;len&lt;/span&gt;(data)-3),&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #444444;&quot;&gt;left&lt;/span&gt;(index_size, &lt;span style=&quot;color: magenta;&quot;&gt;len&lt;/span&gt;(index_size)-3),&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #444444;&quot;&gt;left&lt;/span&gt;(unused, &lt;span style=&quot;color: magenta;&quot;&gt;len&lt;/span&gt;(unused)-3)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;from &lt;/span&gt;#tmpsizes&lt;br /&gt;
&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;-- show tables with the most rows at the top of the list&lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;select &lt;/span&gt;*&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;from &lt;/span&gt;#tmpsizes2&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;order by &lt;/span&gt;[rows] &lt;span style=&quot;color: blue;&quot;&gt;desc &lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;-- show tables with highest ratios of index size to table size&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;-- at the top of the list&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;select &lt;/span&gt;*,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;cast&lt;/span&gt;(index_size_kb &lt;span style=&quot;color: blue;&quot;&gt;as decimal&lt;/span&gt;(18,4))/&lt;span style=&quot;color: magenta;&quot;&gt;cast&lt;/span&gt;(reserved_kb &lt;span style=&quot;color: blue;&quot;&gt;as decimal(&lt;/span&gt;18,4)) &lt;span style=&quot;color: blue;&quot;&gt;as&lt;/span&gt; index_percentage&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;from &lt;/span&gt;#tmpsizes2&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;where &lt;/span&gt;reserved_kb &amp;gt; 0&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;order by&lt;/span&gt; &lt;span style=&quot;color: magenta;&quot;&gt;cast&lt;/span&gt;(index_size_kb &lt;span style=&quot;color: blue;&quot;&gt;as decimal&lt;/span&gt;(18,4))/&lt;span style=&quot;color: magenta;&quot;&gt;cast&lt;/span&gt;(reserved_kb &lt;span style=&quot;color: blue;&quot;&gt;as decimal&lt;/span&gt;(18,4)) &lt;span style=&quot;color: blue;&quot;&gt;desc&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;drop table&lt;/span&gt; #tmpsizes&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;drop table&lt;/span&gt; #tmpsizes2&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbachman.blogspot.com/feeds/953536097200992383/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbachman.blogspot.com/2010/01/find-disk-space-usage-for-all-tables.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5406422383207371171/posts/default/953536097200992383'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5406422383207371171/posts/default/953536097200992383'/><link rel='alternate' type='text/html' href='http://dbachman.blogspot.com/2010/01/find-disk-space-usage-for-all-tables.html' title='Find disk space usage for all tables and their indexes'/><author><name>Deirdre Bachman</name><uri>http://www.blogger.com/profile/05542425173365143572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2gL1tPbZ10Ya9mFK47vSUcWmUr1zpZJIyagHnKAfnbPEmVPCx4P-Ph_BCoQycF_L7HVMnZ9lKG2xfosXUPOSXzKeYlA-txFDF5Jt98QHdbpsshPNgJnUqHTAxg0lWPQ/s220/d_redwood.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5406422383207371171.post-1234725421536443032</id><published>2010-01-02T17:59:00.000-05:00</published><updated>2010-01-02T17:59:31.011-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="boilerplate code"/><title type='text'>Boilerplate Code</title><content type='html'>&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;I&#39;m going to take advantage of this lazy Saturday afternoon to post some of my boilerplate code - this is code that I find use for on a repeat basis.&amp;nbsp; Whenever I post code that you&#39;re likely to want to save and re-use, I&#39;ll tag it as boilerplate code.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt; &lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Some examples:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;ul style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;find all the heaps in a database&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;search job code for a snippet of text&lt;br /&gt;
&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;search proc/function code for a snippet of text &lt;br /&gt;
&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;kill all of the open connections in a database (or all of the open connections from a given user)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;find all of the table and index sizes in a database&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Coming up: find all of the table and index sizes in a database! &lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbachman.blogspot.com/feeds/1234725421536443032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbachman.blogspot.com/2010/01/boilerplate-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5406422383207371171/posts/default/1234725421536443032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5406422383207371171/posts/default/1234725421536443032'/><link rel='alternate' type='text/html' href='http://dbachman.blogspot.com/2010/01/boilerplate-code.html' title='Boilerplate Code'/><author><name>Deirdre Bachman</name><uri>http://www.blogger.com/profile/05542425173365143572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2gL1tPbZ10Ya9mFK47vSUcWmUr1zpZJIyagHnKAfnbPEmVPCx4P-Ph_BCoQycF_L7HVMnZ9lKG2xfosXUPOSXzKeYlA-txFDF5Jt98QHdbpsshPNgJnUqHTAxg0lWPQ/s220/d_redwood.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5406422383207371171.post-226251351461286600</id><published>2010-01-01T15:58:00.021-05:00</published><updated>2010-01-02T18:05:27.392-05:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="boilerplate code"/><category scheme="http://www.blogger.com/atom/ns#" term="distribution agent error"/><category scheme="http://www.blogger.com/atom/ns#" term="Msg. 2627"/><category scheme="http://www.blogger.com/atom/ns#" term="replication"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2008"/><category scheme="http://www.blogger.com/atom/ns#" term="violation of primary key constraint"/><title type='text'>Replication: spot-check existing subscriptions for duplicate articles</title><content type='html'>&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;The environment: SQL Server 2008 Enterprise 64-bit - transactional replication using a dedicated distributor. &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;SQL Server distribution agent generates error code 2627 with the following message: &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;b&gt;Violation of PRIMARY KEY constraint &#39;PK_TableName&#39;. Cannot insert duplicate key in object &#39;dbo.TableName&#39;.&lt;/b&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;A quick manual inspection of the SQL Server error logs on the distributor reveals that there are two distribution agents generating the same error.  If your publication is set to drop/recreate tables at the subscriber, it is possible to have duplicate replication - two different publications publishing the same article to the same destination server, database and table. &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Removing one or both articles should resolve the issue (you may need to drop/add the article and re-snapshot).  To guard against this error in the future, run the following query at the publisher database to determine if there are any other existing duplications:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;select &lt;/span&gt;a.[name] &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;    as &lt;/span&gt;articlename,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s.srvname&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;       as &lt;/span&gt;destination_servername,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s.dest_db&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;       as &lt;/span&gt;destination_database,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a.dest_table&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;    as &lt;/span&gt;destination_table,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: magenta;&quot;&gt;count&lt;/span&gt;(*)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;        as &lt;/span&gt;numduplications&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;from &lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;syspublications &lt;/span&gt;p&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #444444;&quot;&gt;inner join&lt;/span&gt; &lt;span style=&quot;color: #38761d;&quot;&gt;sysarticles &lt;/span&gt;a &lt;span style=&quot;color: blue;&quot;&gt;on &lt;/span&gt;p.pubid = a.pubid&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #444444;&quot;&gt;inner join&lt;/span&gt; &lt;span style=&quot;color: #38761d;&quot;&gt;syssubscriptions &lt;/span&gt;s &lt;span style=&quot;color: blue;&quot;&gt;on &lt;/span&gt;s.artid = a.artid&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;group by&lt;/span&gt; a.[name],&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s.srvname,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s.dest_db,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a.dest_table&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;having &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;count&lt;/span&gt;(*) &amp;gt;= 1&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Before creating any new publications, or adding any articles to existing publications, run the following check for any tables you&#39;re adding to replication:&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;select &lt;/span&gt;a.[name]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;     as &lt;/span&gt;articlename,&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s.srvname&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;       as &lt;/span&gt;destination_servername,&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s.dest_db&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;       as &lt;/span&gt;destination_database,&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a.dest_table&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: blue;&quot;&gt;    as &lt;/span&gt;destination_table&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;from &lt;/span&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;syspublications &lt;/span&gt;p&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #444444;&quot;&gt;inner join&lt;/span&gt; &lt;span style=&quot;color: #38761d;&quot;&gt;sysarticles &lt;/span&gt;a &lt;span style=&quot;color: blue;&quot;&gt;on &lt;/span&gt;p.pubid = a.pubid&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #444444;&quot;&gt;inner join&lt;/span&gt; &lt;span style=&quot;color: #38761d;&quot;&gt;syssubscriptions &lt;/span&gt;s &lt;span style=&quot;color: blue;&quot;&gt;on &lt;/span&gt;s.artid = a.artid&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;background-color: #eeeeee; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;span style=&quot;font-size: xx-small;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;where &lt;/span&gt;a.[name] = &lt;span style=&quot;color: red;&quot;&gt;&#39;tablename&#39;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbachman.blogspot.com/feeds/226251351461286600/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbachman.blogspot.com/2010/01/replication-spot-check-existing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5406422383207371171/posts/default/226251351461286600'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5406422383207371171/posts/default/226251351461286600'/><link rel='alternate' type='text/html' href='http://dbachman.blogspot.com/2010/01/replication-spot-check-existing.html' title='Replication: spot-check existing subscriptions for duplicate articles'/><author><name>Deirdre Bachman</name><uri>http://www.blogger.com/profile/05542425173365143572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2gL1tPbZ10Ya9mFK47vSUcWmUr1zpZJIyagHnKAfnbPEmVPCx4P-Ph_BCoQycF_L7HVMnZ9lKG2xfosXUPOSXzKeYlA-txFDF5Jt98QHdbpsshPNgJnUqHTAxg0lWPQ/s220/d_redwood.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5406422383207371171.post-8577764642870956592</id><published>2010-01-01T14:50:00.000-05:00</published><updated>2010-01-01T14:50:18.623-05:00</updated><title type='text'>Welcome to my blog!</title><content type='html'>&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;Hello everyone!&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;This is my first blog post - I&#39;m just testing out the system right now.&amp;nbsp; I expect the first couple of posts here to concern replication, as it&#39;s something which I&#39;m currently tweaking and streamlining.&amp;nbsp; However, I deal with everything from backups to performance tuning to development, so there should be a nice balance of topics.&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;A note on my environment - we&#39;re currently running transactional replication from 5-7 production servers through a single central distributor to multiple reporting and centralized business rules servers.&amp;nbsp; Most of the servers in my production environment are running SQL 2008 Enterprise 64-bit, and I anticipate that by mid-year, all of my remaining servers will be migrated to our SQL 2008 active passive clusters.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;I&#39;ve been a DBA for about 5 years now, working with SQL Server 2000/2005/2008, and every time I dig a little deeper into the SQL Server internals, I realize just how much there is to know.&amp;nbsp; I&#39;ve been meaning to keep a blog for a while now, and it&#39;s kind of a New Years resolution - for myself as a kind of documentation, and for anyone out there who may stumble across any of the same issues.&amp;nbsp; Nothing infuriates me more than not knowing *why* something is happening, so expect a lot of detail in my posts.&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Trebuchet MS&amp;quot;,sans-serif;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;D&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dbachman.blogspot.com/feeds/8577764642870956592/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dbachman.blogspot.com/2010/01/welcome-to-my-blog.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5406422383207371171/posts/default/8577764642870956592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5406422383207371171/posts/default/8577764642870956592'/><link rel='alternate' type='text/html' href='http://dbachman.blogspot.com/2010/01/welcome-to-my-blog.html' title='Welcome to my blog!'/><author><name>Deirdre Bachman</name><uri>http://www.blogger.com/profile/05542425173365143572</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2gL1tPbZ10Ya9mFK47vSUcWmUr1zpZJIyagHnKAfnbPEmVPCx4P-Ph_BCoQycF_L7HVMnZ9lKG2xfosXUPOSXzKeYlA-txFDF5Jt98QHdbpsshPNgJnUqHTAxg0lWPQ/s220/d_redwood.jpg'/></author><thr:total>0</thr:total></entry></feed>