<?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; Backup</title>
	<atom:link href="http://benchmarkitconsulting.com/tag/backup/feed/" rel="self" type="application/rss+xml" />
	<link>http://benchmarkitconsulting.com</link>
	<description></description>
	<lastBuildDate>Mon, 06 Feb 2012 16:34:05 +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>The Wiki-Witch of the Quest</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/09/14/the-wiki-witch-of-the-quest/</link>
		<comments>http://benchmarkitconsulting.com/colin-stasiuk/2009/09/14/the-wiki-witch-of-the-quest/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 17:14:22 +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[Brent Ozar]]></category>
		<category><![CDATA[Restore]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQLServerPedia]]></category>
		<category><![CDATA[Wiki]]></category>

		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=1065</guid>
		<description><![CDATA[&#8220;I&#8217;ll Wiki you my pretty&#8230; and your little script too!!&#8221; So I submitted my first Wiki article over at SQLServerPedia: Restoring a User Database to a Different Environment and I have to admit that when I first started thinking about it I was quite concerned about how to do it, whether the script is &#8220;wiki [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-1066" title="brewit" src="http://benchmarkitconsulting.com/wp-content/uploads/2009/09/brewit.jpg" alt="brewit" width="220" height="168" /></p>
<p><strong><em>&#8220;I&#8217;ll Wiki you my pretty&#8230; and your little script too!!&#8221;</em></strong></p>
<p>So I submitted my first Wiki article over at SQLServerPedia:</p>
<p><a href="http://sqlserverpedia.com/wiki/Restoring_User_Databases_to_Different_Environments" target="_blank">Restoring a User Database to a Different Environment</a></p>
<p>and I have to admit that when I first started thinking about it I was quite concerned about how to do it, whether the script is &#8220;wiki worthy&#8221;, am I the only one who would find this useful, etc&#8230; So let&#8217;s talk about it</p>
<p><strong>How to do it &#8211; </strong>Well look no further then Brent Ozar to provide an amazing how to video: <a href="http://www.sqlserverpedia.com/wiki/How_To_Help" target="_blank">How to Write and Edit Articles</a></p>
<p><strong>Is my script &#8220;Wiki-Worthy&#8221; &#8211; </strong>This is the great thing about a wiki&#8230; even if your script is a just basic script to make your job easier what it provides is a building block for others to take and grow into something that turns into a more robust solution. </p>
<p><strong>Would Anyone Else Find This Useful &#8211; </strong>Do <strong>YOU</strong> find your script useful?  So what makes you think you&#8217;re so special that others wouldn&#8217;t find it useful or maybe they have a similar script that doesn&#8217;t do as much as what your script does&#8230; maybe it does more and now someone can edit your wiki article to include their contributions.</p>
<p>At the end of the day a wiki article is a great way to not only give something back to the community but it also provides an excellent mechanism to have others edit and contribute their 2 cents into the script or discuss how they solve a similar problem.  If SQL Server has taught me anything it&#8217;s taught me that there are a million ways to solve a problem and the way that YOU solve your problem might work but there might be a better solution out there.</p>
<p>Now if you&#8217;ve thought of submitting a wiki article to SQLServerPedia&#8230; now is the time.  SQLServerPedia is giving away an all expenses paid trip to the PASS Summit for new writers that have never been to the Summit before&#8230;  <a href="http://sqlserverpedia.com/wiki/Contest" target="_blank">Details Here</a></p>
<p>See you in Seattle!!</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=The+Wiki-Witch+of+the+Quest+http://tinyurl.com/mq55m7" 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/09/14/the-wiki-witch-of-the-quest/&amp;title=The+Wiki-Witch+of+the+Quest" 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/09/14/the-wiki-witch-of-the-quest/&amp;title=The+Wiki-Witch+of+the+Quest" 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/09/14/the-wiki-witch-of-the-quest/&amp;title=The+Wiki-Witch+of+the+Quest" 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/09/14/the-wiki-witch-of-the-quest/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>I am not the first DBA to take up this cause&#8230; but I am determined to be the last</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2009/09/10/i-am-not-the-first-dba-to-take-up-this-cause-but-i-am-determined-to-be-the-last/</link>
		<comments>http://benchmarkitconsulting.com/colin-stasiuk/2009/09/10/i-am-not-the-first-dba-to-take-up-this-cause-but-i-am-determined-to-be-the-last/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 16:47:11 +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[Monitoring]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Recovery]]></category>
		<category><![CDATA[Recovery Mode]]></category>
		<category><![CDATA[Transaction Log]]></category>
		<category><![CDATA[TSQL]]></category>

		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=1041</guid>
		<description><![CDATA[OK maybe this article is not THAT important LOL but it was a great quote by Obama so I figured I&#8217;d work it in LOL Please know what Recovery Mode your databases are in and your recovery requirements and then back them up accordingly. Too often I see databases that are in a Full or [...]]]></description>
			<content:encoded><![CDATA[<p>OK maybe this article is not THAT important LOL but it was a great quote by Obama so I figured I&#8217;d work it in LOL <img src='http://benchmarkitconsulting.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Please know what Recovery Mode your databases are in and your recovery requirements and then back them up accordingly.</p>
<p>Too often I see databases that are in a Full or Bulk Logged recovery mode but do not have transaction log backups running.  If you&#8217;re not performing transaction log backups there really is no good reason to be in a Full or Bulk Logged Recovery Mode.</p>
<p>Below is a script that you can run against a single instance or if you use a Central Management Server ( See <a href="http://www.brentozar.com/archive/2008/08/sql-server-2008s-new-central-management-server/" target="_blank">Brent Ozar&#8217;s post on CMS</a>) that you can use as a starting point to provide information on your databases, what recovery mode then are in, and their most recent Full, Differential, and Transaction Log Backup Date/Time.  I&#8217;ve also included the databases &#8220;Updateability&#8221; and &#8220;UserAccess&#8221; as these settings would play a role in your backup strategy.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="t-sql" style="font-family:monospace;">SELECT 	A.dbid, A.name as [DatabaseName], 
		CONVERT(sysname,DATABASEPROPERTYEX(A.name, 'Recovery')) AS [RecoveryMode],
		(	SELECT	max(backup_finish_date) 
			FROM	msdb.dbo.backupset 
			WHERE	[type] = 'D' and 
					database_name = A.name) AS [LastFullBackupDateTime],
		(	SELECT	max(backup_finish_date) 
			FROM	msdb.dbo.backupset 
			WHERE	[type] = 'I' and 
					database_name = A.name) AS [LastDiffBackupDateTime],
		(	SELECT	max(backup_finish_date) 
			FROM	msdb.dbo.backupset 
			WHERE	[type] = 'L' and 
					database_name = A.name) AS [LastLogBackupDateTime],
		CONVERT(sysname,DATABASEPROPERTYEX(A.name, 'Updateability')) Updateability,
		CONVERT(sysname,DATABASEPROPERTYEX(A.name, 'UserAccess')) UserAccess
FROM 	master.dbo.sysdatabases A WITH(NOLOCK)
WHERE 	A.name NOT IN ('tempdb')
GROUP BY A.dbid, A.name
ORDER BY A.name</pre></td></tr></table></div>

<p>Policy Based Management is also a great way to alert you on databases that do not have an appropriate backup configuration but if you&#8217;re not quite &#8220;there&#8221; yet this is a good place to start until you bridge that gap.</p>
<p><strong> </strong><br />
Here is a quick description of each Recovery Mode&#8217;s backup capabilities:</p>
<p><strong>Simple Recovery Mode</strong></p>
<ul>
<li>Full Backups &#8211; Yes</li>
<li>Differential Backups &#8211; Yes</li>
<li>Transaction Log Backups are NOT available because transactions are truncated from the transaction log usually after each checkpoint</li>
</ul>
<p><strong>Bulk-Logged Recovery Mode</strong></p>
<ul>
<li>Full Backups &#8211; Yes</li>
<li>Differential Backups &#8211; Yes</li>
<li>Transaction Log Backups &#8211; Yes (but Bulk Operations like BCP, Bulk Insert, etc are minimally logged)</li>
</ul>
<p><strong>Full Recovery Mode</strong></p>
<ul>
<li>Full Backups &#8211; Yes</li>
<li>Differential Backups &#8211; Yes</li>
<li>Transaction Log Backups &#8211; Yes</li>
</ul>
<p> </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=I+am+not+the+first+DBA+to+take+up+this+cause%26%238230%3B+but+I+am+determined+to+be+the+last+http://tinyurl.com/m7r8up" 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/09/10/i-am-not-the-first-dba-to-take-up-this-cause-but-i-am-determined-to-be-the-last/&amp;title=I+am+not+the+first+DBA+to+take+up+this+cause%26%238230%3B+but+I+am+determined+to+be+the+last" 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/09/10/i-am-not-the-first-dba-to-take-up-this-cause-but-i-am-determined-to-be-the-last/&amp;title=I+am+not+the+first+DBA+to+take+up+this+cause%26%238230%3B+but+I+am+determined+to+be+the+last" 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/09/10/i-am-not-the-first-dba-to-take-up-this-cause-but-i-am-determined-to-be-the-last/&amp;title=I+am+not+the+first+DBA+to+take+up+this+cause%26%238230%3B+but+I+am+determined+to+be+the+last" 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/09/10/i-am-not-the-first-dba-to-take-up-this-cause-but-i-am-determined-to-be-the-last/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<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>
		<item>
		<title>SQL Server 2008  &#8211; Backup compression</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2008/11/25/sql-server-2008-backup-compression/</link>
		<comments>http://benchmarkitconsulting.com/colin-stasiuk/2008/11/25/sql-server-2008-backup-compression/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 15:02:08 +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[SQL Server]]></category>
		<category><![CDATA[Compression]]></category>
		<category><![CDATA[SQL 2008]]></category>

		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=102</guid>
		<description><![CDATA[Backup compression is something new to SQL Server in SQL 2008 and it&#8217;s something that products like SQL LiteSpeed will be quite interested. Using a sample database I ran the following scripts and listed the results below: DECLARE @StartDateTime DATETIME = GETDATE()BACKUP DATABASE &#60;&#60;DatabaseName&#62;&#62;&#160;&#160;TO DISK = &#39;D:\NotCompressed.bak&#39; WITH INIT, COPY_ONLYSELECT DATEDIFF(ms, @StartDateTime, GETDATE()) SET @StartDateTime [...]]]></description>
			<content:encoded><![CDATA[<p>Backup compression is something new to SQL Server in SQL 2008 and it&#8217;s something that products like SQL LiteSpeed will be quite interested.  Using a sample database I ran the following scripts and listed the results below:</p>
<p><code style="font-size: 12px;"><span style="color:black"><br /></span><span style="color:blue">DECLARE </span><span style="color:#434343">@StartDateTime </span><span style="color:blue">DATETIME = </span><span style="color:magenta">GETDATE</span><span style="color:gray">()<br /></span><span style="color:blue">BACKUP DATABASE </span><span style="color:gray">&lt;&lt;</span><span style="color:black">DatabaseName</span><span style="color:gray">&gt;&gt;&nbsp;&nbsp;</span><span style="color:blue">TO DISK = </span><span style="color:red">&#39;D:\NotCompressed.bak&#39; </span><span style="color:blue">WITH </span><span style="color:black">INIT</span><span style="color:gray">, </span><span style="color:black">COPY_ONLY<br /></span><span style="color:blue">SELECT </span><span style="color:magenta">DATEDIFF</span><span style="color:gray">(</span><span style="color:black">ms</span><span style="color:gray">, </span><span style="color:#434343">@StartDateTime</span><span style="color:gray">, </span><span style="color:magenta">GETDATE</span><span style="color:gray">()) </p>
<p></span><span style="color:blue">SET </span><span style="color:#434343">@StartDateTime </span><span style="color:blue">= </span><span style="color:magenta">GETDATE</span><span style="color:gray">()<br /></span><span style="color:blue">BACKUP DATABASE </span><span style="color:gray">&lt;&lt;</span><span style="color:black">DatabaseName</span><span style="color:gray">&gt;&gt;&nbsp;&nbsp;</span><span style="color:blue">TO DISK = </span><span style="color:red">&#39;D:\Compressed.bak&#39;&nbsp;&nbsp;</span><span style="color:blue">WITH </span><span style="color:black">INIT</span><span style="color:gray">, </span><span style="color:black">COPY_ONLY</span><span style="color:gray">, </span><span style="color:black">COMPRESSION<br /></span><span style="color:blue">SELECT </span><span style="color:magenta">DATEDIFF</span><span style="color:gray">(</span><span style="color:black">ms</span><span style="color:gray">, </span><span style="color:#434343">@StartDateTime</span><span style="color:gray">, </span><span style="color:magenta">GETDATE</span><span style="color:gray">())</span></code></p>
<p><strong>BACKUP SIZE (my sample db):</strong> 129 MB (uncompressed) vs. 35 MB (compressed).</p>
<p>Compression ratio varies depending on what type of data there is in the database (ie string data tend to compress better than other data).</p>
<p><strong>BACKUP EXECUTION TIME (my sample db):</strong> 8 seconds (uncompressed) vs. 4 seconds (compressed).</p>
<p>Keeping in mind that this is a small sample database but on a much larger scale these types of savings would be huge.</p>
<p><strong>RESTORE EXECUTION TIME (my sample db):</strong> 11 seconds (uncompressed) vs. 6 seconds (compressed).</p>
<p>This is the one that suprised me&#8230; I thought there would be more overhead with uncompressing the backup file that would cause the restore time to be longer but the only measure that I saw was that the CPU utilization was alot higher on the compressed backup.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=SQL+Server+2008++%26%238211%3B+Backup+compression+http://tinyurl.com/cvbo3y" 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/2008/11/25/sql-server-2008-backup-compression/&amp;title=SQL+Server+2008++%26%238211%3B+Backup+compression" 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/2008/11/25/sql-server-2008-backup-compression/&amp;title=SQL+Server+2008++%26%238211%3B+Backup+compression" 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/2008/11/25/sql-server-2008-backup-compression/&amp;title=SQL+Server+2008++%26%238211%3B+Backup+compression" 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/2008/11/25/sql-server-2008-backup-compression/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backup Types in SQL Server</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2008/11/13/backup-types-in-sql-server/</link>
		<comments>http://benchmarkitconsulting.com/colin-stasiuk/2008/11/13/backup-types-in-sql-server/#comments</comments>
		<pubDate>Thu, 13 Nov 2008 14:41:18 +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[SQL Server]]></category>

		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=85</guid>
		<description><![CDATA[This post may not be the most technical or advanced dicussion but I think it&#8217;s important that everyone knows what is available within SQL Server and the differences between them. Full Backup &#8211; This is like it sounds a full copy of the databases. Full backups take the most time to complete but they are [...]]]></description>
			<content:encoded><![CDATA[<p>This post may not be the most technical or advanced dicussion but I think it&#8217;s important that everyone knows what is available within SQL Server and the differences between them.</p>
<p><strong>Full Backup</strong> &#8211; This is like it sounds a full copy of the databases. Full backups take the most time to complete but they are also the easiest form of backup to recover from. A full backup is required before you can do any other type of backup. If you run full backups once daily in the case of failure your potential data loss is ~ 24 hours (depending on time of failure).</p>
<p><strong>Differential Backup</strong> &#8211; This is a backup of everything that has happened in your database since the last full backup. Differential backups are smaller and faster then a full backup but in order to recovery from a differential backup you need to restore the full backup first and then the differential backup. If you run differential backups every 6 hours your potential data loss is ~ 6 hours (depending on time of failure).</p>
<p><strong>Transaction Log Backup</strong> &#8211; This is a backup of everything that has occured since the last full or differential backup or since the last transaction log backup.  Transaction log backups are usually very small and very fast to complete but the recovery time required to restore from a transaction log backup is longer then the other backup types.  In case of failure you would need to restore your full backup, any differential backups (if applicable), and then every transaction log taken since the last full (or differential backup). If you run transaction log backups every 15 minutes your potential data loss is ~ 15 minutes (depending on time of failure).</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Backup+Types+in+SQL+Server+http://tinyurl.com/dfo87f" 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/2008/11/13/backup-types-in-sql-server/&amp;title=Backup+Types+in+SQL+Server" 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/2008/11/13/backup-types-in-sql-server/&amp;title=Backup+Types+in+SQL+Server" 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/2008/11/13/backup-types-in-sql-server/&amp;title=Backup+Types+in+SQL+Server" 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/2008/11/13/backup-types-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transaction Log Backups &#8211; Doublecheck Script</title>
		<link>http://benchmarkitconsulting.com/colin-stasiuk/2008/11/04/transaction-log-backups-doublecheck-script/</link>
		<comments>http://benchmarkitconsulting.com/colin-stasiuk/2008/11/04/transaction-log-backups-doublecheck-script/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 23:34:07 +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[SQL Server]]></category>
		<category><![CDATA[Transaction Log]]></category>

		<guid isPermaLink="false">http://benchmarkitconsulting.com/?p=31</guid>
		<description><![CDATA[Have you ever wanted a quick way to check that all of your databases that are either in FULL or BULK_LOGGED recovery mode have transaction log backups setup? The script below is a nice safety net to ensure that all of your non-simple recovery mode databases have transaction log backups setup. Bottom line&#8230; if you [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever wanted a quick way to check that all of your databases that are either in FULL or BULK_LOGGED recovery mode have transaction log backups setup? The script below is a nice safety net to ensure that all of your non-simple recovery mode databases have transaction log backups setup.</p>
<p>Bottom line&#8230; if you have a database that has it&#8217;s recovery mode set to BULK_LOGGED or FULL recovery mode you should be backing up your transaction log periodically.</p>
<p>Enjoy</p>
<p><code style="font-size: 12px;"><span style="color: #0000ff;">DECLARE </span><span style="color: #434343;">@num_of_days </span><span style="color: #0000ff;">INT</p>
<p>SET </span><span style="color: #434343;">@num_of_days </span><span style="color: #0000ff;">= </span><span style="color: #000000;">1<span style="color:black"> </p>
<p></span></span></code></p>
<p><span style="color: #0000ff;">CREATE TABLE </span><span style="color: #434343;">#DatabaseListNotSimple </span><span style="color: #808080;">(</span><span style="color: #000000;">dbid </span><span style="color: #0000ff;">INT </span><span style="color: #434343;">IDENTITY</span><span style="color: #808080;">(</span><span style="color: #000000;">1</span><span style="color: #808080;">,</span><span style="color: #000000;">1</span><span style="color: #808080;">), </span><span style="color: #000000;">DatabaseName </span><span style="color: #0000ff;">VARCHAR</span><span style="color: #808080;">(</span><span style="color: #000000;">50</span><span style="color: #808080;">))<span style="color:gray"> </p>
<p></span></span></p>
<p><span style="color: #0000ff;">INSERT INTO </span><span style="color: #434343;">#DatabaseListNotSimple</p>
<p></span><span style="color: #0000ff;">SELECT </span><span style="color: #000000;">name </span><span style="color: #0000ff;">AS </span><span style="color: #ff0000;">&#8216;DatabaseName&#8217;</p>
<p></span><span style="color: #0000ff;">FROM </span><span style="color: #000000;">MASTER.dbo.sysdatabases </span><span style="color: #0000ff;">WITH</span><span style="color: #808080;">(</span><span style="color: #000000;">NOLOCK</span><span style="color: #808080;">)</p>
<p></span><span style="color: #0000ff;">WHERE </span><span style="color: #808080;">(</span><span style="color: #ff00ff;">CONVERT</span><span style="color: #808080;">(</span><span style="color: #0000ff;">VARCHAR</span><span style="color: #808080;">(</span><span style="color: #000000;">50</span><span style="color: #808080;">),</span><span style="color: #ff00ff;">DATABASEPROPERTYEX</span><span style="color: #808080;">(</span><span style="color: #000000;">name</span><span style="color: #808080;">,</span><span style="color: #ff0000;">&#8216;Recovery&#8217;</span><span style="color: #808080;">))</span><span style="color: #0000ff;">= </span><span style="color: #ff0000;">&#8216;FULL&#8217; </span><span style="color: #808080;">OR</p>
<p></span><span style="color: #ff00ff;">CONVERT</span><span style="color: #808080;">(</span><span style="color: #0000ff;">VARCHAR</span><span style="color: #808080;">(</span><span style="color: #000000;">50</span><span style="color: #808080;">),</span><span style="color: #ff00ff;">DATABASEPROPERTYEX</span><span style="color: #808080;">(</span><span style="color: #000000;">name</span><span style="color: #808080;">,</span><span style="color: #ff0000;">&#8216;Recovery&#8217;</span><span style="color: #808080;">))</span><span style="color: #0000ff;">= </span><span style="color: #ff0000;">&#8216;BULK_LOGGED&#8217;</span><span style="color: #808080;">) AND</p>
<p></span><span style="color: #000000;">name </span><span style="color: #808080;">&lt;&gt; </span><span style="color: #ff0000;">&#8216;model&#8217;<span style="color:red"> </p>
<p></span></span></p>
<p><span style="color: #0000ff;">SELECT </span><span style="color: #000000;">A.DatabaseName</span><span style="color: #808080;">, </span><span style="color: #0000ff;">MAX</span><span style="color: #808080;">(</span><span style="color: #000000;">B.backup_finish_date</span><span style="color: #808080;">) </span><span style="color: #0000ff;">AS </span><span style="color: #ff0000;">&#8216;LastLogBackupDateTime&#8217;</p>
<p></span><span style="color: #0000ff;">FROM </span><span style="color: #434343;">#DatabaseListNotSimple </span><span style="color: #000000;">A </span><span style="color: #ff00ff;">LEFT </span><span style="color: #808080;">OUTER </span><span style="color: #0000ff;">JOIN</p>
<p></span><span style="color: #000000;">msdb.dbo.backupset B </span><span style="color: #0000ff;">WITH</span><span style="color: #808080;">(</span><span style="color: #000000;">NOLOCK</span><span style="color: #808080;">) </span><span style="color: #0000ff;">ON </span><span style="color: #000000;">A.DatabaseName </span><span style="color: #0000ff;">= </span><span style="color: #000000;">B.database_name</p>
<p></span><span style="color: #0000ff;">WHERE </span><span style="color: #808080;">(</span><span style="color: #000000;">B.TYPE </span><span style="color: #0000ff;">= </span><span style="color: #ff0000;">&#8216;L&#8217; </span><span style="color: #808080;">OR </span><span style="color: #000000;">B.TYPE </span><span style="color: #0000ff;">IS </span><span style="color: #808080;">NULL)</p>
<p></span><span style="color: #0000ff;">GROUP BY </span><span style="color: #000000;">A.DatabaseName</p>
<p></span><span style="color: #0000ff;">HAVING </span><span style="color: #808080;">(</span><span style="color: #0000ff;">MAX</span><span style="color: #808080;">(</span><span style="color: #000000;">B.backup_finish_date</span><span style="color: #808080;">) &lt; </span><span style="color: #ff00ff;">GETDATE</span><span style="color: #808080;">() - </span><span style="color: #434343;">@num_of_days </span><span style="color: #808080;">OR</p>
<p></span><span style="color: #0000ff;">MAX</span><span style="color: #808080;">(</span><span style="color: #000000;">B.backup_finish_date</span><span style="color: #808080;">) </span><span style="color: #0000ff;">IS </span><span style="color: #808080;">NULL)<code style="font-size: 12px;"><span style="color:gray"> </p>
<p></span><span style="color: #0000ff;">DROP TABLE </span><span style="color: #434343;">#DatabaseListNotSimple</p>
<p></span><span style="color: #000000;">GO</p>
<p></span></code></span></p>
<p><span style="color: #0000ff;">DROP TABLE </span><span style="color: #434343;">#DatabaseListNotSimple</p>
<p></span><span style="color: #000000;">GO</p>
<p></span></p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Transaction+Log+Backups+%26%238211%3B+Doublecheck+Script+http://tinyurl.com/bvgp6p" 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/2008/11/04/transaction-log-backups-doublecheck-script/&amp;title=Transaction+Log+Backups+%26%238211%3B+Doublecheck+Script" 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/2008/11/04/transaction-log-backups-doublecheck-script/&amp;title=Transaction+Log+Backups+%26%238211%3B+Doublecheck+Script" 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/2008/11/04/transaction-log-backups-doublecheck-script/&amp;title=Transaction+Log+Backups+%26%238211%3B+Doublecheck+Script" 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/2008/11/04/transaction-log-backups-doublecheck-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

