<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>SQL Server Journey with SQL Authority &#187; SQL Backup and Restore</title>
	<atom:link href="http://blog.sqlauthority.com/category/sql-backup-and-restore/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Wed, 08 Feb 2012 17:24:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.sqlauthority.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/08e35387c05b61340e885b1763a69d9f?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>SQL Server Journey with SQL Authority &#187; SQL Backup and Restore</title>
		<link>http://blog.sqlauthority.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.sqlauthority.com/osd.xml" title="SQL Server Journey with SQL Authority" />
	<atom:link rel='hub' href='http://blog.sqlauthority.com/?pushpress=hub'/>
		<item>
		<title>SQL SERVER &#8211; Effect of Compressed Backup Setting at Server Level on Database Backup</title>
		<link>http://blog.sqlauthority.com/2011/12/28/sql-server-effect-of-compressed-backup-setting-at-server-level-on-database-backup/</link>
		<comments>http://blog.sqlauthority.com/2011/12/28/sql-server-effect-of-compressed-backup-setting-at-server-level-on-database-backup/#comments</comments>
		<pubDate>Wed, 28 Dec 2011 01:30:42 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[PostADay]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16490</guid>
		<description><![CDATA[I recently received following question from reader. I would like to share the complete story in few short sentences with you to give you complete idea. Let us call the reader Margie. Our long email conversation is converted into chat like conversation Margie: Hi Pinal &#8211; I am seeing strange behavior with regards to my [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=16490&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I recently received following question from reader. I would like to share the complete story in few short sentences with you to give you complete idea. Let us call the reader Margie. Our long email conversation is converted into chat like conversation</p>
<p style="text-align:justify;"><strong>Margie:</strong> Hi Pinal &#8211; I am seeing strange behavior with regards to my database backup.<br />
<strong>Pinal:</strong> What is the exact issue?<br />
<strong>Margie:</strong> I am taking database backup with following script for more than an year and my database is of always certain size. From last six days the size of the database backup is reduced big times. There is absolutely no change in the T-SQL code. It has been the same and part of the backup job for ever.</p>
<p><code style="font-size:12px;"><span style="color:blue;">BACKUP DATABASE </span><span style="color:black;">[AdventureWorks] </span><span style="color:blue;">TO DISK = </span><span style="color:red;">N'D:\Backup\ad2'<br />
</span><span style="color:black;">GO<br />
</span></code></p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/ad1ad2.jpg" alt="" width="459" height="78" /></p>
<p style="text-align:justify;"><strong>Pinal:</strong> Have you deleted any data from your database or moved data to different file-group which is not backed up?<br />
<strong>Margie:</strong> No. It is same. The amount of the data is ever increasing.<br />
<strong>Pinal:</strong> Have you restored the database back and checked the .MDF and .LDF file size?<br />
<strong>Margie:</strong> Well, I tried it now, it is the same.<br />
<strong>Pinal:</strong> Have you enabled database compression?<br />
<strong>Margie:</strong> No, I have already mentioned that I have not changed T-SQL code from ages.<br />
<strong>Pinal:</strong> Have you touched server level settings for compression?<br />
<strong>Margie:</strong> What is that?<br />
<strong>Pinal:</strong> Ahha&#8230; Gotcha!</p>
<p style="text-align:justify;">Well, after a quick research we figured out what was changed in the server. Their new Admin has changed following settings on the server level, which resulted in the compressed backup.</p>
<p style="text-align:justify;">Their new Admin had read my following articles.</p>
<ul style="text-align:justify;">
<li><strong><a href="http://blog.sqlauthority.com/2008/07/03/sql-server-2008-introduction-to-new-feature-of-backup-compression/" target="_blank">Introduction to New Feature of Backup Compression</a></strong></li>
<li><strong><a href="http://blog.sqlauthority.com/2010/03/01/sql-server-data-and-page-compressions-data-storage-and-io-improvement/" target="_blank">Data and Page Compressions – Data Storage and IO Improvement</a></strong></li>
</ul>
<p style="text-align:justify;">After reading the articles, he checked all the backup settings and realize that there is no database backup configured. After running necessary checks, he decided that compressed backup is the recommended option for all the databases. As it would take time to identify and figure out all the place where the backup code is used and enable compression, he went ahead and configured the server level settings for backup compression. This resulted that all the backup on the server without any T-SQL backup code change were compressed backup. As he had not communicated this with Margie, she was confused with situation.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/serverbackupsetting.jpg" alt="" width="500" height="448" /></p>
<p style="text-align:justify;">Well, there are two learning we all adopt from this scenario.</p>
<ul style="text-align:justify;">
<li>Server level backup compression settings affect all the default backup database scripts</li>
<li>Database Admin should communicate all of their changes to relevant team member and proper documentations should be done</li>
<li><em><strong>Bonus Learning:</strong></em> Ask around!</li>
</ul>
<p style="text-align:justify;">Reference: <strong>Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.sqlauthority.com</a>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/technology/postaday/'>PostADay</a>, <a href='http://blog.sqlauthority.com/category/readers-question/'>Readers Question</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/16490/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/16490/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/16490/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/16490/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/16490/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/16490/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/16490/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/16490/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/16490/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/16490/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/16490/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/16490/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/16490/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/16490/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=16490&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2011/12/28/sql-server-effect-of-compressed-backup-setting-at-server-level-on-database-backup/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/ad1ad2.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/serverbackupsetting.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Target Recovery Time of a Database &#8211; Advance Option in SQL Server 2012</title>
		<link>http://blog.sqlauthority.com/2011/12/27/sql-server-target-recovery-time-of-a-database-advance-option-in-sql-server-2012/</link>
		<comments>http://blog.sqlauthority.com/2011/12/27/sql-server-target-recovery-time-of-a-database-advance-option-in-sql-server-2012/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 01:30:11 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[PostADay]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Function]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16449</guid>
		<description><![CDATA[Recently I was going over few advanced options of SQL Server 2012 in database properties and I found a new option in the property screen. Properties screen of SQL Server 2008 R2 Properties screen of SQL Server 2012 I got little curious and decided to learn what does this new feature indicates. When I started [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=16449&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Recently I was going over few advanced options of SQL Server 2012 in database properties and I found a new option in the property screen.</p>
<h3 style="text-align:justify;">Properties screen of SQL Server 2008 R2</h3>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/targetrecovery2008.jpg" alt="" width="500" height="505" /></p>
<h3 style="text-align:justify;">Properties screen of SQL Server 2012</h3>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/targetrecovery2012.jpg" alt="" width="500" height="504" /></p>
<p style="text-align:justify;">I got little curious and decided to learn what does this new feature indicates. When I started to learn more about this subject, I had excellent learning experience.</p>
<p style="text-align:justify;">The default value of this option is 0. This value is directly related to Checkpoint. When it is set to greater than 0 (zero) it uses indirect-checkpoints and establishes an upper-bound on recovery time for this database.</p>
<p style="text-align:justify;"><em><strong>NOTE:</strong></em> Do not attempt this right away on your production database. Make sure that you try this out on your development server and validate before making it any changes on your production server. Make sure that you do not change this option unless you are 100% sure about what you are doing and understand the risk as well implications.</p>
<p style="text-align:justify;">Indirect Checkpoints are alternative to automatic checkpoints (which should be good for most of the system and should be left alone if you are not sure about implications). If system crashes accidentally, indirect checkpoints provides potentially faster recovery time than automatic checkpoints.</p>
<p style="text-align:justify;">Reasons for enabling indirect checkpoint</p>
<ul style="text-align:justify;">
<li>It may improve database recovery time</li>
<li>It may reduce checkpoint I/O as it writes continuously pages to the disk in the background</li>
</ul>
<p style="text-align:justify;">Reasons for NOT enabling indirect checkpoint</p>
<ul style="text-align:justify;">
<li>In OLTP workload it can increase overall writes on server by writing continuously pages to the disk in the background which may reduce the performance.</li>
</ul>
<p style="text-align:justify;">I have now learned the pros and cons of this feature and I am going to test this feature out on various workload oriented servers and see what is the effect of this feature. You can read further on <a href="http://msdn.microsoft.com/en-us/library/ms189573%28v=sql.110%29.aspx?WT.mc_id=aff-n-in-loc--pd" target="_blank">MSDN </a>about this feature.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.sqlauthority.com</a>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/technology/postaday/'>PostADay</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/sql-function/'>SQL Function</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/16449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/16449/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/16449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/16449/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/16449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/16449/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/16449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/16449/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/16449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/16449/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/16449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/16449/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/16449/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/16449/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=16449&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2011/12/27/sql-server-target-recovery-time-of-a-database-advance-option-in-sql-server-2012/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/targetrecovery2008.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/targetrecovery2012.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; A Quick Script for Point in Time Recovery &#8211; Back Up and Restore</title>
		<link>http://blog.sqlauthority.com/2011/12/23/sql-server-a-quick-script-for-point-in-time-recovery-back-up-and-restore/</link>
		<comments>http://blog.sqlauthority.com/2011/12/23/sql-server-a-quick-script-for-point-in-time-recovery-back-up-and-restore/#comments</comments>
		<pubDate>Fri, 23 Dec 2011 01:30:44 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[PostADay]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16413</guid>
		<description><![CDATA[Blogging is like writing a big novel in parts. It has its own mood and it has its own colors. Someday I feel like writing philosophy and some day I like writing theory and some day just a script. Today is one of the day when I just feel like providing working script for user [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=16413&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Blogging is like writing a big novel in parts. It has its own mood and it has its own colors. Someday I feel like writing philosophy and some day I like writing theory and some day just a script. Today is one of the day when I just feel like providing working script for user requested frequently. Here is one of the script which I refer whenever I faced situation about restoring the database at point in time.</p>
<p style="text-align:justify;">In this demo we will see three step operations:</p>
<ol style="text-align:justify;">
<li>Set up script and backup database</li>
<li>Restore the database in point in time</li>
<li>Clean up database</li>
</ol>
<p style="text-align:justify;">Let us see each step with simple script:</p>
<h2 style="text-align:justify;">1. Set up Script and backup database</h2>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">------------------------------------------------<br />
-- Creating environment<br />
------------------------------------------------<br />
-- Create Database<br />
</span><span style="color:blue;">CREATE DATABASE </span><span style="color:black;">SQLAuthority<br />
GO<br />
</span><span style="color:green;">-- Make sure database is in full recovery<br />
</span><span style="color:blue;">ALTER DATABASE </span><span style="color:black;">SQLAuthority<br />
</span><span style="color:blue;">SET </span><span style="color:black;">RECOVERY </span><span style="color:blue;">FULL<br />
</span><span style="color:black;">GO<br />
</span><span style="color:blue;">USE </span><span style="color:black;">SQLAuthority<br />
GO<br />
</span><span style="color:green;">-- Create Table<br />
</span><span style="color:blue;">CREATE TABLE </span><span style="color:black;">TestTable </span><span style="color:gray;">(</span><span style="color:black;">ID </span><span style="color:blue;">INT</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Taking full backup<br />
</span><span style="color:blue;">BACKUP DATABASE </span><span style="color:black;">[SQLAuthority]<br />
</span><span style="color:blue;">TO DISK = </span><span style="color:red;">N'D:\SQLAuthority.bak'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">TestTable </span><span style="color:gray;">(</span><span style="color:black;">ID</span><span style="color:gray;">)<br />
</span><span style="color:blue;">VALUES </span><span style="color:gray;">(</span><span style="color:black;">1</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Selecting the data from TestTable<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">TestTable<br />
GO<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">TestTable </span><span style="color:gray;">(</span><span style="color:black;">ID</span><span style="color:gray;">)<br />
</span><span style="color:blue;">VALUES </span><span style="color:gray;">(</span><span style="color:black;">2</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Taking log backup<br />
</span><span style="color:blue;">BACKUP </span><span style="color:magenta;">LOG </span><span style="color:black;">[SQLAuthority] </span><span style="color:blue;">TO<br />
DISK = </span><span style="color:red;">N'D:\SQLAuthority1.trn'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">TestTable </span><span style="color:gray;">(</span><span style="color:black;">ID</span><span style="color:gray;">)<br />
</span><span style="color:blue;">VALUES </span><span style="color:gray;">(</span><span style="color:black;">3</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">TestTable </span><span style="color:gray;">(</span><span style="color:black;">ID</span><span style="color:gray;">)<br />
</span><span style="color:blue;">VALUES </span><span style="color:gray;">(</span><span style="color:black;">4</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
</span><span style="color:blue;">BACKUP </span><span style="color:magenta;">LOG </span><span style="color:black;">[SQLAuthority] </span><span style="color:blue;">TO<br />
DISK = </span><span style="color:red;">N'D:\SQLAuthority2.trn'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Selecting the data from TestTable<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">TestTable<br />
GO<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">TestTable </span><span style="color:gray;">(</span><span style="color:black;">ID</span><span style="color:gray;">)<br />
</span><span style="color:blue;">VALUES </span><span style="color:gray;">(</span><span style="color:black;">5</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Selecting the data from TestTable<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">TestTable<br />
GO<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">TestTable </span><span style="color:gray;">(</span><span style="color:black;">ID</span><span style="color:gray;">)<br />
</span><span style="color:blue;">VALUES </span><span style="color:gray;">(</span><span style="color:black;">6</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Selecting the data from TestTable<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">TestTable<br />
GO<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">TestTable </span><span style="color:gray;">(</span><span style="color:black;">ID</span><span style="color:gray;">)<br />
</span><span style="color:blue;">VALUES </span><span style="color:gray;">(</span><span style="color:black;">7</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Selecting the data from TestTable<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">TestTable<br />
GO<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">TestTable </span><span style="color:gray;">(</span><span style="color:black;">ID</span><span style="color:gray;">)<br />
</span><span style="color:blue;">VALUES </span><span style="color:gray;">(</span><span style="color:black;">8</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Marking Time Stamp<br />
</span><span style="color:blue;">SELECT </span><span style="color:magenta;">GETDATE</span><span style="color:gray;">() </span><span style="color:black;">BeforeTruncateTime</span><span style="color:gray;">;<br />
</span><span style="color:green;">-- Selecting the data from TestTable<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">TestTable<br />
GO<br />
</span><span style="color:green;">-- Quick Delay before Truncate<br />
</span><span style="color:blue;">WAITFOR </span><span style="color:black;">DELAY </span><span style="color:red;">'00:00:01'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:blue;">TRUNCATE TABLE </span><span style="color:black;">TestTable<br />
GO<br />
</span><span style="color:green;">-- Quick Delay after Truncate<br />
</span><span style="color:blue;">WAITFOR </span><span style="color:black;">DELAY </span><span style="color:red;">'00:00:01'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Marking Time Stamp<br />
</span><span style="color:blue;">SELECT </span><span style="color:magenta;">GETDATE</span><span style="color:gray;">() </span><span style="color:black;">AfterTruncateTime</span><span style="color:gray;">;<br />
</span><span style="color:green;">-- Selecting the data from TestTable<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">TestTable<br />
GO<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">TestTable </span><span style="color:gray;">(</span><span style="color:black;">ID</span><span style="color:gray;">)<br />
</span><span style="color:blue;">VALUES </span><span style="color:gray;">(</span><span style="color:black;">9</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Taking log backup<br />
</span><span style="color:blue;">BACKUP </span><span style="color:magenta;">LOG </span><span style="color:black;">[SQLAuthority] </span><span style="color:blue;">TO<br />
DISK = </span><span style="color:red;">N'D:\SQLAuthority3.trn'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Marking Time Stamp<br />
</span><span style="color:blue;">SELECT </span><span style="color:magenta;">GETDATE</span><span style="color:gray;">() </span><span style="color:black;">CurrentTime</span><span style="color:gray;">;<br />
</span><span style="color:green;">-- Selecting the data from TestTable<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">TestTable<br />
GO<br />
</span><span style="color:blue;">USE MASTER<br />
</span><span style="color:black;">GO<br />
</span></code></p>
<h2 style="text-align:justify;">2. Restore the database in point in time</h2>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">-----------------------------------------------<br />
-- Restoring Database<br />
------------------------------------------------<br />
</span><span style="color:blue;">USE </span><span style="color:black;">[master]<br />
GO<br />
</span><span style="color:green;">-- Taking tail log<br />
</span><span style="color:blue;">BACKUP </span><span style="color:magenta;">LOG </span><span style="color:black;">[SQLAuthority] </span><span style="color:blue;">TO<br />
DISK = </span><span style="color:red;">N'D:\SQLAuthority5.trn'<br />
</span><span style="color:blue;">WITH </span><span style="color:black;">NORECOVERY<br />
GO<br />
</span><span style="color:green;">-- Restore full backup<br />
</span><span style="color:blue;">RESTORE DATABASE </span><span style="color:black;">[SQLAuthority]<br />
</span><span style="color:blue;">FROM DISK = </span><span style="color:red;">N'D:\SQLAuthority.bak'<br />
</span><span style="color:blue;">WITH<br />
</span><span style="color:black;">STANDBY </span><span style="color:blue;">= </span><span style="color:red;">N'D:\SQLAuthority11.bak'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Restore transaction backup<br />
</span><span style="color:blue;">RESTORE </span><span style="color:magenta;">LOG </span><span style="color:black;">[SQLAuthority]<br />
</span><span style="color:blue;">FROM DISK = </span><span style="color:red;">N'D:\SQLAuthority1.trn'<br />
</span><span style="color:blue;">WITH </span><span style="color:black;">STANDBY </span><span style="color:blue;">= </span><span style="color:red;">N'D:\SQLAuthority11.trn'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Selecting the data from TestTable<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">SQLAuthority.dbo.TestTable<br />
GO<br />
</span><span style="color:green;">-- Restore transaction backup<br />
</span><span style="color:blue;">RESTORE </span><span style="color:magenta;">LOG </span><span style="color:black;">[SQLAuthority]<br />
</span><span style="color:blue;">FROM DISK = </span><span style="color:red;">N'D:\SQLAuthority2.trn'<br />
</span><span style="color:blue;">WITH </span><span style="color:black;">STANDBY </span><span style="color:blue;">= </span><span style="color:red;">N'D:\SQLAuthority21.trn'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Selecting the data from TestTable<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">SQLAuthority.dbo.TestTable<br />
GO<br />
</span><span style="color:green;">-- Restore transaction backup<br />
</span><span style="color:blue;">RESTORE </span><span style="color:magenta;">LOG </span><span style="color:black;">[SQLAuthority]<br />
</span><span style="color:blue;">FROM DISK = </span><span style="color:red;">N'D:\SQLAuthority3.trn'<br />
</span><span style="color:blue;">WITH </span><span style="color:black;">STOPAT </span><span style="color:blue;">= </span><span style="color:red;">'2011-12-21 11:12:18.797'</span><span style="color:gray;">, </span><span style="color:green;">-- Insert Your Time<br />
</span><span style="color:black;">STANDBY </span><span style="color:blue;">= </span><span style="color:red;">N'D:\SQLAuthority33.trn'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Rolling database forward<br />
</span><span style="color:blue;">RESTORE </span><span style="color:magenta;">LOG </span><span style="color:black;">[SQLAuthority]<br />
</span><span style="color:blue;">WITH </span><span style="color:black;">RECOVERY<br />
GO<br />
</span><span style="color:green;">-- Selecting the data from TestTable<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">*<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">SQLAuthority.dbo.TestTable<br />
GO<br />
</span></code></p>
<h2 style="text-align:justify;">3. Clean up database</h2>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">------------------------------------------------<br />
-- Clean up<br />
------------------------------------------------<br />
</span><span style="color:blue;">USE MASTER<br />
</span><span style="color:black;">GO<br />
</span><span style="color:blue;">ALTER DATABASE </span><span style="color:black;">[SQLAuthority]<br />
</span><span style="color:blue;">SET </span><span style="color:black;">SINGLE_USER </span><span style="color:blue;">WITH ROLLBACK IMMEDIATE<br />
</span><span style="color:black;">GO<br />
</span><span style="color:blue;">DROP DATABASE </span><span style="color:black;">[SQLAuthority]<br />
GO</span></code></p>
<p style="text-align:justify;">Few quick points to note: Database has to be either in full recovery or bulk recovery mode. While restoring the database it should be done either WITH NORECOVERY (Leave the database non-operational, and do not roll back the uncommitted transactions. Additional transaction logs can be restored) or WITH STANDBY (Leave the database in read-only mode. Undo uncommitted transactions, but save the undo actions in a standby file so that recovery effects can be reverted).</p>
<p style="text-align:justify;">Lots of scripts today but if you are in need of Point in Time Recovery script, this script is for you. I am open for suggestion, enhancements etc. Let me know your comments.</p>
<p style="text-align:justify;">Reference: <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/technology/postaday/'>PostADay</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/sqlserver/'>SQLServer</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/16413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/16413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/16413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/16413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/16413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/16413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/16413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/16413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/16413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/16413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/16413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/16413/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/16413/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/16413/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=16413&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2011/12/23/sql-server-a-quick-script-for-point-in-time-recovery-back-up-and-restore/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; FIX &#8211; ERROR : Msg 3201, Level 16 Cannot open backup device.Operating system error 3 (The system cannot find the path specified.)</title>
		<link>http://blog.sqlauthority.com/2011/12/17/sql-server-fix-error-msg-3201-level-16-cannot-open-backup-device-operating-system-error-3-the-system-cannot-find-the-path-specified/</link>
		<comments>http://blog.sqlauthority.com/2011/12/17/sql-server-fix-error-msg-3201-level-16-cannot-open-backup-device-operating-system-error-3-the-system-cannot-find-the-path-specified/#comments</comments>
		<pubDate>Sat, 17 Dec 2011 01:30:31 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[PostADay]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Error Messages]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Management Studio]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=16367</guid>
		<description><![CDATA[I had very interesting and frustrating experience. Recently I was attempting to backup one of my database and I end up on following error. Msg 3201, Level 16, State 1, Line 1 Cannot open backup device &#8216;D:\Backup\SQLAuthority.bak&#8217;. Operating system error 3(The system cannot find the path specified.). Msg 3013, Level 16, State 1, Line 1 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=16367&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I had very interesting and frustrating experience. Recently I was attempting to backup one of my database and I end up on following error.</p>
<p style="text-align:justify;"><span style="color:#ff0000;">Msg 3201, Level 16, State 1, Line 1</span><br />
<span style="color:#ff0000;"> Cannot open backup device &#8216;D:\Backup\SQLAuthority.bak&#8217;. Operating system error 3(The system cannot find the path specified.).</span><br />
<span style="color:#ff0000;"> Msg 3013, Level 16, State 1, Line 1</span><br />
<span style="color:#ff0000;"> BACKUP DATABASE is terminating abnormally.</span></p>
<p style="text-align:justify;"><strong>Solution:</strong></p>
<p style="text-align:justify;">Go to your drive and create the missing folder. In my case I went to Drive <strong>D</strong> and created <strong>Backup</strong> Folder there.</p>
<p style="text-align:justify;"><strong>Additional Story:</strong></p>
<p style="text-align:justify;"><img class="alignleft" src="http://www.pinaldave.com/bimg/backup-database.png" alt="" width="150" /></p>
<p style="text-align:justify;">If you read the first line of the blog post you will read there that I mentioned that I had frustrating experience. It was not frustrating that I do not know the solution &#8211; it was totally different reason. When I encountered the above error I quickly went and created the folder in my machine. Once I created the folder, I still keep on getting the error. After a while I realize what I was doing. I was creating the folder in the machine where I had installed SQL Server Management Studio. To resolve this error one has to create the folder in the machine where SQL Server is installed. Once I created the folder to the location where I was attempting to take backup the issue was resolved.</p>
<p style="text-align:justify;">How many of you have been in the same situation as me as mentioned in additional story?</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.sqlauthority.com</a>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/technology/postaday/'>PostADay</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/sql-error-messages/'>SQL Error Messages</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/sql-server-management-studio/'>SQL Server Management Studio</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/16367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/16367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/16367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/16367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/16367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/16367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/16367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/16367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/16367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/16367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/16367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/16367/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/16367/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/16367/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=16367&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2011/12/17/sql-server-fix-error-msg-3201-level-16-cannot-open-backup-device-operating-system-error-3-the-system-cannot-find-the-path-specified/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/backup-database.png" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; SQL Backup and FTP &#8211; A Quick and Handy Tool</title>
		<link>http://blog.sqlauthority.com/2011/10/03/sql-server-sql-backup-and-ftp-a-quick-and-handy-tool/</link>
		<comments>http://blog.sqlauthority.com/2011/10/03/sql-server-sql-backup-and-ftp-a-quick-and-handy-tool/#comments</comments>
		<pubDate>Mon, 03 Oct 2011 01:30:18 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[PostADay]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Documentation]]></category>
		<category><![CDATA[SQL Download]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Utility]]></category>
		<category><![CDATA[SQLAuthority News]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=14763</guid>
		<description><![CDATA[Scroll down at the end of this post to win my SQL Wait Stats Book. I have used this tool extensively since 2009 at numerous occasion and found it to be very impressive. What separates it from the crowd the most &#8211; it is it’s apparent simplicity and speed. When I install SQLBackupAndFTP and configure [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=14763&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;"><strong>Scroll down at the end of this post to win my <a href="http://bit.ly/waitstats" target="_blank">SQL Wait Stats Book</a>.</strong></p>
<p style="text-align:justify;">I have used this tool extensively since 2009 at numerous occasion and found it to be very impressive. What separates it from the crowd the most &#8211; it is it’s apparent simplicity and speed. When I install <strong><a href="http://sqlbackupandftp.com/" target="_blank">SQLBackupAndFTP</a></strong> and configure backups &#8211; all in 1 or 2 minutes, my clients are always impressed.</p>
<p style="text-align:justify;">To put it simply, SQLBackupAndFTP is MS SQL Server backup software that performs these tasks:</p>
<ul style="text-align:justify;">
<li>Backup SQL Server Database</li>
<li>Zip the backups</li>
<li>Encrypt the backups</li>
<li>FTP the backups to remote FTP server</li>
<li>Move file to local area network</li>
<li>Send final status of tasks in email.</li>
<li>Allows to monitor the history of jobs through the web</li>
</ul>
<p style="text-align:justify;">SQLBackupAndFTP comes in Free and Paid versions (starting from $29) &#8211; see this <strong><a href="http://sqlbackupandftp.com/features/" target="_blank">version comparison</a></strong> chart, but even Free version is fully functional for unlimited ad hoc backups or for scheduled backups of up to two databases &#8211; it will be sufficient for many small customers.</p>
<p style="text-align:justify;">But enough theory, let us now see how we can take backup and move it to the desired folder.</p>
<p style="text-align:justify;"><strong>Image 1:</strong> You start from the main form and  all the settings are very easy as described in the following image. From database selection to job scheduling, you can configure everything on one screen.</p>
<p style="text-align:justify;">On this form you would usually do the following:</p>
<ol style="text-align:justify;">
<li>Press “Connect to SQL Server” button to connect to your SQL Server instance</li>
<li>Check databases in the list to select databases to backup</li>
<li>If you need to store backups in a Local/Network folder &#8211; fill out the path to this folder</li>
<li>If you need to send backups to FTP &#8211; fill out your FTP server settings</li>
<li>Enter you email to receive job notification e-mails</li>
<li>Fill out the time when a scheduled daily backup job should run</li>
<li>Press “Run Now” button to test your backups</li>
</ol>
<p style="text-align:justify;">Note that the above covers just the basic scenario when you need full backups once a day. If you need Differential or Transaction Log backups or a schedule more complicated than once per day &#8211; press “Advanced Schedule”.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/sqlbnf/image001.png" alt="" width="500" /></p>
<p style="text-align:justify;"><strong>Image 2:</strong> Advanced Backup Schedule. Again, what I love about this program &#8211; it is how simply it allows you to resolve even quite complicated tasks. Your can click the sample scenario link that matches you needs the most &#8211; like “Daily 4 times” and everything is set &#8211; you’ll get one full and 3 Differential backups per day. Or select any other scenario that suits you.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/sqlbnf/image003.png" alt="" width="500" /></p>
<p style="text-align:justify;"><strong>Image 3:</strong> Advanced Settings screen is optional and allows you set encryption, compression levels, backup file name, temporary folders, if you want to use web logs (more about it below) and more</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/sqlbnf/image005.png" alt="" width="500" /></p>
<p style="text-align:justify;"><strong>Image 4:</strong> If you checked “Use web log” in Advanced Settings, the log of your jobs is being saved on the web on sqlbackupandftp.com site (see <strong><a href="http://sqlbackupandftp.com/weblog/demo" target="_blank">weblog demo</a></strong>) and you can see the history of these jobs (even collected from multiple servers) in a single page &#8211; very interesting feature that can be very handy for large organizations</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/sqlbnf/image007.png" alt="" width="500" /></p>
<p style="text-align:justify;">A detailed configuration tutorial is available <strong><a href="http://sqlbackupandftp.com/tutorial/" target="_blank">here</a></strong> if you are interested.</p>
<p style="text-align:justify;">Now, a question that might baffle your mind is – how this tool is better than maintenance tasks available in SQL Server. Well, here goes the answer. Maintenance tasks are easy to set up for backups; however, SQLBackupAndFTP have integrated solution for encryption, FTP and email which make it superior to maintenance tasks in every aspect.</p>
<p style="text-align:justify;">I would like to present my unbiased view about this tool. At the same time, I want to give my readers a broad perspective about backup tools in general.  On comparing this tool with other backup tools I have experienced that it is not the fanciest tool to manage backups or check their health. This is one tool that smoothly performs the job in a very few steps compared to native SQL Server backup, which takes numerous steps to execute the similar job.</p>
<p style="text-align:justify;"><strong>Image 5:</strong> Along with SQLBackupAndFTP setup gives you the option to install “One-Click SQL Restore” (you can install it stand-alone too) &#8211; a basic tool for restoring just Full backups.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/sqlbnf/image009.png" alt="" width="500" /></p>
<p style="text-align:justify;">However basic, you can drag-and-drop on it the zip file created by SQLBackupAndFTP, it unzips the BAK file if necessary, connects to the SQL server on the start, selects the right database, it is smart enough to restart the server to drop open connections if necessary &#8211; very handy for developers who need to restore databases often.</p>
<p style="text-align:justify;">While testing <strong><a href="http://sqlbackupandftp.com/" target="_blank">SQLBackupAndFTP</a></strong> I noticed some limitations. It only works reliably on local SQL Server instances. In other words it has to be installed on the SQL server itself. For remote servers it uses scripting which is less reliable. This limitations is actually inherent in SQL server itself as BACKUP DATABASE command  creates backup not on the client, but on the server itself.</p>
<p style="text-align:justify;">This tool is compatible with almost all the known SQL Server versions. It works with SQL Server 2008 (all versions) and many of the previous versions. It is especially useful for SQL Server Express 2005 and SQL Server Express 2008, as they lack built in tools for backup.</p>
<p style="text-align:justify;"><strong><a href="http://sqlbackupandftp.com/" target="_blank">SQLBackupAndFTP</a></strong> is rapidly evolving since I first started using it two years ago. I spoke to developers and it seems that their immediate goal is to include cloud storage support &#8211; users will be able to backup directly to Microsoft SkyDrive, Amazon S3, DropBox, Box.net and others &#8211; very exciting development.</p>
<p style="text-align:justify;">I strongly recommend this tool to all the DBAs. They must absolutely try it as it is free and does exactly what it promises. You can <strong><a href="http://sqlbackupandftp.com/download/SqlBakSetup.exe" target="_blank">download your free copy</a></strong> of the tool from here.</p>
<p style="text-align:justify;">Please share your experience about using this tool. I am eager to receive your feedback regarding this article. I will also give print book of my <strong><a href="http://amzn.to/p3tL1n" target="_blank">SQL Server Wait Stats</a></strong> book to two individual who share their feedback about this product. The book will be sent to any country where Amazon delivers the book.</p>
<p style="text-align:justify;">Reference: <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/technology/postaday/'>PostADay</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/sql-documentation/'>SQL Documentation</a>, <a href='http://blog.sqlauthority.com/category/sql-download/'>SQL Download</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/sql-utility/'>SQL Utility</a>, <a href='http://blog.sqlauthority.com/category/sqlauthority/sqlauthority-news/'>SQLAuthority News</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/14763/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/14763/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/14763/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/14763/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/14763/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/14763/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/14763/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/14763/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/14763/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/14763/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/14763/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/14763/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/14763/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/14763/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=14763&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2011/10/03/sql-server-sql-backup-and-ftp-a-quick-and-handy-tool/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/sqlbnf/image001.png" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/sqlbnf/image003.png" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/sqlbnf/image005.png" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/sqlbnf/image007.png" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/sqlbnf/image009.png" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Copy Database from Instance to Another Instance &#8211; Copy Paste in SQL Server</title>
		<link>http://blog.sqlauthority.com/2011/05/27/sql-server-copy-database-from-instance-to-another-instance-copy-paste-in-sql-server/</link>
		<comments>http://blog.sqlauthority.com/2011/05/27/sql-server-copy-database-from-instance-to-another-instance-copy-paste-in-sql-server/#comments</comments>
		<pubDate>Fri, 27 May 2011 01:30:45 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[PostADay]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Azure]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=13037</guid>
		<description><![CDATA[SQL Server has feature which copy database from one database to another database and it can be automated as well using SSIS. Make sure you have SQL Server Agent Turned on as this feature will create a job. The same job will execute the task. Make sure that SSIS is properly configured as well with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=13037&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">SQL Server has feature which copy database from one database to another database and it can be automated as well using SSIS.</p>
<p style="text-align:justify;">Make sure you have SQL Server Agent Turned on as this feature will create a job. The same job will execute the task. Make sure that SSIS is properly configured as well with necessary security permissions. You can automate this process as well control error logging.</p>
<p style="text-align:justify;">Following are the steps to copy database from one instance to another instance.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/copywizard1.jpg" alt="" width="496" height="546" /></p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/copywizard2.jpg" alt="" /><br />
Specify Source Server<br />
<img class="alignnone" src="http://www.pinaldave.com/bimg/copywizard3.jpg" alt="" /><br />
Specify Destination Server<br />
<img class="alignnone" src="http://www.pinaldave.com/bimg/copywizard4.jpg" alt="" /><br />
Here you can select option if you want to keep the database ONLINE when it is being copied.<br />
<img class="alignnone" src="http://www.pinaldave.com/bimg/copywizard5.jpg" alt="" /><br />
You can also select option of MOVE or COPY database as well.</p>
<p><img class="alignnone" src="http://www.pinaldave.com/bimg/copywizard6.jpg" alt="" /><br />
Give appropriate database name.<br />
<img class="alignnone" src="http://www.pinaldave.com/bimg/copywizard7.jpg" alt="" /><br />
On this screen you can select additional options to copy as well.<br />
<img class="alignnone" src="http://www.pinaldave.com/bimg/copywizard8.jpg" alt="" /><br />
You create the package over here.<br />
<img class="alignnone" src="http://www.pinaldave.com/bimg/copywizard9.jpg" alt="" /><br />
You can schedule the package using SQL Server Agent.<br />
<img class="alignnone" src="http://www.pinaldave.com/bimg/copywizard10.jpg" alt="" /></p>
<p><img class="alignnone" src="http://www.pinaldave.com/bimg/copywizard11.jpg" alt="" /></p>
<p><img class="alignnone" src="http://www.pinaldave.com/bimg/copywizard12.jpg" alt="" /><br />
When this process is over it will show the success message and database will be copied to another server.<br />
<img class="alignnone" src="http://www.pinaldave.com/bimg/copywizard13.jpg" alt="" /></p>
<p style="text-align:justify;">You can see how easy is the process to copy the database to another server.</p>
<p style="text-align:justify;">Reference:<strong> Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/technology/postaday/'>PostADay</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-azure/'>SQL Azure</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/sqlserver/'>SQLServer</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/13037/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/13037/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/13037/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/13037/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/13037/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/13037/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/13037/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/13037/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/13037/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/13037/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/13037/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/13037/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/13037/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/13037/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=13037&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2011/05/27/sql-server-copy-database-from-instance-to-another-instance-copy-paste-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/copywizard1.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/copywizard2.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/copywizard3.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/copywizard4.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/copywizard5.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/copywizard6.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/copywizard7.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/copywizard8.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/copywizard9.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/copywizard10.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/copywizard11.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/copywizard12.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/copywizard13.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Making Database to Read Only &#8211; Changing Database to Read/Write</title>
		<link>http://blog.sqlauthority.com/2011/04/16/sql-server-making-database-to-read-only-changing-database-to-readwrite/</link>
		<comments>http://blog.sqlauthority.com/2011/04/16/sql-server-making-database-to-read-only-changing-database-to-readwrite/#comments</comments>
		<pubDate>Sat, 16 Apr 2011 01:30:00 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[PostADay]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=12636</guid>
		<description><![CDATA[I recently received following comments on my earlier blog: &#8220;Today i was trying to attach the (MDF,NDF,LDF ) sql server 2008 database which i have received from my client. After attachment the database status is showing (Read-Only) (Eg.database name (Read-Only). How do i make to normal mode for the data updation. is there any query [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=12636&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I recently received<strong><a href="http://blog.sqlauthority.com/2010/04/05/sql-server-2008-introduction-to-snapshot-database-restore-from-snapshot/#comment-127323" target="_blank"> following comments</a></strong> on my earlier blog:</p>
<p style="text-align:justify;">&#8220;Today i was trying to attach the (MDF,NDF,LDF ) sql server 2008 database  which i have received from my client. After attachment the database  status is showing (Read-Only) (Eg.database name (Read-Only). How do i  make to normal mode for the data updation. is there any query available  to resolve this problem. Your help will be highly helpful.&#8221;</p>
<p style="text-align:justify;">Here is the answer:</p>
<h2 style="text-align:justify;">Make Database Read Only</h2>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">[master]<br />
GO<br />
</span><span style="color:blue;">ALTER DATABASE </span><span style="color:black;">[TESTDB] </span><span style="color:blue;">SET </span><span style="color:black;">READ_ONLY </span><span style="color:blue;">WITH </span><span style="color:black;">NO_WAIT<br />
GO<br />
</span></code></p>
<h2 style="text-align:justify;">Make Database Read/Write</h2>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">[master]<br />
GO<br />
</span><span style="color:blue;">ALTER DATABASE </span><span style="color:black;">[TESTDB] </span><span style="color:blue;">SET </span><span style="color:black;">READ_WRITE </span><span style="color:blue;">WITH </span><span style="color:black;">NO_WAIT<br />
GO</span></code></p>
<p style="text-align:justify;">If you face error that if database is already in use, you can resolve the same by making database in single user mode &#8211; here is the guideline <a href="http://blog.sqlauthority.com/2010/02/11/sql-server-alter-database-dbname-set-single_user-with-rollback-immediate/" target="_blank">SQL SERVER – ALTER DATABASE dbname SET SINGLE_USER WITH ROLLBACK IMMEDIATE</a>.</p>
<p style="text-align:justify;">Reference:<strong> Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.SQLAuthority.com</a>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/technology/postaday/'>PostADay</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/sqlserver/'>SQLServer</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/12636/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/12636/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/12636/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/12636/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/12636/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/12636/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/12636/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/12636/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/12636/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/12636/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/12636/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/12636/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/12636/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/12636/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=12636&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2011/04/16/sql-server-making-database-to-read-only-changing-database-to-readwrite/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; FIX &#8211; ERROR : Msg 3201, Level 16 Cannot open backup device . Operating system error 5(Access is denied.)</title>
		<link>http://blog.sqlauthority.com/2011/04/13/sql-server-fix-error-msg-3201-level-16-cannot-open-backup-device-operating-system-error-5access-is-denied/</link>
		<comments>http://blog.sqlauthority.com/2011/04/13/sql-server-fix-error-msg-3201-level-16-cannot-open-backup-device-operating-system-error-5access-is-denied/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 01:30:57 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[PostADay]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Data Storage]]></category>
		<category><![CDATA[SQL Error Messages]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=12605</guid>
		<description><![CDATA[Recently I formatted my computer and installed fresh SQL Server in it. I installed AdventureWorks database in my database. Once done I wanted to run few test scripts on my database. Just like every DBA, I decided to take backup of my database &#8211; this way I can restore it back to attain original database [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=12605&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Recently I formatted my computer and installed fresh SQL Server in it. I installed AdventureWorks database in my database. Once done I wanted to run few test scripts on my database. Just like every DBA, I decided to take backup of my database &#8211; this way I can restore it back to attain original database state. As soon as I ran the backup command I ended up with following error. This error is due to permissions issue on the local disk and user account which is running SQL Server.</p>
<p style="text-align:justify;"><span style="color:#ff0000;">Msg 3201, Level 16, State 1, Line 1</span><br />
<span style="color:#ff0000;"> Cannot open backup device &#8216;C:\AdventureWorks.bak&#8217;. Operating system error 5(Access is denied.).</span></p>
<p style="text-align:justify;"><strong>Fix/Resolution/Workaround:</strong></p>
<p style="text-align:justify;">I checked which user account my SQL Server services are running.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/NetworkError1.jpg" alt="" width="405" height="448" /></p>
<p style="text-align:justify;">I gave full permission to that account to get read of the error.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/NetworkError2.jpg" alt="" width="377" height="456" /></p>
<p style="text-align:justify;">NOTE: This whole experience was done on the my personal machine and not on production server. Please check with your network administrator for permission on production server.</p>
<p style="text-align:justify;">Reference:<strong> Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/technology/postaday/'>PostADay</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/sql-data-storage/'>SQL Data Storage</a>, <a href='http://blog.sqlauthority.com/category/sql-error-messages/'>SQL Error Messages</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/sqlserver/'>SQLServer</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/12605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/12605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/12605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/12605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/12605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/12605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/12605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/12605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/12605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/12605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/12605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/12605/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/12605/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/12605/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=12605&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2011/04/13/sql-server-fix-error-msg-3201-level-16-cannot-open-backup-device-operating-system-error-5access-is-denied/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/NetworkError1.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/NetworkError2.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Log File Growing for Model Database &#8211; model Database Log File Grew Too Big</title>
		<link>http://blog.sqlauthority.com/2011/03/19/sql-server-log-file-growing-for-model-database-model-database-log-file-grew-too-big/</link>
		<comments>http://blog.sqlauthority.com/2011/03/19/sql-server-log-file-growing-for-model-database-model-database-log-file-grew-too-big/#comments</comments>
		<pubDate>Sat, 19 Mar 2011 01:30:42 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[PostADay]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=12237</guid>
		<description><![CDATA[After reading my earlier article SQL SERVER – master Database Log File Grew Too Big, I received an email recently from another reader asking why does the log file of model database grow every day when he is not carrying out any operation in the model database. As per the email, he is absolutely sure [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=12237&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">After reading my earlier article <a href="http://blog.sqlauthority.com/2011/01/09/sql-server-master-database-log-file-grew-too-big/" target="_blank"><strong>SQL SERVER – master Database Log File Grew Too Big</strong></a>, I received an email recently from another reader asking why does the log file of model database grow every day when he is not carrying out any operation in the model database. As per the email, he is absolutely sure that he is doing nothing on his model database; he had used policy management to catch any T-SQL operation in the model database and there were none.</p>
<p style="text-align:justify;">This was indeed surprising to me. I sent a request to access to his server, which he happily agreed for and within a min, we figured out the issue. He was taking the backup of the model database every day taking the database backup every night. When I explained the same to him, he did not believe it; so I quickly wrote down the following script. The results before and after the usage of the script were very clear.</p>
<h3 style="text-align:justify;"><strong>What is a model database?</strong></h3>
<p style="text-align:justify;">The model database is used as the template for all databases created on an instance of SQL Server. Any object you create in the model database will be automatically created in subsequent user database created on the server.</p>
<p style="text-align:justify;"><strong>NOTE: Do not run this in production environment. </strong></p>
<p style="text-align:justify;">During the demo, the model database was in full recovery mode and only full backup operation was performed (no log backup).</p>
<h3 style="text-align:justify;"><strong>Before Backup Script</strong></h3>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/modeldb1.jpg" alt="" width="450" height="43" /></p>
<h3 style="text-align:justify;"><strong>Backup Script in loop</strong></h3>
<h3 style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">DECLARE </span><span style="color:#434343;">@FLAG </span><span style="color:blue;">INT<br />
SET </span><span style="color:#434343;">@FLAG </span><span style="color:blue;">= </span><span style="color:black;">1<br />
</span><span style="color:blue;">WHILE</span><span style="color:gray;">(</span><span style="color:#434343;">@FLAG </span><span style="color:gray;">&lt; </span><span style="color:black;">1000</span><span style="color:gray;">)<br />
</span><span style="color:blue;">BEGIN<br />
BACKUP DATABASE </span><span style="color:black;">[model] </span><span style="color:blue;">TO  DISK = </span><span style="color:red;">N'D:\model.bak'<br />
</span><span style="color:blue;">SET </span><span style="color:#434343;">@FLAG </span><span style="color:blue;">= </span><span style="color:#434343;">@FLAG </span><span style="color:gray;">+ </span><span style="color:black;">1<br />
</span><span style="color:blue;">END<br />
</span><span style="color:black;">GO<br />
</span></code><strong>After Backup Script</strong></h3>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/modeldb2.jpg" alt="" width="460" height="40" /></p>
<h3 style="text-align:justify;"><strong>Why did this happen?</strong></h3>
<p style="text-align:justify;">The model database was in full recovery mode and taking full backup is logged operation. As there was no log backup and only full backup was performed on the model database, the size of the log file kept growing.</p>
<h3 style="text-align:justify;"><strong>Resolution:</strong></h3>
<p style="text-align:justify;">Change the backup mode of model database from &#8220;Full Recovery&#8221; to &#8220;Simple Recovery.&#8221;.</p>
<p style="text-align:justify;">Take full backup of the model database &#8220;only&#8221; when you change something in the model database.</p>
<p style="text-align:justify;">Let me know if you have encountered a situation like this? If so, how did you resolve it? It will be interesting to know about your experience.</p>
<p style="text-align:justify;">Reference:<strong> Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.SQLAuthority.com</a>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/technology/postaday/'>PostADay</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/12237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/12237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/12237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/12237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/12237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/12237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/12237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/12237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/12237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/12237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/12237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/12237/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/12237/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/12237/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=12237&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2011/03/19/sql-server-log-file-growing-for-model-database-model-database-log-file-grew-too-big/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/modeldb1.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/modeldb2.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; master Database Log File Grew Too Big</title>
		<link>http://blog.sqlauthority.com/2011/01/09/sql-server-master-database-log-file-grew-too-big/</link>
		<comments>http://blog.sqlauthority.com/2011/01/09/sql-server-master-database-log-file-grew-too-big/#comments</comments>
		<pubDate>Sun, 09 Jan 2011 01:30:30 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[PostADay]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=11587</guid>
		<description><![CDATA[Couple of the days ago, I received following email and I find this email very interesting and I feel like sharing with all of you. Note: Please read the whole email before providing your suggestions. &#8220;Hi Pinal, If you can share these details on your blog, it will help many. We understand the value of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=11587&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Couple of the days ago, I received following email and I find this email very interesting and I feel like sharing with all of you.</p>
<p style="text-align:justify;"><strong>Note:</strong> Please read the whole email before providing your suggestions.</p>
<p style="text-align:justify;padding-left:30px;">&#8220;Hi Pinal,</p>
<p style="text-align:justify;padding-left:30px;">If you can share these details on your blog, it will help many.</p>
<p style="text-align:justify;padding-left:30px;">We understand the value of the master database and we take its regular back up (everyday midnight). Yesterday we noticed that our master database log file has grown very large. This is very first time that we have encountered such an issue. The master database is in simple recovery mode; so we assumed that it will never grow big; however, we now have a big log file.</p>
<p style="text-align:justify;padding-left:60px;"><img class="alignnone" src="http://www.pinaldave.com/bimg/masterlog1.jpg" alt="" width="400" height="48" /></p>
<p style="text-align:justify;padding-left:30px;">We ran the following command</p>
<p style="text-align:justify;padding-left:30px;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">[master]<br />
GO<br />
</span><span style="color:blue;">DBCC </span><span style="color:black;">SHRINKFILE </span><span style="color:gray;">(</span><span style="color:red;">N'mastlog' </span><span style="color:gray;">, </span><span style="color:black;">0</span><span style="color:gray;">, </span><span style="color:black;">TRUNCATEONLY</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO<br />
<span style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size:13px;"><br />
We know this command will break the chains of LSN but as per our understanding; it should not matter as we are in simple recovery model.</span></span></code></p>
<p style="text-align:justify;padding-left:60px;"><span style="color:black;"><span style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;font-size:13px;"><img class="alignnone" src="http://www.pinaldave.com/bimg/masterlog2.jpg" alt="" width="403" height="42" /><br />
</span></span></p>
<p style="text-align:justify;padding-left:30px;">&nbsp;</p>
<p style="text-align:justify;padding-left:30px;">&nbsp;</p>
<p style="text-align:justify;padding-left:30px;">After running this, the log file becomes very small.</p>
<p style="text-align:justify;padding-left:30px;">Just to be cautious, we took full backup of the master database right away.</p>
<p style="text-align:justify;padding-left:30px;">We totally understand that this is not the normal practice; so if you are going to tell us the same, we are aware of it.</p>
<p style="text-align:justify;padding-left:30px;">However, here is the question for you? What operation in master database would have caused our log file to grow too large?</p>
<p style="text-align:justify;padding-left:30px;">Thanks,</p>
<p style="text-align:justify;padding-left:30px;">[name and company name removed as per request]&#8220;</p>
<p style="text-align:justify;">Here was my response to them:</p>
<p style="text-align:justify;padding-left:30px;">&#8220;Hi [name removed],</p>
<p style="text-align:justify;padding-left:30px;">It is great that you are aware of all the right steps and method. Taking full backup when you are not sure is always a good practice.</p>
<p style="text-align:justify;padding-left:30px;">Regarding your question what could have caused your master database log to grow larger, let me try to guess what could have happened.</p>
<p style="text-align:justify;padding-left:30px;">Do you have any user table in the master database? If yes, this is not recommended and also NOT a good practice. If have user tables in master database and you are doing any long operation (may be lots of insert, update, delete or rebuilding them), then it can cause this situation.</p>
<p style="text-align:justify;padding-left:30px;">You have made me curious about your scenario; do revert back.</p>
<p style="text-align:justify;padding-left:30px;">Kind Regards,</p>
<p style="text-align:justify;padding-left:30px;">Pinal&#8221;</p>
<p style="text-align:justify;">Within few minutes I received reply:</p>
<p style="text-align:justify;padding-left:30px;">&#8220;That was it Pinal. We had one of the maintenance task log tables created in the master table, which had many long transactions during the night. We moved it to newly created database named ‘maintenance’, and we will keep you updated.&#8221;</p>
<p style="text-align:justify;">I was very glad to receive the email. I do not suggest that any user table should be created in the master database. It should be left alone from user objects. Now here is the question for you &#8211; can you think of any other reason for master log file growth?</p>
<p style="text-align:justify;">Reference:<strong> Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.SQLAuthority.com</a>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/technology/postaday/'>PostADay</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/11587/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/11587/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/11587/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/11587/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/11587/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/11587/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/11587/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/11587/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/11587/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/11587/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/11587/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/11587/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/11587/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/11587/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=11587&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2011/01/09/sql-server-master-database-log-file-grew-too-big/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/masterlog1.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/masterlog2.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Installing AdventureWorks for SQL Server Denali</title>
		<link>http://blog.sqlauthority.com/2010/12/08/sql-server-installing-adventureworks-for-sql-server-2011/</link>
		<comments>http://blog.sqlauthority.com/2010/12/08/sql-server-installing-adventureworks-for-sql-server-2011/#comments</comments>
		<pubDate>Wed, 08 Dec 2010 01:30:26 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Management Studio]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=11126</guid>
		<description><![CDATA[I just began with SQL Server 2011 Denali CTP1. The very first thing, I realized that there is no AdventureWorks Sample Database available for Denali. I quickly searched online and reached to Microsoft documentations where it provides information of the how to install (restore) AdventureWorks for SQL Server 2011 for Denali. Download the AdventureWorks from [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=11126&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I just began with<strong> <a href="http://blog.sqlauthority.com/2010/11/11/sqlauthority-news-sql-server-2011-release-date-november-9-2010/" target="_blank">SQL Server 2011 Denali CTP1</a></strong>. The very first thing, I realized that there is no AdventureWorks Sample Database available for Denali. I quickly searched online and reached to <a href="http://msftdbprodsamples.codeplex.com/releases/view/55330" target="_blank">Microsoft documentations</a> where it provides information of the how to install (restore) AdventureWorks for SQL Server 2011 for Denali.</p>
<ol style="text-align:justify;">
<li>Download the AdventureWorks from here.</li>
<li>Run following script (replace your path of mdf file.</li>
</ol>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">CREATE DATABASE </span><span style="color:black;">AdventureWorks2008R2<br />
</span><span style="color:blue;">ON </span><span style="color:gray;">(</span><span style="color:black;">FILENAME </span><span style="color:blue;">= </span><span style="color:red;">'C:\SQL 11 CTP1\CTP1\AdventureWorks2008R2_Data.mdf'</span><span style="color:gray;">)<br />
</span><span style="color:blue;">FOR </span><span style="color:black;">ATTACH_REBUILD_LOG </span><span style="color:gray;">;<br />
</span></code></p>
<p style="text-align:justify;">When you run above script it will give you following message and you are <strong>DONE</strong>!</p>
<p style="text-align:left;"><code>File activation failure. The physical file name "C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\AdventureWorks2008R2_Log.ldf" may be incorrect.<br />
New log file 'C:\SQL 11 CTP1\CTP1\AdventureWorks2008R2_log.ldf' was created.<br />
Converting database 'AdventureWorks2008R2' from version 679 to the current version 684.<br />
Database 'AdventureWorks2008R2' running the upgrade step from version 679 to version 680.<br />
Database 'AdventureWorks2008R2' running the upgrade step from version 680 to version 681.<br />
Database 'AdventureWorks2008R2' running the upgrade step from version 681 to version 682.<br />
Database 'AdventureWorks2008R2' running the upgrade step from version 682 to version 683.<br />
Database 'AdventureWorks2008R2' running the upgrade step from version 683 to version 684.</code></p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/denaliupgrade.jpg" alt="" width="657" height="258" /></p>
<p style="text-align:justify;">I will soon write my experience about Denali. However, SQL Server Management Studio more started to look a like Visual Studio.</p>
<p style="text-align:justify;">Reference: <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.sqlauthority.com</strong></a><strong>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/sql-server-management-studio/'>SQL Server Management Studio</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/11126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/11126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/11126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/11126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/11126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/11126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/11126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/11126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/11126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/11126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/11126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/11126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/11126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/11126/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=11126&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/12/08/sql-server-installing-adventureworks-for-sql-server-2011/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/denaliupgrade.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Get Database Backup History for a Single Database</title>
		<link>http://blog.sqlauthority.com/2010/11/10/sql-server-get-database-backup-history-for-a-single-database/</link>
		<comments>http://blog.sqlauthority.com/2010/11/10/sql-server-get-database-backup-history-for-a-single-database/#comments</comments>
		<pubDate>Wed, 10 Nov 2010 01:30:26 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Contribution]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10813</guid>
		<description><![CDATA[I recently wrote article SQL SERVER – Finding Last Backup Time for All Database and requested blog readers to respond with their own script which they use it Database Backup. Here is the script suggested by SQL Expert aasim abdullah, who has written excellent script which goes back and retrieves the history of any single [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=10813&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I recently wrote article <strong><a href="http://blog.sqlauthority.com/2010/11/04/sql-server-finding-last-backup-time-for-all-database/" target="_blank">SQL SERVER – Finding Last Backup Time for All Database</a></strong> and requested blog readers to respond with their own script which they use it Database Backup.</p>
<p style="text-align:justify;">Here is the script suggested by SQL Expert <strong><a href="http://blog.sqlauthority.com/2010/11/04/sql-server-finding-last-backup-time-for-all-database/#comment-97777" target="_blank">aasim abdullah</a></strong>, who has written excellent script which goes back and retrieves the history of any single database.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">AdventureWorks<br />
GO<br />
</span><span style="color:green;">-- Get Backup History for required database<br />
</span><span style="color:blue;">SELECT TOP </span><span style="color:black;">100<br />
s.database_name</span><span style="color:gray;">,<br />
</span><span style="color:black;">m.physical_device_name</span><span style="color:gray;">,<br />
</span><span style="color:magenta;">CAST</span><span style="color:gray;">(</span><span style="color:magenta;">CAST</span><span style="color:gray;">(</span><span style="color:black;">s.backup_size </span><span style="color:gray;">/ </span><span style="color:black;">1000000 </span><span style="color:blue;">AS INT</span><span style="color:gray;">) </span><span style="color:blue;">AS VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">14</span><span style="color:gray;">)) + </span><span style="color:red;">' ' </span><span style="color:gray;">+ </span><span style="color:red;">'MB' </span><span style="color:blue;">AS </span><span style="color:black;">bkSize</span><span style="color:gray;">,<br />
</span><span style="color:magenta;">CAST</span><span style="color:gray;">(</span><span style="color:magenta;">DATEDIFF</span><span style="color:gray;">(</span><span style="color:black;">second</span><span style="color:gray;">, </span><span style="color:black;">s.backup_start_date</span><span style="color:gray;">,<br />
</span><span style="color:black;">s.backup_finish_date</span><span style="color:gray;">) </span><span style="color:blue;">AS VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">4</span><span style="color:gray;">)) + </span><span style="color:red;">' ' </span><span style="color:gray;">+ </span><span style="color:red;">'Seconds' </span><span style="color:black;">TimeTaken</span><span style="color:gray;">,<br />
</span><span style="color:black;">s.backup_start_date</span><span style="color:gray;">,<br />
</span><span style="color:magenta;">CAST</span><span style="color:gray;">(</span><span style="color:black;">s.first_lsn </span><span style="color:blue;">AS VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">50</span><span style="color:gray;">)) </span><span style="color:blue;">AS </span><span style="color:black;">first_lsn</span><span style="color:gray;">,<br />
</span><span style="color:magenta;">CAST</span><span style="color:gray;">(</span><span style="color:black;">s.last_lsn </span><span style="color:blue;">AS VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">50</span><span style="color:gray;">)) </span><span style="color:blue;">AS </span><span style="color:black;">last_lsn</span><span style="color:gray;">,<br />
</span><span style="color:magenta;">CASE </span><span style="color:black;">s.[type]<br />
</span><span style="color:blue;">WHEN </span><span style="color:red;">'D' </span><span style="color:blue;">THEN </span><span style="color:red;">'Full'<br />
</span><span style="color:blue;">WHEN </span><span style="color:red;">'I' </span><span style="color:blue;">THEN </span><span style="color:red;">'Differential'<br />
</span><span style="color:blue;">WHEN </span><span style="color:red;">'L' </span><span style="color:blue;">THEN </span><span style="color:red;">'Transaction Log'<br />
</span><span style="color:blue;">END AS </span><span style="color:black;">BackupType</span><span style="color:gray;">,<br />
</span><span style="color:black;">s.server_name</span><span style="color:gray;">,<br />
</span><span style="color:black;">s.recovery_model<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">msdb.dbo.backupset s<br />
</span><span style="color:blue;">INNER JOIN </span><span style="color:black;">msdb.dbo.backupmediafamily m </span><span style="color:blue;">ON </span><span style="color:black;">s.media_set_id </span><span style="color:blue;">= </span><span style="color:black;">m.media_set_id<br />
</span><span style="color:blue;">WHERE </span><span style="color:black;">s.database_name </span><span style="color:blue;">= </span><span style="color:magenta;">DB_NAME</span><span style="color:gray;">() </span><span style="color:green;">-- Remove this line for all the database<br />
</span><span style="color:blue;">ORDER BY </span><span style="color:black;">backup_start_date </span><span style="color:blue;">DESC</span><span style="color:gray;">, </span><span style="color:black;">backup_finish_date<br />
GO</span></code></p>
<p style="text-align:justify;">Very neat script and in my above example I have ran that for single database adventureworks and you can see following results. The same can be ran for multiple database as well if you just remove the WHERE condition.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/backuphistory.jpg" alt="" width="500" height="137" /></p>
<p style="text-align:justify;">Reference:<strong> Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.SQLAuthority.com</a>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/readers-contribution/'>Readers Contribution</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/10813/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/10813/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/10813/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/10813/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/10813/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/10813/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/10813/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/10813/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/10813/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/10813/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/10813/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/10813/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/10813/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/10813/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=10813&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/11/10/sql-server-get-database-backup-history-for-a-single-database/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/backuphistory.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Finding Last Backup Time for All Database</title>
		<link>http://blog.sqlauthority.com/2010/11/04/sql-server-finding-last-backup-time-for-all-database/</link>
		<comments>http://blog.sqlauthority.com/2010/11/04/sql-server-finding-last-backup-time-for-all-database/#comments</comments>
		<pubDate>Thu, 04 Nov 2010 01:30:06 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10739</guid>
		<description><![CDATA[Here is the quick script I use find last backup time for all the database in my server instance. SELECT sdb.Name AS DatabaseName, COALESCE(CONVERT(VARCHAR(12), MAX(bus.backup_finish_date), 101),'-') AS LastBackUpTime FROM sys.sysdatabases sdb LEFT OUTER JOIN msdb.dbo.backupset bus ON bus.database_name = sdb.name GROUP BY sdb.Name Do you use any other script for the same purpose, please share [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=10739&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Here is the quick script I use find last backup time for all the database in my server instance.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:black;">sdb.Name </span><span style="color:blue;">AS </span><span style="color:black;">DatabaseName</span><span style="color:gray;">,<br />
</span><span style="color:magenta;">COALESCE</span><span style="color:gray;">(</span><span style="color:magenta;">CONVERT</span><span style="color:gray;">(</span><span style="color:blue;">VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">12</span><span style="color:gray;">), </span><span style="color:magenta;">MAX</span><span style="color:gray;">(</span><span style="color:black;">bus.backup_finish_date</span><span style="color:gray;">), </span><span style="color:black;">101</span><span style="color:gray;">),</span><span style="color:red;">'-'</span><span style="color:gray;">) </span><span style="color:blue;">AS </span><span style="color:black;">LastBackUpTime<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.sysdatabases sdb<br />
</span><span style="color:magenta;">LEFT </span><span style="color:gray;">OUTER </span><span style="color:blue;">JOIN </span><span style="color:black;">msdb.dbo.backupset bus </span><span style="color:blue;">ON </span><span style="color:black;">bus.database_name </span><span style="color:blue;">= </span><span style="color:black;">sdb.name<br />
</span><span style="color:blue;">GROUP BY </span><span style="color:black;">sdb.Name<br />
</span></code></p>
<p style="text-align:justify;">Do you use any other script for the same purpose, please share here, it will be interesting for all of us know.</p>
<p style="text-align:justify;">Reference:<strong> Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.SQLAuthority.com</a>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/10739/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/10739/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/10739/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/10739/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/10739/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/10739/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/10739/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/10739/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/10739/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/10739/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/10739/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/10739/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/10739/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/10739/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=10739&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/11/04/sql-server-finding-last-backup-time-for-all-database/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; Corrupted Backup File and Unsuccessful Restore</title>
		<link>http://blog.sqlauthority.com/2010/10/24/sql-server-corrupted-backup-file-and-unsuccessful-restore/</link>
		<comments>http://blog.sqlauthority.com/2010/10/24/sql-server-corrupted-backup-file-and-unsuccessful-restore/#comments</comments>
		<pubDate>Sun, 24 Oct 2010 01:30:05 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Error Messages]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10631</guid>
		<description><![CDATA[If you are an SQL Server Consultant, there is never a single dull moment in your life. Quite often you are called in for fixing something, but then you always end up fixing something else! I was recently working on an offshore project where I was called in to tune high transaction OLTP server. During [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=10631&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">If you are an SQL Server Consultant, there is never a single dull moment in your life. Quite often you are called in for fixing something, but then you always end up fixing something else!</p>
<p style="text-align:justify;">I was recently working on an offshore project where I was called in to tune high transaction OLTP server. During work, I demanded that I should have a server which is very similar to live database so I could inspect all the settings and data. I may end up running a few queries which may or may not change the server settings. The Sr. DBA agreed and instructed the Jr. DBA accordingly to restore a database from their backup.</p>
<p style="text-align:justify;">In a few minutes, their Jr. DBA arrived running to us, asking for our help. The problem was that when he attempted to restore the database, he was not able to restore the database as their backup. This eventually threw an error. Now this was very alarming for them because their backup file had some issues. I suggested trying some backups but again, the same issue occurred on all of them.</p>
<p style="text-align:justify;">The CTO, who was also present at the location, got very upset with this situation. He then asked when the last successful restore test was done. As expected, the answer was <strong>NEVER. </strong>There were no successful restore tests done before.</p>
<p style="text-align:justify;">During that time, I was present and I could clearly see the stress, confusion, carelessness and anger around me. I did not appreciate the feeling and I was pretty sure that no one in there wanted the atmosphere like me.</p>
<p style="text-align:justify;">The next step was to take a backup of their database right away. The CTO wanted to observe the complete process so he could figure out where the error originated and where was its exact location.</p>
<p style="text-align:justify;">Here is the error they were receiving when they attempted to restore the database:</p>
<p style="text-align:justify;"><span style="color:#ff0000;">Msg 3243, Level 16, State 1, Line 1</span><br />
<span style="color:#ff0000;"> The media family on device &#8216;D:\TestDB.bak&#8217; was created using Microsoft Tape Format version 1.22. SQL Server supports version 1.0.</span><br />
<span style="color:#ff0000;"> Msg 3013, Level 16, State 1, Line 1</span><br />
<span style="color:#ff0000;"> RESTORE DATABASE is terminating abnormally.</span></p>
<p style="text-align:justify;">The first thing I attempted to do is to take a backup of the database on another spare drive by myself. After having that backup, I tried to restore it to the database. As what I expected, it was successfully restored. Now that event provided me the information that there was nothing wrong with how the backup was done. The problem was located somewhere else. I asked them about their current process of taking a backup and storing it. They provided me the following diagram:</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/ftpprocess.jpg" alt="" width="500" height="250" /></p>
<p style="text-align:justify;">Looking at the diagram, I decided to test their FTP software. I uploaded  our organization’s FTP space. After it was done, I restored the database again and it worked without an error. This led me to think that there is something wrong in their UNIX server. After talking to their UNIX administrator, he informed me that they were running some cron jobs to compress the files and they were also moving those files to a larger drive. After listening to this, I was very sure there was something wrong during that process which had something to do with the .bak file because it was not able to work properly.</p>
<p style="text-align:justify;">After a few tests, the UNIX administrator accepted that that cron job was changing the structure of the file. In the meantime, he disabled the process to avoid this corruption. The CTO then asked me if there was any way they could tell if the backup which was already taken was good as gold or if there was a corruption in it.</p>
<p style="text-align:justify;">Here is the command that you can run on your database file so you can check if the database file is intact or if it has any corruption in it:</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">RESTORE </span><span style="color:black;">VERIFYONLY<br />
</span><span style="color:blue;">FROM DISK=</span><span style="color:red;">N'D:\TestDB.bak'<br />
</span></code></p>
<p style="text-align:justify;">The question is, &#8220;Do you practice this on your production server&#8217;s backup?&#8221;</p>
<p style="text-align:justify;">Reference:<strong> Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.SQLAuthority.com</a>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/sql-error-messages/'>SQL Error Messages</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/10631/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/10631/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/10631/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/10631/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/10631/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/10631/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/10631/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/10631/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/10631/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/10631/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/10631/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/10631/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/10631/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/10631/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=10631&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/10/24/sql-server-corrupted-backup-file-and-unsuccessful-restore/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/ftpprocess.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Taking Multiple Backup of Database in Single Command &#8211; Mirrored Database Backup</title>
		<link>http://blog.sqlauthority.com/2010/10/23/sql-server-taking-multiple-backup-of-database-in-single-command-mirrored-database-backup/</link>
		<comments>http://blog.sqlauthority.com/2010/10/23/sql-server-taking-multiple-backup-of-database-in-single-command-mirrored-database-backup/#comments</comments>
		<pubDate>Sat, 23 Oct 2010 01:30:03 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10623</guid>
		<description><![CDATA[I recently had a very interesting experience. In one of my recent consultancy works, I was told by our client that they are going to take the backup of the database and will also a copy of it at the same time. I expressed that it was surely possible if they were going to use [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=10623&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I recently had a very interesting experience. In one of my recent consultancy works, I was told by our client that they are going to take the backup of the database and will also a copy of it at the same time. I expressed that it was surely possible if they were going to use a mirror command. In addition, they told me that whenever they take two copies of the database, the size of the database, is always reduced. Now this was something not clear to me, I said it was not possible and so I asked them to show me the script.</p>
<p style="text-align:justify;">Here was their script:</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">BACKUP DATABASE </span><span style="color:black;">[AdventureWorks] </span><span style="color:blue;">TO<br />
DISK = </span><span style="color:red;">N'D:\AdventureWorks.bak'<br />
</span><span style="color:gray;">, </span><span style="color:blue;">DISK = </span><span style="color:red;">N'E:\AdventureWorks.bak'<br />
</span><span style="color:blue;">WITH </span><span style="color:black;">FORMAT</span><span style="color:gray;">, </span><span style="color:black;">INIT</span><span style="color:gray;">,<br />
</span><span style="color:black;">NAME </span><span style="color:blue;">= </span><span style="color:red;">N'AdventureWorks-Full Database Backup'<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;">This script was very interesting to me. There is nothing wrong with it; however it does not duplicate your data. In fact, it splits your backup file in two parts and, when you restore, you will need both of these files. This was the reason why the size of the backup file was reduced whenever they took a backup on two places.</p>
<p style="text-align:justify;">What they really needed was the following script wherein the full backup would be mirrored to another backup location:</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">BACKUP DATABASE </span><span style="color:black;">[AdventureWorks] </span><span style="color:blue;">TO<br />
DISK = </span><span style="color:red;">N'D:\AdventureWorks.bak'<br />
</span><span style="color:black;">MIRROR </span><span style="color:blue;">TO DISK = </span><span style="color:red;">N'E:\AdventureWorks.bak'<br />
</span><span style="color:blue;">WITH </span><span style="color:black;">FORMAT</span><span style="color:gray;">, </span><span style="color:black;">INIT</span><span style="color:gray;">,<br />
</span><span style="color:black;">NAME </span><span style="color:blue;">= </span><span style="color:red;">N'AdventureWorks-Full Database Backup'<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;">In this case, when you check the size of the backup, you will notice that its size is not reduced as well.</p>
<p style="text-align:justify;">I have previously written on this subject in very much detail. Here is the in-depth article about the same topic:</p>
<h2 style="text-align:justify;"><a href="http://blog.sqlauthority.com/2009/09/02/sql-server-mirrored-backup-and-restore-and-split-file-backup-2/" target="_blank">SQL SERVER – Mirrored Backup and Restore and Split File Backup</a></h2>
<p style="text-align:justify;">Do you use this MIRROR TO command in your production environment?</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.sqlauthority.com</strong></a><strong>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/10623/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/10623/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/10623/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/10623/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/10623/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/10623/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/10623/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/10623/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/10623/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/10623/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/10623/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/10623/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/10623/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/10623/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=10623&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/10/23/sql-server-taking-multiple-backup-of-database-in-single-command-mirrored-database-backup/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; How to Stop Growing Log File Too Big</title>
		<link>http://blog.sqlauthority.com/2010/09/20/sql-server-how-to-stop-growing-log-file-too-big/</link>
		<comments>http://blog.sqlauthority.com/2010/09/20/sql-server-how-to-stop-growing-log-file-too-big/#comments</comments>
		<pubDate>Mon, 20 Sep 2010 01:30:03 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10260</guid>
		<description><![CDATA[I was recently engaged in Performance Tuning Engagement in Singapore. The organization had a huge database and had more than a million transactions every hour. During the assignment, I noticed that they were truncating the transactions log. This really alarmed me so I informed them this should not be continued anymore because there’s really no [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=10260&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I was recently engaged in <a href="http://blog.sqlauthority.com/sql-server-performance-tuning/" target="_blank"><strong>Performance Tuning</strong></a> Engagement in Singapore. The organization had a huge database and had more than a million transactions every hour. During the assignment, I noticed that they were truncating the transactions log. This really alarmed me so I informed them this should not be continued anymore because there’s really no need of truncating or shortening the database log. The reason why they were truncating the database log was that it was growing too big and they wanted to manage its large size. I provided two different solutions for them. Now let’s venture more on these solutions.</p>
<p style="text-align:justify;">If you are jumping over this post to leave a comment, please read first the two options as follows:</p>
<p style="text-align:justify;"><strong>1) Convert the Recovery Model to Simple Recovery</strong></p>
<p style="text-align:justify;">If you are truncating the transaction logs, this means you are breaking the T-Log LSN (Log Sequence Numbers). This follows that if disaster comes, you would not be able to restore your T-Logs and there would be no option for you to do point in time recovery. If you are fine with this situation and there is nothing to worry, I suggest that you change your recovery model to Simple Recovery Model. This way, you will not have extra ordinary growth of your log file.</p>
<p style="text-align:justify;"><strong>2) Start Taking Transaction Log Backup</strong></p>
<p style="text-align:justify;">If your business does not support loss of data or requires having point in time recovery, you cannot afford anything less than Full Recovery Model. In Full Recovery Model, your transaction log will grow until you take a backup of it. You need to take the T-Log Backup at a regular interval. This way, your log would not grow beyond some limits. If you are taking an hourly T-Log backup, your T-Log would grow until one hour but after this the T-Log backup would truncate all the &#8216;committed&#8217; transactions once you take it. Doing this would lead the size of the T-Log not to go down much, but it would rather be marked as <strong>empty</strong> for the next hour&#8217;s T-Log to populate.</p>
<p style="text-align:justify;">With this method, you can restore your database at Point of Time if a disaster ever happens at your server.</p>
<p style="text-align:justify;">Let us run an example to demonstrate this. In this case, I have done the following steps:</p>
<ol style="text-align:justify;">
<li>Create Sample Database in FULL RECOVERY Model</li>
<li>Take Full Backup (full backup is must for taking subsequent backup)</li>
<li>Repeat Following Operation
<ol>
<li>Take Log Backup</li>
<li>Insert Some       rows</li>
<li>Check the size       of Log File</li>
</ol>
</li>
<li>Clean Up</li>
</ol>
<p style="text-align:justify;">After a short while, you will notice that the Log file (ldf) will stop increasing but the size of the backup will increase.</p>
<p style="text-align:justify;">If you have an issue with your log file growth, I suggest that you follow either of the above solutions instead of truncating it.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">/* FULL Recovery and Log File Growth */<br />
</span><span style="color:blue;">USE </span><span style="color:black;">[master]<br />
GO<br />
</span><span style="color:green;">-- Create Database SimpleTran<br />
</span><span style="color:blue;">IF </span><span style="color:gray;">EXISTS (</span><span style="color:blue;">SELECT </span><span style="color:black;">name </span><span style="color:blue;">FROM </span><span style="color:black;">sys.databases </span><span style="color:blue;">WHERE </span><span style="color:black;">name </span><span style="color:blue;">= </span><span style="color:red;">N'SimpleTran'</span><span style="color:gray;">)<br />
</span><span style="color:blue;">BEGIN<br />
ALTER DATABASE </span><span style="color:black;">[SimpleTran] </span><span style="color:blue;">SET </span><span style="color:black;">SINGLE_USER </span><span style="color:blue;">WITH ROLLBACK IMMEDIATE</span><span style="color:gray;">;<br />
</span><span style="color:blue;">DROP DATABASE </span><span style="color:black;">[SimpleTran]<br />
</span><span style="color:blue;">END<br />
</span><span style="color:black;">GO<br />
</span><span style="color:blue;">CREATE DATABASE </span><span style="color:black;">[SimpleTran]<br />
GO<br />
</span><span style="color:green;">-- Set Database backup model to FULL<br />
</span><span style="color:blue;">ALTER DATABASE </span><span style="color:black;">[SimpleTran] </span><span style="color:blue;">SET </span><span style="color:black;">RECOVERY </span><span style="color:blue;">FULL<br />
</span><span style="color:black;">GO<br />
</span><span style="color:blue;">BACKUP DATABASE </span><span style="color:black;">[SimpleTran] </span><span style="color:blue;">TO  DISK = </span><span style="color:red;">N'D:\SimpleTran.bak' </span><span style="color:blue;">WITH </span><span style="color:black;">NOFORMAT</span><span style="color:gray;">, </span><span style="color:black;">NOINIT</span><span style="color:gray;">, </span><span style="color:black;">NAME </span><span style="color:blue;">= </span><span style="color:red;">N'SimpleTran-Full Database Backup'</span><span style="color:gray;">, </span><span style="color:black;">SKIP</span><span style="color:gray;">, </span><span style="color:black;">NOREWIND</span><span style="color:gray;">, </span><span style="color:black;">NOUNLOAD</span><span style="color:gray;">, </span><span style="color:black;">STATS </span><span style="color:blue;">= </span><span style="color:black;">10<br />
GO<br />
</span><span style="color:green;">-- Check Database Log File Size<br />
</span><span style="color:blue;">SELECT </span><span style="color:magenta;">DB_NAME</span><span style="color:gray;">(</span><span style="color:black;">database_id</span><span style="color:gray;">) </span><span style="color:blue;">AS </span><span style="color:black;">DatabaseName</span><span style="color:gray;">,<br />
</span><span style="color:black;">Name </span><span style="color:blue;">AS </span><span style="color:black;">Logical_Name</span><span style="color:gray;">,<br />
</span><span style="color:black;">Physical_Name</span><span style="color:gray;">, (</span><span style="color:black;">size</span><span style="color:gray;">*</span><span style="color:black;">8</span><span style="color:gray;">)/</span><span style="color:black;">1024 SizeMB<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.master_files<br />
</span><span style="color:blue;">WHERE </span><span style="color:magenta;">DB_NAME</span><span style="color:gray;">(</span><span style="color:black;">database_id</span><span style="color:gray;">) </span><span style="color:blue;">= </span><span style="color:red;">'SimpleTran'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Create Table in Database with Transaction<br />
</span><span style="color:blue;">USE </span><span style="color:black;">SimpleTran<br />
GO<br />
</span><span style="color:blue;">IF </span><span style="color:gray;">EXISTS (</span><span style="color:blue;">SELECT </span><span style="color:gray;">* </span><span style="color:blue;">FROM </span><span style="color:black;">sys.objects </span><span style="color:blue;">WHERE </span><span style="color:magenta;">OBJECT_ID </span><span style="color:blue;">= </span><span style="color:magenta;">OBJECT_ID</span><span style="color:gray;">(</span><span style="color:red;">N'[dbo].[RealTempTable]'</span><span style="color:gray;">) AND </span><span style="color:blue;">TYPE IN </span><span style="color:gray;">(</span><span style="color:red;">N'U'</span><span style="color:gray;">))<br />
</span><span style="color:blue;">DROP TABLE </span><span style="color:black;">[dbo].[RealTempTable]<br />
GO<br />
</span><span style="color:blue;">CREATE TABLE </span><span style="color:black;">RealTempTable </span><span style="color:gray;">(</span><span style="color:black;">ID </span><span style="color:blue;">INT</span><span style="color:gray;">)<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">RealTempTable </span><span style="color:gray;">(</span><span style="color:black;">ID</span><span style="color:gray;">)<br />
</span><span style="color:blue;">SELECT TOP </span><span style="color:black;">50000 ROW_NUMBER</span><span style="color:gray;">() </span><span style="color:blue;">OVER </span><span style="color:gray;">(</span><span style="color:blue;">ORDER BY </span><span style="color:black;">a.name</span><span style="color:gray;">) </span><span style="color:black;">RowID<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.all_objects a<br />
</span><span style="color:gray;">CROSS </span><span style="color:blue;">JOIN </span><span style="color:black;">sys.all_objects b<br />
GO<br />
</span><span style="color:green;">-- Check the size of the Database<br />
</span><span style="color:blue;">SELECT </span><span style="color:magenta;">DB_NAME</span><span style="color:gray;">(</span><span style="color:black;">database_id</span><span style="color:gray;">) </span><span style="color:blue;">AS </span><span style="color:black;">DatabaseName</span><span style="color:gray;">,<br />
</span><span style="color:black;">Name </span><span style="color:blue;">AS </span><span style="color:black;">Logical_Name</span><span style="color:gray;">,<br />
</span><span style="color:black;">Physical_Name</span><span style="color:gray;">, (</span><span style="color:black;">size</span><span style="color:gray;">*</span><span style="color:black;">8</span><span style="color:gray;">)/</span><span style="color:black;">1024 SizeMB<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.master_files<br />
</span><span style="color:blue;">WHERE </span><span style="color:magenta;">DB_NAME</span><span style="color:gray;">(</span><span style="color:black;">database_id</span><span style="color:gray;">) </span><span style="color:blue;">= </span><span style="color:red;">'SimpleTran'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Take Full Backup<br />
</span><span style="color:blue;">BACKUP </span><span style="color:magenta;">LOG </span><span style="color:black;">[SimpleTran] </span><span style="color:blue;">TO  DISK = </span><span style="color:red;">N'D:\SimpleTran.bak' </span><span style="color:blue;">WITH </span><span style="color:black;">NOFORMAT</span><span style="color:gray;">, </span><span style="color:black;">NOINIT</span><span style="color:gray;">, </span><span style="color:black;">NAME </span><span style="color:blue;">= </span><span style="color:red;">N'SimpleTran-Transaction Log  Backup'</span><span style="color:gray;">, </span><span style="color:black;">SKIP</span><span style="color:gray;">, </span><span style="color:black;">NOREWIND</span><span style="color:gray;">, </span><span style="color:black;">NOUNLOAD</span><span style="color:gray;">, </span><span style="color:black;">STATS </span><span style="color:blue;">= </span><span style="color:black;">10<br />
GO<br />
</span><span style="color:green;">-- Run following transaction multiple times and check the size of T-Log<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">RealTempTable </span><span style="color:gray;">(</span><span style="color:black;">ID</span><span style="color:gray;">)<br />
</span><span style="color:blue;">SELECT TOP </span><span style="color:black;">50000 ROW_NUMBER</span><span style="color:gray;">() </span><span style="color:blue;">OVER </span><span style="color:gray;">(</span><span style="color:blue;">ORDER BY </span><span style="color:black;">a.name</span><span style="color:gray;">) </span><span style="color:black;">RowID<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.all_objects a<br />
</span><span style="color:gray;">CROSS </span><span style="color:blue;">JOIN </span><span style="color:black;">sys.all_objects b<br />
GO<br />
</span><span style="color:green;">-- Check the size of the Database<br />
</span><span style="color:blue;">SELECT </span><span style="color:magenta;">DB_NAME</span><span style="color:gray;">(</span><span style="color:black;">database_id</span><span style="color:gray;">) </span><span style="color:blue;">AS </span><span style="color:black;">DatabaseName</span><span style="color:gray;">,<br />
</span><span style="color:black;">Name </span><span style="color:blue;">AS </span><span style="color:black;">Logical_Name</span><span style="color:gray;">,<br />
</span><span style="color:black;">Physical_Name</span><span style="color:gray;">, (</span><span style="color:black;">size</span><span style="color:gray;">*</span><span style="color:black;">8</span><span style="color:gray;">)/</span><span style="color:black;">1024 SizeMB<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.master_files<br />
</span><span style="color:blue;">WHERE </span><span style="color:magenta;">DB_NAME</span><span style="color:gray;">(</span><span style="color:black;">database_id</span><span style="color:gray;">) </span><span style="color:blue;">= </span><span style="color:red;">'SimpleTran'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">/*<br />
Now run following code multiple times.<br />
You will notice that it will not increase the size of .ldf file but will for sure<br />
increasethe size of the log backup.<br />
*/<br />
-- Second Time<br />
-- START<br />
</span><span style="color:blue;">BACKUP </span><span style="color:magenta;">LOG </span><span style="color:black;">[SimpleTran] </span><span style="color:blue;">TO  DISK = </span><span style="color:red;">N'D:\SimpleTran.log' </span><span style="color:blue;">WITH </span><span style="color:black;">NOFORMAT</span><span style="color:gray;">, </span><span style="color:black;">NOINIT</span><span style="color:gray;">, </span><span style="color:black;">NAME </span><span style="color:blue;">= </span><span style="color:red;">N'SimpleTran-Transaction Log  Backup'</span><span style="color:gray;">, </span><span style="color:black;">SKIP</span><span style="color:gray;">, </span><span style="color:black;">NOREWIND</span><span style="color:gray;">, </span><span style="color:black;">NOUNLOAD</span><span style="color:gray;">, </span><span style="color:black;">STATS </span><span style="color:blue;">= </span><span style="color:black;">10<br />
GO<br />
</span><span style="color:green;">-- Run following transaction and check the size of T-Log<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">RealTempTable </span><span style="color:gray;">(</span><span style="color:black;">ID</span><span style="color:gray;">)<br />
</span><span style="color:blue;">SELECT TOP </span><span style="color:black;">50000 ROW_NUMBER</span><span style="color:gray;">() </span><span style="color:blue;">OVER </span><span style="color:gray;">(</span><span style="color:blue;">ORDER BY </span><span style="color:black;">a.name</span><span style="color:gray;">) </span><span style="color:black;">RowID<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.all_objects a<br />
</span><span style="color:gray;">CROSS </span><span style="color:blue;">JOIN </span><span style="color:black;">sys.all_objects b<br />
GO<br />
</span><span style="color:green;">-- Check the size of the Database<br />
</span><span style="color:blue;">SELECT </span><span style="color:magenta;">DB_NAME</span><span style="color:gray;">(</span><span style="color:black;">database_id</span><span style="color:gray;">) </span><span style="color:blue;">AS </span><span style="color:black;">DatabaseName</span><span style="color:gray;">,<br />
</span><span style="color:black;">Name </span><span style="color:blue;">AS </span><span style="color:black;">Logical_Name</span><span style="color:gray;">,<br />
</span><span style="color:black;">Physical_Name</span><span style="color:gray;">, (</span><span style="color:black;">size</span><span style="color:gray;">*</span><span style="color:black;">8</span><span style="color:gray;">)/</span><span style="color:black;">1024 SizeMB<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">sys.master_files<br />
</span><span style="color:blue;">WHERE </span><span style="color:magenta;">DB_NAME</span><span style="color:gray;">(</span><span style="color:black;">database_id</span><span style="color:gray;">) </span><span style="color:blue;">= </span><span style="color:red;">'SimpleTran'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- END<br />
--Clean Up<br />
</span><span style="color:blue;">USE MASTER<br />
</span><span style="color:black;">GO<br />
</span><span style="color:blue;">IF </span><span style="color:gray;">EXISTS (</span><span style="color:blue;">SELECT </span><span style="color:black;">name </span><span style="color:blue;">FROM </span><span style="color:black;">sys.databases </span><span style="color:blue;">WHERE </span><span style="color:black;">name </span><span style="color:blue;">= </span><span style="color:red;">N'SimpleTran'</span><span style="color:gray;">)<br />
</span><span style="color:blue;">BEGIN<br />
ALTER DATABASE </span><span style="color:black;">[SimpleTran] </span><span style="color:blue;">SET </span><span style="color:black;">SINGLE_USER </span><span style="color:blue;">WITH ROLLBACK IMMEDIATE</span><span style="color:gray;">;<br />
</span><span style="color:blue;">DROP DATABASE </span><span style="color:black;">[SimpleTran]<br />
</span><span style="color:blue;">END<br />
</span><span style="color:black;"> </span></code></p>
<p style="text-align:justify;">If you run the code that is listed between START and END, you would get the following results almost every time:</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/loggrow.jpg" alt="" width="500" height="56" /></p>
<p style="text-align:justify;">This validates our earlier discussion. After seeing this article, the Singapore team implemented Log Backup instead of Log Truncate right away. Let me know what you think about this article.</p>
<p style="text-align:justify;">
<p style="text-align:justify;">Reference :<strong> Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.SQLAuthority.com</a>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/10260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/10260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/10260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/10260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/10260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/10260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/10260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/10260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/10260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/10260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/10260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/10260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/10260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/10260/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=10260&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/09/20/sql-server-how-to-stop-growing-log-file-too-big/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/loggrow.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Fastest Way to Restore the Database</title>
		<link>http://blog.sqlauthority.com/2010/06/09/sql-server-fastest-way-to-restore-the-database/</link>
		<comments>http://blog.sqlauthority.com/2010/06/09/sql-server-fastest-way-to-restore-the-database/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 01:30:26 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=9203</guid>
		<description><![CDATA[A few days ago, I received following email from blog reader: &#8220;Pinal, We are in an emergency situation. We have a large database of around 80+ GB and its backup is of 50+ GB in size. We need to restore this database ASAP and use it; however, restoring the database takes forever. Do you think [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=9203&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">A few days ago, I received following email from blog reader:</p>
<p style="padding-left:30px;text-align:justify;">&#8220;Pinal,</p>
<p style="padding-left:30px;text-align:justify;">We are in an emergency situation. We have a large database of around 80+ GB and its backup is of 50+ GB in size. We need to restore this database ASAP and use it; however, restoring the database takes forever. Do you think a compressed backup would solve our problem? Any other ideas you got?&#8221;</p>
<p style="text-align:justify;">First of all, the reader has already answered his own question. Yes; I have seen that if you are using a compressed backup, it takes lesser time when you try to restore a database. I have previously blogged about the same subject. Here are the links to those blog posts:</p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2009/11/07/sqlauthority-news-data-compression-strategy-capacity-planning-and-best-practices/" target="_blank">SQL SERVER – Data and Page Compressions – Data Storage and IO Improvement</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2008/07/06/sql-server-2008-introduction-to-row-compression/" target="_blank">SQL SERVER – 2008 – Introduction to Row Compression</a></p>
<p style="text-align:justify;"><a href="http://blog.sqlauthority.com/2008/07/03/sql-server-2008-introduction-to-new-feature-of-backup-compression/" target="_blank">SQL SERVER – 2008 – Introduction to New Feature of Backup Compression</a></p>
<p style="text-align:justify;">However, if your database is very large that it still takes a few minutes to restore the database even though you use any of the features listed above, then it will really take some time to restore the database. If there is urgency and there is no time you can spare for restoring the database, then you can use the wonderful tool developed by <a href="http://www.idera.com/?s=BN_SQLAuth" target="_blank">Idera </a>called <strong><a href="http://www.idera.com/?s=BN_SQLAuth" target="_blank">virtual database</a></strong>. This tool restores a certain database in just a few seconds so it will readily be available for usage.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/idera/vdb1.jpg" alt="" width="500" height="309" /></p>
<p style="text-align:justify;">I have in depth written my experience with this tool in the article here <strong><a href="http://blog.sqlauthority.com/2010/04/06/sql-server-retrieve-and-explore-database-backup-without-restoring-database-idera-virtual-database/" target="_blank">SQL SERVER – Retrieve and Explore Database Backup without Restoring Database – Idera virtual database</a></strong>. Let me know your experience in this scenario. Have you ever needed your database backup restored very quickly, what did you do in that scenario.</p>
<p style="text-align:justify;">Reference: <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<p style="text-align:justify;">
<p style="text-align:justify;">
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/readers-question/'>Readers Question</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/sql-performance/'>SQL Performance</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/9203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/9203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/9203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/9203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/9203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/9203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/9203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/9203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/9203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/9203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/9203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/9203/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/9203/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/9203/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=9203&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/06/09/sql-server-fastest-way-to-restore-the-database/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/idera/vdb1.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Four Posts on Removing the Bookmark Lookup &#8211; Key Lookup</title>
		<link>http://blog.sqlauthority.com/2010/05/13/sql-server-four-posts-on-removing-the-bookmark-lookup-key-lookup/</link>
		<comments>http://blog.sqlauthority.com/2010/05/13/sql-server-four-posts-on-removing-the-bookmark-lookup-key-lookup/#comments</comments>
		<pubDate>Thu, 13 May 2010 01:30:05 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Index]]></category>
		<category><![CDATA[SQL Optimization]]></category>
		<category><![CDATA[SQL Performance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLAuthority News]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8954</guid>
		<description><![CDATA[Recently, I have observed that not many people have proper understanding of what is bookmark lookup or key lookup. Increasing numbers of the questions tells me that this is something that developers encounter every single day, but have no idea how to deal with. I have previously written three posts on this subject. All those [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=8954&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Recently, I have observed that not many people have proper understanding of what is bookmark lookup or key lookup. Increasing numbers of the questions tells me that this is something that developers encounter every single day, but have no idea how to deal with. I have previously written three posts on this subject. All those who are looking for further information can check out the following three posts.</p>
<p style="text-align:justify;"><strong><a href="http://blog.sqlauthority.com/2009/10/07/sql-server-query-optimization-remove-bookmark-lookup-remove-rid-lookup-remove-key-lookup/" target="_blank">SQL SERVER – Query Optimization – Remove Bookmark  Lookup – Remove RID Lookup – Remove Key Lookup</a></strong></p>
<p style="text-align:justify;"><strong><a href="http://blog.sqlauthority.com/2009/10/08/sql-server-query-optimization-remove-bookmark-lookup-remove-rid-lookup-remove-key-lookup-part-2/" target="_blank">SQL SERVER – Query Optimization – Remove Bookmark  Lookup – Remove RID Lookup – Remove Key Lookup – Part 2</a></strong></p>
<p style="text-align:justify;"><strong><a href="http://blog.sqlauthority.com/2009/10/12/sql-server-query-optimization-remove-bookmark-lookup-remove-rid-lookup-remove-key-lookup-part-3/" target="_blank">SQL SERVER – Query Optimization – Remove Bookmark   Lookup – Remove RID Lookup – Remove Key Lookup – Part 3</a></strong></p>
<p style="text-align:justify;"><strong><a href="http://blog.sqlauthority.com/2009/09/29/sql-server-interesting-observation-execution-plan-and-results-of-aggregate-concatenation-queries/" target="_blank">SQL  SERVER &#8211; Interesting Observation &#8211; Execution Plan and Results of  Aggregate Concatenation Queries </a></strong></p>
<p style="text-align:justify;">In one of my recent classes, we had an in-depth conversation on what are the alternatives of creating covering indexes to remove the bookmark lookup. I really want to keep this question open to all of you and see what community thinks about the same. Is there any way other than creating a covering index or included index to remove this expensive keylookup?</p>
<p style="text-align:justify;">Reference: <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.sqlauthority.com</strong></a><strong>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/sql-index/'>SQL Index</a>, <a href='http://blog.sqlauthority.com/category/sql-optimization/'>SQL Optimization</a>, <a href='http://blog.sqlauthority.com/category/sql-performance/'>SQL Performance</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/sqlauthority/sqlauthority-news/'>SQLAuthority News</a>, <a href='http://blog.sqlauthority.com/category/sqlserver/'>SQLServer</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/8954/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/8954/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/8954/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/8954/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/8954/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/8954/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/8954/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/8954/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/8954/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/8954/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/8954/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/8954/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/8954/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/8954/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=8954&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/05/13/sql-server-four-posts-on-removing-the-bookmark-lookup-key-lookup/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; SHRINKFILE and TRUNCATE Log File in SQL Server 2008</title>
		<link>http://blog.sqlauthority.com/2010/05/03/sql-server-shrinkfile-and-truncate-log-file-in-sql-server-2008/</link>
		<comments>http://blog.sqlauthority.com/2010/05/03/sql-server-shrinkfile-and-truncate-log-file-in-sql-server-2008/#comments</comments>
		<pubDate>Mon, 03 May 2010 01:30:21 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Data Storage]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8861</guid>
		<description><![CDATA[Note: Please read the complete post before taking any actions. This blog post would discuss SHRINKFILE and TRUNCATE Log File. The script mentioned in the email received from reader contains the following questionable code: &#8220;Hi Pinal, If you could remember, I and my manager met you at TechEd in Bangalore. We just upgraded to SQL [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=8861&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;"><em>Note:</em> Please read the complete post before taking any actions.</p>
<p style="text-align:justify;">This blog post would discuss SHRINKFILE and TRUNCATE Log File. The script mentioned in the email received from reader contains the following questionable code:</p>
<p style="text-align:justify;padding-left:30px;">&#8220;Hi Pinal,</p>
<p style="text-align:justify;padding-left:30px;">If you could remember, I and my manager met you at TechEd in Bangalore.</p>
<p style="text-align:justify;padding-left:30px;">We just upgraded to SQL Server 2008. One of our jobs failed as it was using the following code.</p>
<p style="text-align:justify;padding-left:30px;">The error was:</p>
<p style="text-align:justify;padding-left:30px;"><span style="color:#ff0000;">Msg 155, Level 15, State 1, Line 1<br />
&#8216;TRUNCATE_ONLY&#8217; is not a recognized BACKUP option.</span></p>
<p style="text-align:justify;padding-left:30px;">The code was:</p>
<p style="text-align:justify;padding-left:30px;"><code style="font-size:12px;"><span style="color:blue;">DBCC </span><span style="color:black;">SHRINKFILE</span><span style="color:gray;">(</span><span style="color:black;">TestDBLog</span><span style="color:gray;">, </span><span style="color:black;">1</span><span style="color:gray;">)<br />
</span><span style="color:blue;">BACKUP </span><span style="color:magenta;">LOG </span><span style="color:black;">TestDB </span><span style="color:blue;">WITH </span><span style="color:black;">TRUNCATE_ONLY<br />
</span><span style="color:blue;">DBCC </span><span style="color:black;">SHRINKFILE</span><span style="color:gray;">(</span><span style="color:black;">TestDBLog</span><span style="color:gray;">, </span><span style="color:black;">1</span><span style="color:gray;">)<br />
</span><span style="color:black;">GO </span></code></p>
<p style="text-align:justify;padding-left:30px;">I have modified that code to subsequent code and it works fine. But, are there other suggestions you have at the moment?</p>
<p style="text-align:justify;padding-left:30px;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">[master]<br />
GO<br />
</span><span style="color:blue;">ALTER DATABASE </span><span style="color:black;">[TestDb] </span><span style="color:blue;">SET </span><span style="color:black;">RECOVERY SIMPLE </span><span style="color:blue;">WITH </span><span style="color:black;">NO_WAIT<br />
</span><span style="color:blue;">DBCC </span><span style="color:black;">SHRINKFILE</span><span style="color:gray;">(</span><span style="color:black;">TestDbLog</span><span style="color:gray;">, </span><span style="color:black;">1</span><span style="color:gray;">)<br />
</span><span style="color:blue;">ALTER DATABASE </span><span style="color:black;">[TestDb] </span><span style="color:blue;">SET </span><span style="color:black;">RECOVERY </span><span style="color:blue;">FULL WITH </span><span style="color:black;">NO_WAIT<br />
GO</span></code></p>
<p style="text-align:justify;padding-left:30px;">Configuration of our server and system is as follows:</p>
<p style="text-align:justify;padding-left:30px;">[Removed not relevant data]&#8220;</p>
<p style="text-align:justify;">An email like this that suddenly pops out in early morning is alarming email. Because I am a dead, busy mind, so I had only one min to reply. I wrote down quickly the following note. (As I said, it was a single-minute email so it is not completely accurate). Here is that quick email shared with all of you.</p>
<p style="text-align:justify;">&#8220;Hi Mr. DBA [removed the name]</p>
<p style="text-align:justify;">Thanks for your email. I suggest you stop this practice. There are many issues included here, but I would list two major issues:</p>
<p style="text-align:justify;">1) From the setting database to simple recovery, shrinking the file and once again setting in full recovery, you are in fact losing your valuable log data and will be not able to restore point in time. Not only that, you will also not able to use subsequent log files.</p>
<p style="text-align:justify;">2) Shrinking database file or database adds fragmentation.</p>
<p style="text-align:justify;">There are a lot of things you can do. First, start taking proper log backup using following command instead of truncating them and losing them frequently.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">BACKUP </span><span style="color:magenta;">LOG </span><span style="color:black;">[TestDb] </span><span style="color:blue;">TO  DISK = </span><span style="color:red;">N'C:\Backup\TestDb.bak'<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;">Remove the code of SHRINKING the file. If you are taking proper log backups, your log file usually (again usually, special cases are excluded) do not grow very big.</p>
<p style="text-align:justify;">There are so many things to add here, but you can call me on my [phone number]. Before you call me, I suggest for accuracy you read <a href="http://www.sqlskills.com/BLOGS/PAUL/" target="_blank">Paul Randel</a>&#8216;s two posts <a href="http://www.sqlskills.com/BLOGS/PAUL/post/Why-you-should-not-shrink-your-data-files.aspx" target="_blank">here</a> and <a href="http://www.sqlskills.com/blogs/paul/post/backup-log-with-no_log-use-abuse-and-undocumented-trace-flags-to-stop-it.aspx" target="_blank">here</a> and <a href="http://www.brentozar.com/" target="_blank">Brent Ozar</a>&#8216;s Post <a href="http://sqlserverpedia.com/blog/sql-server-backup-and-restore/backup-log-with-truncate_only-like-a-bear-trap/" target="_blank">here</a>.</p>
<p style="text-align:justify;">Kind Regards,<br />
Pinal Dave&#8221;</p>
<p style="text-align:justify;">I guess this post is very much clear to you. Please leave your comments here. As mentioned, this is a very huge subject; I have just touched a tip of the ice-berg and have tried to point to authentic knowledge.</p>
<p style="text-align:justify;">Update: Small typo correction and small detail corrected based on feedback.</p>
<p style="text-align:justify;">Reference: <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/sql-data-storage/'>SQL Data Storage</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/8861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/8861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/8861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/8861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/8861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/8861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/8861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/8861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/8861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/8861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/8861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/8861/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/8861/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/8861/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=8861&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/05/03/sql-server-shrinkfile-and-truncate-log-file-in-sql-server-2008/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER – Attach mdf file without ldf file in Database</title>
		<link>http://blog.sqlauthority.com/2010/04/26/sql-server-attach-mdf-file-without-ldf-file-in-database/</link>
		<comments>http://blog.sqlauthority.com/2010/04/26/sql-server-attach-mdf-file-without-ldf-file-in-database/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 01:30:33 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Data Storage]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8709</guid>
		<description><![CDATA[Background Story: One of my friends recently called up and asked me if I had spare time to look at his database and give him a performance tuning advice. Because I had some free time to help him out, I said yes. I asked him to send me the details of his database structure and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=8709&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;"><strong>Background Story:</strong><br />
One of my friends recently called up and asked me if I had spare time to look at his database and give him a performance tuning advice. Because I had some free time to help him out, I said yes. I asked him to send me the details of his database structure and sample data. He said that since his database is in a very early stage and is small as of the moment, so he told me that he would like me to have a complete database. My response to him was “Sure! In that case, take a backup of the database and send it to me. I will restore it into my computer and play with it.”</p>
<p style="text-align:justify;">He did send me his database; however, his method made me write this quick note here. Instead of taking a full backup of the database and sending it to me, he sent me only the .mdf (primary database file). In fact, I asked for a complete backup (I wanted to review file groups, files, as well as few other details).  Upon calling my friend,  I found that he was not available. Now,  he left me with only a .mdf file. As I had some extra time, I decided to checkout his database structure and get back to him regarding the full backup, whenever I can get in touch with him again.</p>
<p style="text-align:justify;"><strong>Technical Talk: </strong><br />
If the database is shutdown gracefully and there was no abrupt shutdown (power outrages, pulling plugs to machines, machine crashes or any other reasons), it is <em>possible </em>(there’s no guarantee) to attach .mdf file only to the server. Please note that there can be many more reasons for a database that is not getting attached or restored. In my case, the database had a clean shutdown and there were no complex issues. I was able to recreate a transaction log file and attached the received .mdf file.</p>
<p style="text-align:justify;">There are multiple ways of doing this. I am listing all of them here. Before using any of them, please consult the Domain Expert in your company or industry. Also, never attempt this on live/production server without the presence of a Disaster Recovery expert.<strong> </strong></p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">[master]<br />
GO<br />
</span><span style="color:green;">-- Method 1: I use this method<br />
</span><span style="color:blue;">EXEC </span><span style="color:darkred;">sp_attach_single_file_db </span><span style="color:#434343;">@dbname</span><span style="color:blue;">=</span><span style="color:red;">'TestDb'</span><span style="color:gray;">,<br />
</span><span style="color:#434343;">@physname</span><span style="color:blue;">=</span><span style="color:red;">N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\TestDb.mdf'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Method 2:<br />
</span><span style="color:blue;">CREATE DATABASE </span><span style="color:black;">TestDb </span><span style="color:blue;">ON<br />
</span><span style="color:gray;">(</span><span style="color:black;">FILENAME </span><span style="color:blue;">= </span><span style="color:red;">N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\TestDb.mdf'</span><span style="color:gray;">)<br />
</span><span style="color:blue;">FOR </span><span style="color:black;">ATTACH_REBUILD_LOG<br />
GO</span></code></p>
<p style="text-align:justify;">Method 2: If one or more log files are missing, they are recreated again.</p>
<p style="text-align:justify;">There is one more method which I am demonstrating here but<em> I</em> <em>have not used myself before</em>. According to Book Online, it will work only if there is one log file that is missing. If there are more than one log files involved, all of them are required to undergo the same procedure.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">-- Method 3:<br />
</span><span style="color:blue;">CREATE DATABASE </span><span style="color:black;">TestDb </span><span style="color:blue;">ON<br />
</span><span style="color:gray;">( </span><span style="color:black;">FILENAME </span><span style="color:blue;">= </span><span style="color:red;">N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\TestDb.mdf'</span><span style="color:gray;">)<br />
</span><span style="color:blue;">FOR </span><span style="color:black;">ATTACH<br />
GO<br />
</span></code></p>
<p style="text-align:justify;">Please read the <a href="http://technet.microsoft.com/en-us/library/ms176061.aspx" target="_blank">Book Online</a> in depth and consult DR experts before working on the production server. In my case, the above syntax just worked fine as the database was clean when it was detached. Feel free to write your opinions and experiences for it will help the IT community to learn more from your suggestions and skills.</p>
<p style="text-align:justify;">Reference: <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<p style="text-align:justify;">
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/readers-question/'>Readers Question</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/sql-data-storage/'>SQL Data Storage</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/8709/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/8709/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/8709/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/8709/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/8709/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/8709/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/8709/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/8709/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/8709/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/8709/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/8709/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/8709/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/8709/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/8709/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=8709&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/04/26/sql-server-attach-mdf-file-without-ldf-file-in-database/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; Retrieve and Explore Database Backup without Restoring Database &#8211; Idera virtual database</title>
		<link>http://blog.sqlauthority.com/2010/04/06/sql-server-retrieve-and-explore-database-backup-without-restoring-database-idera-virtual-database/</link>
		<comments>http://blog.sqlauthority.com/2010/04/06/sql-server-retrieve-and-explore-database-backup-without-restoring-database-idera-virtual-database/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 01:30:28 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Add-On]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Data Storage]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQL Utility]]></category>
		<category><![CDATA[SQLAuthority News]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Idera]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8172</guid>
		<description><![CDATA[I recently downloaded Idera’s SQL virtual database, and tested it. There are a few things about this tool which caught my attention. My Scenario It is quite common in real life that sometimes observing or retrieving older data is necessary; however, it had changed as time passed by. The full database backup was 40 GB [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=8172&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I recently downloaded Idera’s SQL <a href="http://www.idera.com/?s=BN_SQLAuth" target="_blank"><strong>virtual database</strong></a>, and tested it. There are a few things about this tool which caught my attention.</p>
<p style="text-align:justify;"><strong>My Scenario</strong></p>
<p style="text-align:justify;">It is quite common in real life that sometimes observing or retrieving older data is necessary; however, it had changed as time passed by. The full database backup was 40 GB in size, and, to restore it on our production server, it usually takes around 16 to 22 minutes, depending on the load server that is usually present. This range in time varies from one server to another as per the configuration of the computer. Some other issues we used to have are the following:</p>
<ol style="text-align:justify;">
<li>When we try to restore a large 40-GB database, we needed at      least that much space on our production server.</li>
<li>Once in a while, we even had to make changes in the restored      database, and use the said changed and restored database for our purpose,      making it more time-consuming.</li>
</ol>
<p style="text-align:justify;"><strong>My Solution</strong></p>
<p style="text-align:justify;">I have heard a lot about the Idera’s SQL <a href="http://www.idera.com/?s=BN_SQLAuth" target="_blank"><strong>virtual database</strong></a> tool.. Well, right after we started to test this tool, we found out that it really delivers what it promises. Using this software was very easy and we were able to restore our database from backup in less than 2 minutes, sparing us from the usual longer time of 16–22 minutes. The needful was finished in a total of 10 minutes. Another interesting observation is that there is no need to have an additional space for restoring the database. For complete database restoration, the single additional MB on the drive is not required anymore. We can use the database in the same way as our regular database, and there is no need for any additional configuration and setup.</p>
<p style="text-align:justify;">Let us look at the most relevant points of this product based on my initial experience:</p>
<ul style="text-align:justify;">
<li>Quick restoration of the database backup</li>
<li>No additional space required for database restoration</li>
<li>virtual database has no physical .MDF or .LDF</li>
<li>The database which is restored is, in fact, the backup file      converted in the virtual database. DDL and DML queries can be executed      against this virtually restored database.</li>
<li>Regular backup operation can be implemented against virtual      database, creating a physical .bak file that can be used for future use.</li>
<li>There was no observed degradation in performance on the      original database as well the restored virtual database.</li>
<li>Additional T-SQL queries can be let off on the virtual database.</li>
</ul>
<p style="text-align:justify;">Well, this summarizes my quick review. And, as I was saying, I am very impressed with the product and I plan to explore it more. There are many features that I have noticed in this tool, which I think can be very useful if properly understood.</p>
<p style="text-align:justify;">I had taken a few screenshots using my demo database afterwards. Let us see what other things this tool can do besides the mentioned activities. I am surprised with its performance so I want to know how exactly this feature works, specifically in the matter of why it does not create any additional files and yet, it still allows update on the virtually restored database. I guess I will have to send an e-mail to the developers of Idera and try to figure this out from them.</p>
<p style="text-align:justify;">I think this tool is very useful, and it delivers a high level of performance way more than what I expected. Soon, I will write a review for additional uses of SQL virtual database.. If you are using SQL virtual database in your production environment, I am eager to learn more about it and your experience while using it.</p>
<p style="text-align:justify;"><strong>The &#8216;Virtual&#8217; Part of virtual database</strong></p>
<p style="text-align:justify;">When I set out to test this software, I thought virtual database had something to do with Hyper-V or visualization. In fact, the virtual database is a kind of database which shows up in your SQL Server Management Studio without actually restoring or even creating it. This tool creates a database in SSMS from the backup of the same database. The backup, however, works virtually the same way as original database.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/virtualdb1.jpg" alt="" width="395" height="254" /></p>
<p style="text-align:justify;"><strong><em>Potential Usage of virtual database:</em></strong></p>
<p style="text-align:justify;">As soon as I described this tool to my teammate, I think his very first reaction was, “hey, if we have this then there is no need for log shipping.” I find his comment very interesting as log shipping is something where logs are moved to another server. In fact, there are no updates on the database from log; I would rather compare it with Snapshot Replication. In fact, whatever we use, snapshot replicated database can be similarly used and configured with virtual database. I totally believe that we can use it for reporting purpose. In fact, after this database was configured, I think the uses of this tool are unlimited. I will have to spend some more time studying it and will get back to you.</p>
<p style="text-align:justify;"><em><strong>Click on images to see larger images.</strong></em></p>
<div class="mceTemp" style="text-align:justify;">
<dl class="wp-caption alignnone">
<dt class="wp-caption-dt"><a title="virtual database Console" href="http://www.pinaldave.com/bimg/idera/vdb1.jpg"><img title="virtual database Console" src="http://www.pinaldave.com/bimg/idera/vdb1.jpg" alt="" width="500" height="309" /></a></dt>
<dd class="wp-caption-dd">virtual database Console</dd>
</dl>
</div>
<div class="mceTemp" style="text-align:justify;">
<dl class="wp-caption alignnone">
<dt class="wp-caption-dt"><a title="Harddrive Space before virtual database Setup" href="http://www.pinaldave.com/bimg/idera/vdb2.jpg"><img class=" " title="Harddrive Space before virtual database Setup" src="http://www.pinaldave.com/bimg/idera/vdb2.jpg" alt="" width="500" height="100" /></a></dt>
<dd class="wp-caption-dd">Harddrive Space before virtual database Setup</dd>
</dl>
</div>
<div class="mceTemp" style="text-align:justify;">
<dl class="wp-caption alignnone">
<dt class="wp-caption-dt"><a title="Attach Full Backup Screen" href="http://www.pinaldave.com/bimg/idera/vdb3.jpg"><img title="Attach Full Backup Screen" src="http://www.pinaldave.com/bimg/idera/vdb3.jpg" alt="" width="500" height="224" /></a></dt>
<dd class="wp-caption-dd">Attach Full Backup Screen</dd>
</dl>
</div>
<div class="mceTemp" style="text-align:justify;">
<dl class="wp-caption alignnone">
<dt class="wp-caption-dt"><a title="Backup on Harddrive" href="http://www.pinaldave.com/bimg/idera/vdb4.jpg"><img title="Backup on Harddrive" src="http://www.pinaldave.com/bimg/idera/vdb4.jpg" alt="" width="501" height="397" /></a></dt>
<dd class="wp-caption-dd">Backup on Harddrive</dd>
</dl>
</div>
<div class="mceTemp" style="text-align:justify;">
<dl class="wp-caption alignnone">
<dt class="wp-caption-dt"><a title="Attach Full Backup Screen with Settings" href="http://www.pinaldave.com/bimg/idera/vdb5.jpg"><img title="Attach Full Backup Screen with Settings" src="http://www.pinaldave.com/bimg/idera/vdb5.jpg" alt="" width="500" height="224" /></a></dt>
<dd class="wp-caption-dd">Attach Full Backup Screen with Settings</dd>
</dl>
</div>
<div class="mceTemp" style="text-align:justify;">
<dl class="wp-caption alignnone">
<dt class="wp-caption-dt"><a title="virtual database Setup - less than 60 sec" href="http://www.pinaldave.com/bimg/idera/vdb6.jpg"><img title="virtual database Setup - less than 60 sec" src="http://www.pinaldave.com/bimg/idera/vdb6.jpg" alt="" width="499" height="307" /></a></dt>
<dd class="wp-caption-dd">virtual database Setup &#8211; less than 60 sec</dd>
</dl>
</div>
<div class="mceTemp" style="text-align:justify;">
<dl class="wp-caption alignnone">
<dt class="wp-caption-dt"><a title="virtual database Setup - Online" href="http://www.pinaldave.com/bimg/idera/vdb7.jpg"><img title="virtual database Setup - Online" src="http://www.pinaldave.com/bimg/idera/vdb7.jpg" alt="" width="501" height="311" /></a></dt>
<dd class="wp-caption-dd">virtual database Setup &#8211; Online</dd>
</dl>
</div>
<div class="mceTemp" style="text-align:justify;">
<dl class="wp-caption alignnone">
<dt class="wp-caption-dt"><a title="Harddrive Space after virtual database Setup" href="http://www.pinaldave.com/bimg/idera/vdb2.jpg"><img title="Harddrive Space after virtual database Setup" src="http://www.pinaldave.com/bimg/idera/vdb2.jpg" alt="" width="500" height="100" /></a></dt>
<dd class="wp-caption-dd">Harddrive Space after virtual database Setup</dd>
</dl>
</div>
<div class="mceTemp" style="text-align:justify;">
<dl class="wp-caption alignnone">
<dt class="wp-caption-dt"><a title="Point in Time Recovery Option - Timeline View" href="http://www.pinaldave.com/bimg/idera/vdb9.jpg"><img title="Point in Time Recovery Option - Timeline View" src="http://www.pinaldave.com/bimg/idera/vdb9.jpg" alt="" width="499" height="328" /></a></dt>
<dd class="wp-caption-dd">Point in Time Recovery Option &#8211; Timeline View</dd>
</dl>
</div>
<div class="mceTemp" style="text-align:justify;">
<dl class="wp-caption alignnone">
<dt class="wp-caption-dt"><a title="virtual database Summary" href="http://www.pinaldave.com/bimg/idera/vdb10.jpg"><img title="virtual database Summary" src="http://www.pinaldave.com/bimg/idera/vdb10.jpg" alt="" width="499" height="327" /></a></dt>
<dd class="wp-caption-dd">virtual database Summary</dd>
</dl>
</div>
<div class="mceTemp" style="text-align:justify;">
<dl class="wp-caption alignnone">
<dt class="wp-caption-dt"><a title="No Performance Difference between Regular DB vs Virtual DB" href="http://www.pinaldave.com/bimg/idera/vdb11.jpg"><img title="No Performance Difference between Regular DB vs Virtual DB" src="http://www.pinaldave.com/bimg/idera/vdb11.jpg" alt="" width="500" height="472" /></a></dt>
<dd class="wp-caption-dd">No Performance Difference between Regular DB vs Virtual DB</dd>
</dl>
</div>
<p style="text-align:justify;">Please note that all SQL Server MVP gets free license of this software.</p>
<p style="text-align:justify;">Reference: <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>), Idera (</strong><a href="http://www.idera.com/?s=BN_SQLAuth" target="_blank"><strong>virtual database</strong></a>)</p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/database/'>Database</a>, <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/sql-add-on/'>SQL Add-On</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/sql-data-storage/'>SQL Data Storage</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/sql-utility/'>SQL Utility</a>, <a href='http://blog.sqlauthority.com/category/sqlauthority/sqlauthority-news/'>SQLAuthority News</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a> Tagged: <a href='http://blog.sqlauthority.com/tag/idera/'>Idera</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/8172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/8172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/8172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/8172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/8172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/8172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/8172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/8172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/8172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/8172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/8172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/8172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/8172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/8172/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=8172&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/04/06/sql-server-retrieve-and-explore-database-backup-without-restoring-database-idera-virtual-database/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/virtualdb1.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/idera/vdb1.jpg" medium="image">
			<media:title type="html">virtual database Console</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/idera/vdb2.jpg" medium="image">
			<media:title type="html">Harddrive Space before virtual database Setup</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/idera/vdb3.jpg" medium="image">
			<media:title type="html">Attach Full Backup Screen</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/idera/vdb4.jpg" medium="image">
			<media:title type="html">Backup on Harddrive</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/idera/vdb5.jpg" medium="image">
			<media:title type="html">Attach Full Backup Screen with Settings</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/idera/vdb6.jpg" medium="image">
			<media:title type="html">virtual database Setup - less than 60 sec</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/idera/vdb7.jpg" medium="image">
			<media:title type="html">virtual database Setup - Online</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/idera/vdb2.jpg" medium="image">
			<media:title type="html">Harddrive Space after virtual database Setup</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/idera/vdb9.jpg" medium="image">
			<media:title type="html">Point in Time Recovery Option - Timeline View</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/idera/vdb10.jpg" medium="image">
			<media:title type="html">virtual database Summary</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/idera/vdb11.jpg" medium="image">
			<media:title type="html">No Performance Difference between Regular DB vs Virtual DB</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL SERVER &#8211; 2008 &#8211; Introduction to Snapshot Database &#8211; Restore From Snapshot</title>
		<link>http://blog.sqlauthority.com/2010/04/05/sql-server-2008-introduction-to-snapshot-database-restore-from-snapshot/</link>
		<comments>http://blog.sqlauthority.com/2010/04/05/sql-server-2008-introduction-to-snapshot-database-restore-from-snapshot/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 01:30:40 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Data Storage]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[SQLServer]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8502</guid>
		<description><![CDATA[Snapshot database is one of the most interesting concepts that I have used at some places recently. Here is a quick definition of the subject from Book On Line: A Database Snapshot is a read-only, static view of a database (the source database). Multiple snapshots can exist on a source database and can always reside [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=8502&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">Snapshot database is one of the most interesting concepts that I have used at some places recently.</p>
<p style="text-align:justify;">Here is a quick definition of the subject from <a href="http://msdn.microsoft.com/en-us/library/ms175158.aspx" target="_blank">Book On Line</a>:</p>
<p style="text-align:justify;">A Database Snapshot is a read-only, static view of a database (the <em>source database</em>). Multiple snapshots can exist on a source database and can always reside on the same server instance as the database. Each database snapshot is consistent, in terms of transactions, with the source database as of the moment of the snapshot&#8217;s creation. A snapshot persists until it is explicitly dropped by the database owner.</p>
<p style="text-align:justify;">If you do not know how Snapshot database work, here is a quick note on the subject. However, please refer to the official description on Book-on-Line for accuracy. Snapshot database is a read-only database created from an original database called the “source database”. This database operates at page level. When Snapshot database is created, it is produced on sparse files; in fact, it does not occupy any space (or occupies very little space) in the Operating System. When any data page is modified in the source database, that data page is copied to Snapshot database, making the sparse file size increases. When an unmodified data page is read in the Snapshot database, it actually reads the pages of the original database. In other words, the changes that happen in the source database are reflected in the Snapshot database.</p>
<p style="text-align:justify;">Let us see a simple example of Snapshot. In the following exercise, we will do a few operations. Please note that this script is for demo purposes only- there are a few considerations of CPU, DISK I/O and memory, which will be discussed in the future posts.</p>
<ul style="text-align:justify;">
<li>Create Snapshot</li>
<li>Delete Data from Original DB</li>
<li>Restore Data from Snapshot</li>
</ul>
<p style="text-align:justify;">First, let us create the first Snapshot database and observe the sparse file details.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">master<br />
GO<br />
</span><span style="color:green;">-- Create Regular Database<br />
</span><span style="color:blue;">CREATE DATABASE </span><span style="color:black;">RegularDB<br />
GO<br />
</span><span style="color:blue;">USE </span><span style="color:black;">RegularDB<br />
GO<br />
</span><span style="color:green;">-- Populate Regular Database with Sample Table<br />
</span><span style="color:blue;">CREATE TABLE </span><span style="color:black;">FirstTable </span><span style="color:gray;">(</span><span style="color:black;">ID </span><span style="color:blue;">INT</span><span style="color:gray;">, </span><span style="color:black;">Value </span><span style="color:blue;">VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">10</span><span style="color:gray;">))<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">FirstTable </span><span style="color:blue;">VALUES</span><span style="color:gray;">(</span><span style="color:black;">1</span><span style="color:gray;">, </span><span style="color:red;">'First'</span><span style="color:gray;">);<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">FirstTable </span><span style="color:blue;">VALUES</span><span style="color:gray;">(</span><span style="color:black;">2</span><span style="color:gray;">, </span><span style="color:red;">'Second'</span><span style="color:gray;">);<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">FirstTable </span><span style="color:blue;">VALUES</span><span style="color:gray;">(</span><span style="color:black;">3</span><span style="color:gray;">, </span><span style="color:red;">'Third'</span><span style="color:gray;">);<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Create Snapshot Database<br />
</span><span style="color:blue;">CREATE DATABASE </span><span style="color:black;">SnapshotDB </span><span style="color:blue;">ON<br />
</span><span style="color:gray;">(</span><span style="color:black;">Name </span><span style="color:blue;">=</span><span style="color:red;">'RegularDB'</span><span style="color:gray;">,<br />
</span><span style="color:black;">FileName</span><span style="color:blue;">=</span><span style="color:red;">'c:\SSDB.ss1'</span><span style="color:gray;">)<br />
</span><span style="color:blue;">AS </span><span style="color:black;">SNAPSHOT </span><span style="color:blue;">OF </span><span style="color:black;">RegularDB</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Select from Regular and Snapshot Database<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">* </span><span style="color:blue;">FROM </span><span style="color:black;">RegularDB.dbo.FirstTable</span><span style="color:gray;">;<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">* </span><span style="color:blue;">FROM </span><span style="color:black;">SnapshotDB.dbo.FirstTable</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;">Now let us see the resultset for the same.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/snapshot1.jpg" alt="" width="500" height="286" /></p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/snapshot2.jpg" alt="" width="382" height="518" /></p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/snapshot3.jpg" alt="" width="380" height="522" /></p>
<p style="text-align:justify;">Now let us do delete something from the Original DB and check the same details we checked before.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">-- Delete from Regular Database<br />
</span><span style="color:blue;">DELETE FROM </span><span style="color:black;">RegularDB.dbo.FirstTable</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Select from Regular and Snapshot Database<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">* </span><span style="color:blue;">FROM </span><span style="color:black;">RegularDB.dbo.FirstTable</span><span style="color:gray;">;<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">* </span><span style="color:blue;">FROM </span><span style="color:black;">SnapshotDB.dbo.FirstTable</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;"> </span></code><img class="alignnone" src="http://www.pinaldave.com/bimg/snapshot4.jpg?" alt="" width="500" height="275" /></p>
<p style="text-align:justify;">When we check the details of sparse file created by Snapshot database, we will find some interesting details. The details of Regular DB remain the same.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/snapshot6.jpg" alt="" width="381" height="527" /></p>
<p style="text-align:justify;">It clearly shows that when we delete data from Regular/Source DB, it copies the data pages to Snapshot database. This is the reason why the size of the snapshot DB is increased.</p>
<p style="text-align:justify;">Now let us take this small exercise to  the next level and restore our deleted data from Snapshot DB to Original Source DB.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:green;">-- Restore Data from Snapshot Database<br />
</span><span style="color:blue;">USE </span><span style="color:black;">master<br />
GO<br />
</span><span style="color:blue;">RESTORE DATABASE </span><span style="color:black;">RegularDB<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">DATABASE_SNAPSHOT </span><span style="color:blue;">= </span><span style="color:red;">'SnapshotDB'</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Select from Regular and Snapshot Database<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">* </span><span style="color:blue;">FROM </span><span style="color:black;">RegularDB.dbo.FirstTable</span><span style="color:gray;">;<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">* </span><span style="color:blue;">FROM </span><span style="color:black;">SnapshotDB.dbo.FirstTable</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Clean up<br />
</span><span style="color:blue;">DROP DATABASE </span><span style="color:black;">[SnapshotDB]</span><span style="color:gray;">;<br />
</span><span style="color:blue;">DROP DATABASE </span><span style="color:black;">[RegularDB]</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO<br />
</span></code></p>
<p style="text-align:justify;">Now let us check the details of the select statement and we can see that we are successful able to restore the database from Snapshot Database.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/snapshot1.jpg" alt="" width="500" height="286" /></p>
<p style="text-align:justify;">We can clearly see that this is a very useful feature in case you would encounter a good business that needs it.</p>
<p style="text-align:justify;">I would like to request the readers to suggest more details if they are using this feature in their business. Also, let me know if you think it can be potentially used to achieve any tasks.</p>
<p style="text-align:justify;">Complete Script of the afore- mentioned operation for easy reference is as follows:</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">USE </span><span style="color:black;">master<br />
GO<br />
</span><span style="color:green;">-- Create Regular Database<br />
</span><span style="color:blue;">CREATE DATABASE </span><span style="color:black;">RegularDB<br />
GO<br />
</span><span style="color:blue;">USE </span><span style="color:black;">RegularDB<br />
GO<br />
</span><span style="color:green;">-- Populate Regular Database with Sample Table<br />
</span><span style="color:blue;">CREATE TABLE </span><span style="color:black;">FirstTable </span><span style="color:gray;">(</span><span style="color:black;">ID </span><span style="color:blue;">INT</span><span style="color:gray;">, </span><span style="color:black;">Value </span><span style="color:blue;">VARCHAR</span><span style="color:gray;">(</span><span style="color:black;">10</span><span style="color:gray;">))<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">FirstTable </span><span style="color:blue;">VALUES</span><span style="color:gray;">(</span><span style="color:black;">1</span><span style="color:gray;">, </span><span style="color:red;">'First'</span><span style="color:gray;">);<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">FirstTable </span><span style="color:blue;">VALUES</span><span style="color:gray;">(</span><span style="color:black;">2</span><span style="color:gray;">, </span><span style="color:red;">'Second'</span><span style="color:gray;">);<br />
</span><span style="color:blue;">INSERT INTO </span><span style="color:black;">FirstTable </span><span style="color:blue;">VALUES</span><span style="color:gray;">(</span><span style="color:black;">3</span><span style="color:gray;">, </span><span style="color:red;">'Third'</span><span style="color:gray;">);<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Create Snapshot Database<br />
</span><span style="color:blue;">CREATE DATABASE </span><span style="color:black;">SnapshotDB </span><span style="color:blue;">ON<br />
</span><span style="color:gray;">(</span><span style="color:black;">Name </span><span style="color:blue;">=</span><span style="color:red;">'RegularDB'</span><span style="color:gray;">,<br />
</span><span style="color:black;">FileName</span><span style="color:blue;">=</span><span style="color:red;">'c:\SSDB.ss1'</span><span style="color:gray;">)<br />
</span><span style="color:blue;">AS </span><span style="color:black;">SNAPSHOT </span><span style="color:blue;">OF </span><span style="color:black;">RegularDB</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Select from Regular and Snapshot Database<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">* </span><span style="color:blue;">FROM </span><span style="color:black;">RegularDB.dbo.FirstTable</span><span style="color:gray;">;<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">* </span><span style="color:blue;">FROM </span><span style="color:black;">SnapshotDB.dbo.FirstTable</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Delete from Regular Database<br />
</span><span style="color:blue;">DELETE FROM </span><span style="color:black;">RegularDB.dbo.FirstTable</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Select from Regular and Snapshot Database<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">* </span><span style="color:blue;">FROM </span><span style="color:black;">RegularDB.dbo.FirstTable</span><span style="color:gray;">;<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">* </span><span style="color:blue;">FROM </span><span style="color:black;">SnapshotDB.dbo.FirstTable</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Restore Data from Snapshot Database<br />
</span><span style="color:blue;">USE </span><span style="color:black;">master<br />
GO<br />
</span><span style="color:blue;">RESTORE DATABASE </span><span style="color:black;">RegularDB<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">DATABASE_SNAPSHOT </span><span style="color:blue;">= </span><span style="color:red;">'SnapshotDB'</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Select from Regular and Snapshot Database<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">* </span><span style="color:blue;">FROM </span><span style="color:black;">RegularDB.dbo.FirstTable</span><span style="color:gray;">;<br />
</span><span style="color:blue;">SELECT </span><span style="color:gray;">* </span><span style="color:blue;">FROM </span><span style="color:black;">SnapshotDB.dbo.FirstTable</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO<br />
</span><span style="color:green;">-- Clean up<br />
</span><span style="color:blue;">DROP DATABASE </span><span style="color:black;">[SnapshotDB]</span><span style="color:gray;">;<br />
</span><span style="color:blue;">DROP DATABASE </span><span style="color:black;">[RegularDB]</span><span style="color:gray;">;<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.SQLAuthority.com</a>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/sql-data-storage/'>SQL Data Storage</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/sqlserver/'>SQLServer</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/8502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/8502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/8502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/8502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/8502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/8502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/8502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/8502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/8502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/8502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/8502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/8502/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/8502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/8502/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=8502&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/04/05/sql-server-2008-introduction-to-snapshot-database-restore-from-snapshot/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/snapshot1.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/snapshot2.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/snapshot3.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/snapshot4.jpg?" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/snapshot6.jpg" medium="image" />

		<media:content url="http://www.pinaldave.com/bimg/snapshot1.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; FIX : ERROR : 4214 BACKUP LOG cannot be performed because there is no current database backup</title>
		<link>http://blog.sqlauthority.com/2010/03/27/sql-server-fix-error-4214-backup-log-cannot-be-performed-because-there-is-no-current-database-backup/</link>
		<comments>http://blog.sqlauthority.com/2010/03/27/sql-server-fix-error-4214-backup-log-cannot-be-performed-because-there-is-no-current-database-backup/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 01:30:15 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Error Messages]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL Log]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8303</guid>
		<description><![CDATA[I recently got following email from one of the reader. Hi Pinal, Even thought my database is in full recovery mode when I try to take log backup I am getting following error. BACKUP LOG cannot be performed because there is no current database backup. (Microsoft.SqlServer.Smo) How to fix it? Thanks, [name and email removed [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=8303&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I recently got following email from one of the reader.</p>
<p style="padding-left:30px;text-align:justify;"><em>Hi Pinal,</em></p>
<p style="padding-left:30px;text-align:justify;"><em>Even thought my database is in full recovery mode when I try to take log backup I am getting following error.</em></p>
<p style="padding-left:30px;text-align:justify;"><em><span style="color:#ff0000;">BACKUP LOG cannot be performed because there is no current database backup. (Microsoft.SqlServer.Smo)</span></em></p>
<p style="padding-left:30px;text-align:justify;"><em>How to fix it?</em></p>
<p style="padding-left:30px;text-align:justify;"><em>Thanks,<br />
[name and email removed as requested]</em></p>
<p style="text-align:justify;"><em><img class="alignnone" src="http://www.pinaldave.com/bimg/backuperror.jpg" alt="" width="500" height="140" /><br />
</em></p>
<p style="text-align:justify;"><strong>Solution / Fix:</strong></p>
<p style="text-align:justify;">This error can happen when you have never taken full backup of your database and you try to attempt to take backup of the log only. Take full backup once and attempt to take log back up. If the name of your database is MyTestDB follow procedure as following.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">BACKUP DATABASE </span><span style="color:black;">[MyTestDB]<br />
</span><span style="color:blue;">TO DISK = </span><span style="color:red;">N'C:\MyTestDB.bak'<br />
</span><span style="color:black;">GO<br />
</span><span style="color:blue;">BACKUP </span><span style="color:magenta;">LOG </span><span style="color:black;">[MyTestDB]<br />
</span><span style="color:blue;">TO DISK = </span><span style="color:red;">N'C:\MyTestDB.bak'<br />
</span><span style="color:black;">GO</span></code></p>
<p style="text-align:justify;">Reference: <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/sql-error-messages/'>SQL Error Messages</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a> Tagged: <a href='http://blog.sqlauthority.com/tag/sql-log/'>SQL Log</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/8303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/8303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/8303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/8303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/8303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/8303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/8303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/8303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/8303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/8303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/8303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/8303/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/8303/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/8303/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=8303&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/03/27/sql-server-fix-error-4214-backup-log-cannot-be-performed-because-there-is-no-current-database-backup/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/backuperror.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Fix : Error : 3117 : The log or differential backup cannot be restored because no files are ready to rollforward</title>
		<link>http://blog.sqlauthority.com/2010/03/21/sql-server-fix-error-3117-the-log-or-differential-backup-cannot-be-restored-because-no-files-are-ready-to-rollforward/</link>
		<comments>http://blog.sqlauthority.com/2010/03/21/sql-server-fix-error-3117-the-log-or-differential-backup-cannot-be-restored-because-no-files-are-ready-to-rollforward/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 01:30:28 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[Readers Question]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Error Messages]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=8254</guid>
		<description><![CDATA[I received the following email from one of my readers. Dear Pinal, I am new to SQL Server and our regular DBA is on vacation. Our production database had some problem and I have just restored full database backup to production server. When I try to apply log back I am getting following error. I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=8254&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">I received the following email from one of my readers.</p>
<p style="padding-left:30px;text-align:justify;"><em>Dear Pinal,</em></p>
<p style="padding-left:30px;text-align:justify;"><em>I am new to SQL Server and our regular DBA is on vacation. Our production database had some problem and I have just restored full database backup to production server. When I try to apply log back I am getting following error. I am sure, this is valid log backup file. Screenshot is attached.</em></p>
<p style="padding-left:30px;text-align:justify;"><em>[Few other details regarding server/ip address removed]</em></p>
<p style="padding-left:30px;text-align:justify;"><span style="color:#ff0000;"><em>Msg 3117, Level 16, State 1, Line 1<br />
The log or differential backup cannot be restored because no files are ready to roll forward.<br />
Msg 3013, Level 16, State 1, Line 1<br />
RESTORE LOG is terminating abnormally.</em></span></p>
<p style="padding-left:30px;text-align:justify;"><em>Screenshot attached. [Removed as it contained live IP address]</em></p>
<p style="padding-left:30px;text-align:justify;"><em>Please help immediately.</em></p>
<p style="text-align:justify;">Well I have answered this question in my earlier post, 2 years ago, over here <a href="http://blog.sqlauthority.com/2007/09/02/sql-server-fix-error-msg-3117-level-16-state-4-the-log-or-differential-backup-cannot-be-restored-because-no-files-are-ready-to-rollforward/" target="_blank">SQL SERVER – Fix : Error : Msg 3117, Level 16, State 4 The log or differential backup cannot be restored because no files are ready to rollforward</a>. However, I will try to explain it a little more this time.</p>
<p style="text-align:justify;">For SQL Server database to be used it should in online state. There are multiple states of SQL Server Database.</p>
<ul style="text-align:justify;">
<li>ONLINE      (Available &#8211; online for data)</li>
<li>OFFLINE</li>
<li>RESTORING</li>
<li>RECOVERING</li>
<li>RECOVERY      PENDING</li>
<li>SUSPECT</li>
<li>EMERGENCY      (Limited Availability)</li>
</ul>
<p style="text-align:justify;">If the database is online, it means it is active and in operational mode. It will not make sense to apply further log from backup if the operations have continued on this database. The common practice during the backup restore process is to specify the keyword RECOVERY when the database is restored. When RECOVERY keyword is specified, the SQL Server brings back the database online and will not accept any further log backups.</p>
<p style="text-align:justify;">However, if you want to restore more than one backup files, i.e. after restoring the full back up if you want to apply further differential or log backup you cannot do that when database is online and already active. You need to have your database in the state where it can further accept the backup data and not the online data request. If the SQL Server is online and also accepts database backup file, then there can be data inconsistency. This is the reason that when there are more than one database backup files to be restored, one has to restore the database with NO RECOVERY keyword in the RESTORE operation.</p>
<p style="text-align:justify;"><img class="alignnone" src="http://www.pinaldave.com/bimg/recoverybackup.jpg" alt="" width="436" height="201" /></p>
<p style="text-align:justify;">I suggest you all to read one more post written by me earlier. In this post, I explained the time line with image and graphic <a href="http://blog.sqlauthority.com/2009/07/14/sql-server-backup-timeline-and-understanding-of-database-restore-process-in-full-recovery-model/" target="_blank"><strong>SQL SERVER – Backup Timeline and Understanding of Database Restore Process in Full Recovery Model.</strong></a></p>
<p style="text-align:justify;">Sample Code for reference:</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">RESTORE DATABASE </span><span style="color:black;">AdventureWorks<br />
</span><span style="color:blue;">FROM DISK = </span><span style="color:red;">'C:\AdventureWorksFull.bak'<br />
</span><span style="color:blue;">WITH </span><span style="color:black;">NORECOVERY</span><span style="color:gray;">;<br />
</span><span style="color:blue;">RESTORE DATABASE </span><span style="color:black;">AdventureWorks<br />
</span><span style="color:blue;">FROM DISK = </span><span style="color:red;">'C:\AdventureWorksDiff.bak'<br />
</span><span style="color:blue;">WITH </span><span style="color:black;">RECOVERY</span><span style="color:gray;">;</span></code></p>
<p style="text-align:justify;">In this post, I am not trying to cover complete backup and recovery. I am just attempting to address one type of error and its resolution. Please test these scenarios on the development server. Playing with live database backup and recovery is always very crucial and needs to be properly planned. Leave a comment here if you need help with this subject.</p>
<p style="text-align:justify;"><strong>Similar Post:<br />
<a href="http://blog.sqlauthority.com/2009/07/15/sql-server-restore-sequence-and-understanding-norecovery-and-recovery/" target="_blank">SQL SERVER – Restore Sequence and Understanding NORECOVERY and RECOVERY</a></strong></p>
<p style="text-align:justify;">Note: We will cover Standby Server maintenance and Recovery in another blog post and it is intentionally, not covered this post.</p>
<p style="text-align:justify;">Reference : <strong>Pinal Dave (</strong><a href="http://blog.sqlauthority.com/" target="_blank"><strong>http://blog.SQLAuthority.com</strong></a><strong>)</strong></p>
<br />Filed under: <a href='http://blog.sqlauthority.com/category/tech/pinal-dave/'>Pinal Dave</a>, <a href='http://blog.sqlauthority.com/category/readers-question/'>Readers Question</a>, <a href='http://blog.sqlauthority.com/category/technology/sql/'>SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-authority/'>SQL Authority</a>, <a href='http://blog.sqlauthority.com/category/sql-backup-and-restore/'>SQL Backup and Restore</a>, <a href='http://blog.sqlauthority.com/category/sql-error-messages/'>SQL Error Messages</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-query/'>SQL Query</a>, <a href='http://blog.sqlauthority.com/category/tech/sql-scripts/'>SQL Scripts</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-server/'>SQL Server</a>, <a href='http://blog.sqlauthority.com/category/technology/sql-tips-and-tricks/'>SQL Tips and Tricks</a>, <a href='http://blog.sqlauthority.com/category/technology/t-sql/'>T SQL</a>, <a href='http://blog.sqlauthority.com/category/technology/'>Technology</a>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/8254/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/8254/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/8254/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/8254/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/8254/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/8254/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/8254/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/8254/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/8254/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/8254/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/8254/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/8254/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/8254/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/8254/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=8254&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/03/21/sql-server-fix-error-3117-the-log-or-differential-backup-cannot-be-restored-because-no-files-are-ready-to-rollforward/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>

		<media:content url="http://www.pinaldave.com/bimg/recoverybackup.jpg" medium="image" />
	</item>
		<item>
		<title>SQL SERVER &#8211; Find Location of Data File Using T-SQL</title>
		<link>http://blog.sqlauthority.com/2010/01/02/sql-server-find-location-of-data-file-using-t-sql/</link>
		<comments>http://blog.sqlauthority.com/2010/01/02/sql-server-find-location-of-data-file-using-t-sql/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 01:30:22 +0000</pubDate>
		<dc:creator>pinaldave</dc:creator>
				<category><![CDATA[Pinal Dave]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Authority]]></category>
		<category><![CDATA[SQL Backup and Restore]]></category>
		<category><![CDATA[SQL Data Storage]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Scripts]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Tips and Tricks]]></category>
		<category><![CDATA[T SQL]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=7669</guid>
		<description><![CDATA[While preparing for the training course of Microsoft SQL Server 2005/2008 Query Optimization and &#38; Performance Tuning, I needed to find out where my database files are stored on my hard drive. It is when following script came in handy. SELECT SUBSTRING(physical_name, 1, CHARINDEX(N'master.mdf', LOWER(physical_name)) - 1) DataFileLocation FROM master.sys.master_files WHERE database_id = 1 AND FILE_ID [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=7669&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">While preparing for the training course of <strong><a href="http://blog.sqlauthority.com/sql-server-performance-tuning/" target="_blank">Microsoft SQL Server 2005/2008 Query Optimization and &amp; Performance Tuning</a></strong>, I needed to find out where my database files are stored on my hard drive. It is when following script came in handy.</p>
<p style="text-align:justify;"><code style="font-size:12px;"><span style="color:blue;">SELECT </span><span style="color:magenta;">SUBSTRING</span><span style="color:gray;">(</span><span style="color:black;">physical_name</span><span style="color:gray;">, </span><span style="color:black;">1</span><span style="color:gray;">,<br />
</span><span style="color:blue;">CHARINDEX</span><span style="color:gray;">(</span><span style="color:red;">N'master.mdf'</span><span style="color:gray;">,<br />
</span><span style="color:magenta;">LOWER</span><span style="color:gray;">(</span><span style="color:black;">physical_name</span><span style="color:gray;">)) - </span><span style="color:black;">1</span><span style="color:gray;">) </span><span style="color:black;">DataFileLocation<br />
</span><span style="color:blue;">FROM </span><span style="color:black;">master.sys.master_files<br />
</span><span style="color:blue;">WHERE </span><span style="color:black;">database_id </span><span style="color:blue;">= </span><span style="color:black;">1 </span><span style="color:gray;">AND </span><span style="color:magenta;">FILE_ID </span><span style="color:blue;">= </span><span style="color:black;">1</span></code></p>
<p style="text-align:justify;"><strong><span style="color:black;">Resultset:</span></strong></p>
<pre style="text-align:justify;">DataFileLocation
--------------------------------------------------------------------------
C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\
(1 row(s) affected)</pre>
<p style="text-align:justify;">Above script provided exact location of where my data files of master database is. In fact, you can use it to find any other path of database as needed.</p>
<p style="text-align:justify;">Reference: <strong>Pinal Dave (<a href="http://blog.sqlauthority.com/" target="_blank">http://blog.SQLAuthority.com</a>)</strong></p>
<br />Posted in Pinal Dave, SQL, SQL Authority, SQL Backup and Restore, SQL Data Storage, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, T SQL, Technology  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sqlauthority.wordpress.com/7669/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sqlauthority.wordpress.com/7669/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sqlauthority.wordpress.com/7669/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sqlauthority.wordpress.com/7669/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sqlauthority.wordpress.com/7669/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sqlauthority.wordpress.com/7669/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sqlauthority.wordpress.com/7669/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sqlauthority.wordpress.com/7669/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sqlauthority.wordpress.com/7669/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sqlauthority.wordpress.com/7669/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sqlauthority.wordpress.com/7669/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sqlauthority.wordpress.com/7669/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sqlauthority.wordpress.com/7669/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sqlauthority.wordpress.com/7669/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.sqlauthority.com&amp;blog=668536&amp;post=7669&amp;subd=sqlauthority&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.sqlauthority.com/2010/01/02/sql-server-find-location-of-data-file-using-t-sql/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/48aa5a2264e8a27d802bb22ab6ccf688?s=96&#38;d=identicon" medium="image">
			<media:title type="html">pinaldave</media:title>
		</media:content>
	</item>
	</channel>
</rss>
