<?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> &#187; Databases</title>
	<atom:link href="http://benchmarkitconsulting.com/tag/databases/feed/" rel="self" type="application/rss+xml" />
	<link>http://benchmarkitconsulting.com</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 12:54:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>SQL Databases That Have Not Had a Full Backup in x Days</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/06/16/sql-databases-that-have-not-had-a-full-backup-in-x-days/</link>
		<comments>http://benchmarkitconsulting.com/colin-stasiuk/2009/06/16/sql-databases-that-have-not-had-a-full-backup-in-x-days/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 14:59:38 +0000</pubDate>
		<dc:creator>Colin Stasiuk</dc:creator>
				<category><![CDATA[Backup]]></category>
		<category><![CDATA[Benchmark IT Consulting]]></category>
		<category><![CDATA[Colin Stasiuk]]></category>
		<category><![CDATA[Maintenance]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Backups]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=757</guid>
		<description><![CDATA[So something that you should do regardless of the alerts, notifications, etc that you have setup is to just have a daily sanity check on your database backups. Sure you don&#8217;t have any failed jobs but what if the job never attempted to run in the first place like it was supposed to? If a [...]]]></description>
			<content:encoded><![CDATA[<p>So something that you should do regardless of the alerts, notifications, etc that you have setup is to just have a daily sanity check on your database backups. Sure you don&#8217;t have any failed jobs but what if the job never attempted to run in the first place like it was supposed to?</p>
<p>If a database fails in the enviroment and no backup is there to recover from does it make a sound?</p>
<p>Well no&#8230; but the users are heard for miles hahaha</p>
<p><img class="alignnone size-full wp-image-760" title="screaming" src="http://benchmarkitconsulting.com/wp-content/uploads/2009/06/screaming.jpg" alt="screaming" width="180" height="179" /></p>
<p>Below is a nice quick sanity check showing all the dbs that have NOT been backed up for X days or have never been backed up at all. </p>
<p><code style="font-size: 12px;"><span style="color:blue">DECLARE&nbsp;</span><span style="color:#434343">@num_of_days&nbsp;</span><span style="color:blue">INT<br />
<br />SET&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:#434343">@num_of_days&nbsp;</span><span style="color:blue">=&nbsp;</span><span style="color:black">1&nbsp;</p>
<p></span><span style="color:blue">SELECT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color:black">A.name</span><span style="color:gray">,&nbsp;</span><span style="color:blue">MAX</span><span style="color:gray">(</span><span style="color:black">B.backup_finish_date</span><span style="color:gray">)&nbsp;</span><span style="color:blue">AS&nbsp;</span><span style="color:red">&#39;LastBackupDateTime&#39;<br />
<br /></span><span style="color:blue">FROM&nbsp;&nbsp;&nbsp;</span><span style="color:black">master.dbo.sysdatabases&nbsp;A&nbsp;</span><span style="color:blue">WITH</span><span style="color:gray">(</span><span style="color:black">NOLOCK</span><span style="color:gray">)&nbsp;&nbsp;</span><span style="color:magenta">LEFT&nbsp;</span><span style="color:gray">OUTER&nbsp;</span><span style="color:blue">JOIN<br />
<br />&nbsp;&nbsp;&nbsp;</span><span style="color:black">msdb.dbo.backupset&nbsp;B&nbsp;</span><span style="color:blue">WITH</span><span style="color:gray">(</span><span style="color:black">NOLOCK</span><span style="color:gray">)&nbsp;</span><span style="color:blue">ON&nbsp;</span><span style="color:black">A.name&nbsp;</span><span style="color:blue">=&nbsp;</span><span style="color:black">B.database_name<br />
<br /></span><span style="color:blue">WHERE&nbsp;&nbsp;</span><span style="color:gray">(</span><span style="color:black">B.TYPE&nbsp;</span><span style="color:blue">=&nbsp;</span><span style="color:red">&#39;D&#39;&nbsp;</span><span style="color:gray">OR&nbsp;</span><span style="color:black">B.TYPE&nbsp;</span><span style="color:blue">IS&nbsp;</span><span style="color:gray">NULL)<br />
<br /></span><span style="color:blue">GROUP&nbsp;BY&nbsp;</span><span style="color:black">A.name<br />
<br /></span><span style="color:blue">HAVING&nbsp;</span><span style="color:gray">(</span><span style="color:blue">MAX</span><span style="color:gray">(</span><span style="color:black">B.backup_finish_date</span><span style="color:gray">)&nbsp;&lt;&nbsp;</span><span style="color:magenta">GETDATE</span><span style="color:gray">()&nbsp;-&nbsp;</span><span style="color:#434343">@num_of_days&nbsp;</span><span style="color:gray">OR&nbsp;</span><span style="color:blue">MAX</span><span style="color:gray">(</span><span style="color:black">B.backup_finish_date</span><span style="color:gray">)&nbsp;</span><span style="color:blue">IS&nbsp;</span><span style="color:gray">NULL)&nbsp;<br />
<br /></span><span style="color:blue">ORDER&nbsp;BY&nbsp;</span><span style="color:black">A.name<br />
<br /></span></code></p>
<p>Enjoy!!</p>
<p><span><a href="http://benchmarkitconsulting.com" target="_blank"><img class="alignnone size-full wp-image-402" title="benchmark_sm" src="http://benchmarkitconsulting.com/wp-content/uploads/2009/02/benchmark_sm.jpg" alt="" width="157" height="74" /></a><a href="http://sqlserverpedia.com/wiki/Editors#Colin_Stasiuk" target="_blank"><img src="http://sqlserverpedia.com/badges/SQLServerPedia_Badge_Blogger.jpg" alt="" width="120" height="60" /> </a></span></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=SQL+Databases+That+Have+Not+Had+a+Full+Backup+in+x+Days+http://tinyurl.com/njatlc" title="Post to Twitter"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-twitter-big4.png" alt="Post to Twitter" /></a> <a class="tt" href="http://delicious.com/post?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/06/16/sql-databases-that-have-not-had-a-full-backup-in-x-days/&amp;title=SQL+Databases+That+Have+Not+Had+a+Full+Backup+in+x+Days" title="Post to Delicious"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-delicious-big4.png" alt="Post to Delicious" /></a> <a class="tt" href="http://digg.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/06/16/sql-databases-that-have-not-had-a-full-backup-in-x-days/&amp;title=SQL+Databases+That+Have+Not+Had+a+Full+Backup+in+x+Days" title="Post to Digg"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-digg-big4.png" alt="Post to Digg" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://benchmarkitconsulting.com/colin-stasiuk/2009/06/16/sql-databases-that-have-not-had-a-full-backup-in-x-days/&amp;title=SQL+Databases+That+Have+Not+Had+a+Full+Backup+in+x+Days" title="Post to StumbleUpon"><img class="nothumb" src="http://benchmarkitconsulting.com/wp-content/plugins/tweet-this/icons/tt-su-big4.png" alt="Post to StumbleUpon" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://benchmarkitconsulting.com/colin-stasiuk/2009/06/16/sql-databases-that-have-not-had-a-full-backup-in-x-days/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

