<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblogcasts.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>&amp;gt;  sum(its parts) : lsn</title><link>http://sqlblogcasts.com/blogs/justinl/archive/tags/lsn/default.aspx</link><description>Tags: lsn</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>Why use BACKUP...WITH COPY_ONLY?</title><link>http://sqlblogcasts.com/blogs/justinl/archive/2008/06/03/why-use-backup-with-copy-only.aspx</link><pubDate>Tue, 03 Jun 2008 17:49:00 GMT</pubDate><guid isPermaLink="false">fa8c4e8e-46a3-4193-8264-2c1a9cb3475d:10452</guid><dc:creator>JustinL</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://sqlblogcasts.com/blogs/justinl/rsscomments.aspx?PostID=10452</wfw:commentRss><comments>http://sqlblogcasts.com/blogs/justinl/archive/2008/06/03/why-use-backup-with-copy-only.aspx#comments</comments><description>&lt;p&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;New&amp;nbsp;in SQL Server 2005 - this BACKUP option doesn’t appear especially interesting from the description in Books Online - however could be really handy in some scenarios.&amp;nbsp; The benefit of using the COPY_ONLY option is that it &lt;strong&gt;&lt;span style="FONT-FAMILY:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;doesn&amp;#39;t break the backup chain&lt;/span&gt;&lt;/strong&gt; - so won&amp;#39;t disrupt the restore routine required for regular log, or differential backups.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;Periodic refreshes of non-production environments is really useful to maintain consistency and enable testers to use&amp;nbsp;live data for functional and performance testing.&amp;nbsp; The time when the COPY_ONLY option could be useful is when an ad hoc full backup is required to refresh a&amp;nbsp;development or pre-production environment.&amp;nbsp; Typically environments refreshes are an ad hoc task - run only&amp;nbsp;when needed.&amp;nbsp; &lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;Often the refresh requires a backup taken from production, copied and restored to a development or test server and the .BAK file is deleted.&amp;nbsp; &lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;However, if a T-SQL regular BACKUP DATABASE statement was used or a backup via Management Studio – the production database log chain will be disrupted.&amp;nbsp; &lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;Without the .BAK file taken during this ad hoc backup - subsequent log and differential backup files are useless, (since they relate to the ad hoc full backup file).&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;
&lt;p&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;/span&gt;The situation can only be overcome by retaining the ad hoc backup until the next full backup has completed.&amp;nbsp; &lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;If a production restore were necessary, - this could add complication (and delay) as recovery documents could be inaccurate&amp;nbsp;and restore scripts may not complete since the backup file name and location could be different from expected.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;/span&gt;This situation can be avoided by using the COPY_ONLY option when the ad hoc backup is initially taken.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;The option will take a full backup (option can also be used with log – although not with differential backups too) without disrupting the backup chain – and means any production restore processes are valid.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;
&lt;p&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;This backup option will is useful since it means ad hoc backups won’t affect database recoverability – and&amp;nbsp;the .BAK files can be safely deleted once restored - avoiding a cluttered server!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;Justin Langford&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;"&gt;&lt;a class="" title="Coeo - The SQL Server Experts" href="http://www.coeo.com/"&gt;Coeo - The SQL Server Experts&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;img src="http://sqlblogcasts.com/aggbug.aspx?PostID=10452" width="1" height="1"&gt;</description><category domain="http://sqlblogcasts.com/blogs/justinl/archive/tags/best+practice/default.aspx">best practice</category><category domain="http://sqlblogcasts.com/blogs/justinl/archive/tags/lsn/default.aspx">lsn</category><category domain="http://sqlblogcasts.com/blogs/justinl/archive/tags/database+backup/default.aspx">database backup</category></item></channel></rss>