<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>recovery - Techyaz.com</title>
	<atom:link href="https://techyaz.com/tag/recovery/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>Tips, Tutorials and How-to Topics</description>
	<lastBuildDate>Tue, 15 May 2018 15:31:55 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>

<image>
	<url>https://techyaz.com/wp-content/uploads/2017/11/cropped-Site-icon-150x150.png</url>
	<title>recovery - Techyaz.com</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>SQL Server Backup &#038; Recovery Interview Questions &#038; Answers</title>
		<link>https://techyaz.com/interview-questions/sql-server-interview-questions/sql-server-backup-recovery-interview-questions-answers/</link>
					<comments>https://techyaz.com/interview-questions/sql-server-interview-questions/sql-server-backup-recovery-interview-questions-answers/#comments</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Wed, 11 Oct 2017 20:22:27 +0000</pubDate>
				<category><![CDATA[Backup & Recovery]]></category>
		<category><![CDATA[Interview Questions]]></category>
		<category><![CDATA[SQL Server Interview Questions]]></category>
		<category><![CDATA[Interview]]></category>
		<category><![CDATA[recovery]]></category>
		<category><![CDATA[restore]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=1054</guid>

					<description><![CDATA[<p>This article is based on SQL Server backup &#38; recovery interview questions and answers. You can access SQL Server Architecture based interview questions and General DBA related interview questions in attached links. Feel free to counter on any point that is&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/interview-questions/sql-server-interview-questions/sql-server-backup-recovery-interview-questions-answers/">SQL Server Backup &#038; Recovery Interview Questions &#038; Answers</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>This article is based on SQL Server backup &amp; recovery interview questions and answers. You can access <a href="http://techyaz.com/interview-questions/sql-server-interview-questions-answers-architecture/" target="_blank" rel="noopener">SQL Server Architecture based interview questions</a> and <a href="http://techyaz.com/interview-questions/sql-server-dba-interview-questions-answers/" target="_blank" rel="noopener">General DBA related interview questions</a> in attached links. Feel free to counter on any point that is not correct or where you are not agree. We will discuss and love to hear your expert advise. You can access <strong><a href="http://techyaz.com/category/interview-questions/sql-server-interview-questions/" target="_blank" rel="noopener">All SQL Server Interview Questions and Answers</a></strong> on different topics in attached link.</p>
<h3><span style="color: #333399;">SQL Server Backup &amp; Recovery Interview Questions</span></h3>
<p><strong>Question-</strong> <strong>What is Minimal Logging and how is it different from Full Logging?</strong></p>
<p><strong>Answer-</strong> Minimal logging involves logging only information that is required to recover the transaction without supporting <a href="http://techyaz.com/sql-server/point-in-time-recovery/" target="_blank" rel="noopener">point-in-time recovery</a>. Under the <a href="http://techyaz.com/sql-server/understanding-sql-server-recovery-model/" target="_blank" rel="noopener">full recovery model</a>, all bulk operations are fully logged. However, you can minimize logging for a set of bulk operations by switching the database to the <a href="http://techyaz.com/sql-server/understanding-sql-server-recovery-model/" target="_blank" rel="noopener">bulk-logged recovery model</a> temporarily for bulk operations.</p>
<p>Minimal logging is more efficient than full logging, and it reduces the possibility of a large-scale bulk operation filling the available <a href="http://techyaz.com/sql-server/understanding-transaction-log-architecture/" target="_blank" rel="noopener">transaction log</a> space during a bulk transaction. However, if the database is damaged or lost when minimal logging is in effect, you cannot recover the database to the point of failure.</p>
<p><img fetchpriority="high" decoding="async" class="wp-image-1059 alignleft" src="http://techyaz.com/wp-content/uploads/2017/10/Interview_QuestionsAnswers-300x284.jpg" alt="" width="378" height="358" srcset="https://techyaz.com/wp-content/uploads/2017/10/Interview_QuestionsAnswers-300x284.jpg 300w, https://techyaz.com/wp-content/uploads/2017/10/Interview_QuestionsAnswers.jpg 716w" sizes="(max-width: 378px) 100vw, 378px" /></p>
<p><strong>Question-</strong> <strong>Can you name few operations that logs Minimally during bulk-recovery model?</strong></p>
<p><strong>Answer-</strong> The following operations, which are fully logged under the full recovery model, are minimally logged under bulk-logged recovery model:</p>
<ol>
<li>Bulk import operations (bcp, BULK INSERT, and INSERT&#8230; SELECT).</li>
<li>SELECT INTO operations</li>
<li>CREATE INDEX operations</li>
<li>ALTER INDEX REBUILD or DBCC DBREINDEX operations.</li>
<li>DROP INDEX new heap rebuild</li>
</ol>
<p><strong>Question- If I change my database recovery model from FULL to SIMPLE, does transactions will be logged in to log file?</strong></p>
<p><strong>Answer-</strong> Yes, Transactions will be logged in SIMPLE recovery model as well. The difference is all logged transactions will be cleared during checkpoint operation in this recovery model. Read more about <a href="http://techyaz.com/sql-server/checkpoint/" target="_blank" rel="noopener">Checkpoint operations</a> &amp; <a href="http://techyaz.com/sql-server/understanding-sql-server-recovery-model/" target="_blank" rel="noopener">SQL Server Recovery Models</a>.</p>
<p><strong>Question-</strong> <strong>If yes in above question then how is SIMPLE RECOVERY Model different from FULL Recovery Model?</strong></p>
<p><strong>Answer-</strong> All logged transactions will be cleared during checkpoint operation and transaction log backup is not allowed so point-in-time recovery is not possible in SIMPLE recovery model. Whereas transaction backup is allowed in full recovery model and point-in-time recovery is also supported. Logs got cleared only after taking log backup or switching the recovery model to SIMPLE.</p>
<p><strong>Question-</strong> <strong>Can we achieve point-in-time recovery in Bulk-logged Recovery Model?</strong></p>
<p><strong>Answer-</strong> Yes, if there is no bulk operation performed on your database and you have all log backups. Point-in-time recovery is not possible if your recovery point falls falls in-between any bulk operations. .</p>
<p><strong>Question-</strong> <strong>How differential backup works?</strong> <strong>or</strong></p>
<p><strong>How differential backup captures only updated data since full backup in its dump file?</strong></p>
<p><strong>Answer-</strong> <a href="http://techyaz.com/sql-server/understanding-sql-server-data-files-pages-extents/" target="_blank" rel="noopener">Differential Changed Map</a> is a page type that stores information about extents that have changed since the last full backup. Database engine reads just the DCM pages to determine which extents have been modified and captures those extents in differential backup file.</p>
<p><strong>Question-</strong> <strong>Why cannot we serve copy-only backup  as a differential base or differential backup?</strong></p>
<p><strong>Answer-</strong> The differential changed map page is not updated by a <a href="http://techyaz.com/sql-server/understanding-sql-server-backups/" target="_blank" rel="noopener">copy-only backup</a>. Therefore, a copy-only backup cannot serve as a differential base or differential backup. A copy-only backup does not affect subsequent differential backups.</p>
<p><strong>Question-</strong> <strong>Why a database log file is growing like anything that is running in <a href="http://techyaz.com/sql-server/understanding-sql-server-recovery-model/" target="_blank" rel="noopener">SIMPLE Recovery Model</a>?</strong></p>
<p><strong>Answer-</strong> It means some transactions are active and running on your database.  As we know logs are captured in simple recovery model as well so that active transaction is getting logged there. The inactive portion in log file clears during checkpoint operation.</p>
<p><strong>Question- Can we restore a database till the specific time?</strong></p>
<p><strong>Answer-</strong> Yes, if database is running in full recovery model and database has log backups till that specific time. We can use STOPAT clause to recover till a specific time.</p>
<p><strong>Question-</strong> <strong>Suppose we are running Daily full backup at 8PM in night and every half an hour transaction log backup. Now your database is crashed at 3.41PM. How will you recover your database to the point it was crashed?</strong></p>
<p><strong>Answer- </strong>Below steps we will perform in a sequence manner to recover this database to the point it was crashed.</p>
<ul>
<li>First we will run <strong>tail log backup</strong> to capture all transactions that are not captured in previous log backups at the point database was crashed.</li>
<li>Restore last night<strong> Full backup</strong> with NORECOVERY that was taken at 8PM.</li>
<li>Apply <strong>all transaction log backup since last night full backup</strong> with norecovery.</li>
<li>Apply <strong>tail log backup</strong> on the database with recovery and with <strong>STOPAT</strong> parameter.<strong> </strong></li>
</ul>
<p><strong>Question- Take the same scenario as above, now you found that there is one log file let’s say at 2 PM got corrupted and not restorable. What will be the impact on your database recovery?</strong></p>
<p><strong>Answer-</strong>  We cannot recover this database till that point it was crashed and we would have last data till 1.30PM considering log backup runs on every half an hour.</p>
<p><strong>Question-</strong> <strong>Suppose we are running Weekly Sunday full backup at 8PM, daily differential backup at 10PM and every half an hour transaction log backup. Now your database is crashed on Saturday 3.11PM. What would be your fastest way to recover this database in point in time?</strong></p>
<p><strong>Answer-  </strong>We will perform below steps to recover this database in point-in-time:</p>
<ol>
<li>Try to run <strong>tail log backup</strong> at the point database was crashed.</li>
<li>Restore latest Weekly <strong>Sunday Full backup</strong> with NORECOVERY that was taken at 8PM.</li>
<li>Restore <strong>Friday night differential backup</strong> with NORECOVERY that was taken at 10PM.</li>
<li>Apply <strong>all transaction log backup since Friday differential backup</strong> with norecovery.</li>
<li>Apply <strong>tail log backup</strong> on the database with recovery and with <strong>STOPAT</strong> parameter.<strong> </strong></li>
</ol>
<p><strong>Question-</strong> <strong>In addition to above question, suppose you came to know that Friday night differential backup was corrupted then what would be your strategy to recovery the database in point-in time?</strong></p>
<p><strong>Answer- </strong>We will perform below steps to recover this database in point-in-time:</p>
<ol>
<li>Try to run <strong>tail log backup</strong> at the point database was crashed.</li>
<li>Restore latest Weekly <strong>Sunday Full backup</strong> with NORECOVERY that was taken at 8PM.</li>
<li>Restore <strong><span style="color: #ff0000;">Thursday </span>night differential backup</strong> with NORECOVERY that was taken at 10PM.</li>
<li>Apply <strong>all transaction log backup since <span style="color: #ff0000;">Thursday</span> night differential backup</strong> with norecovery.</li>
<li>Apply <strong>tail log backup</strong> on the database with recovery and with <strong>STOPAT</strong> parameter.<strong> </strong></li>
</ol>
<p><strong>Question-</strong> <strong>Suppose you came to know that differential backups ran on Monday and Wednesday are corrupted and you have only Tuesday and Thursday differential backups along with full backup and all log backups. Explain your sequence to restore the database?</strong></p>
<p><strong>Answer-</strong> We will follow same sequence that we follow in previous question. We will apply weekly full backup then Thursday differential backup along with all transaction log backups.</p>
<p><strong>Question-</strong> <strong>How will you restore tempdb?</strong></p>
<p><strong>Answer-</strong> We should not restore tempdb as it’s a temporary database and created everytime we restart SQL Server service.</p>
<p><strong>Question-</strong> <strong>What is COPY_ONLY full backup and how it is different from regular full backups?</strong></p>
<p><strong>Answer-</strong> Difference between regular full and copy-only full backup is that copy-only full backup does not break the differential chain. Neither of them breaks the log chain as neither of them truncates the log file. A copy-only backup cannot serve as a differential base or differential backup and does not affect the differential base.</p>
<p>Please Like, Share and comment us about your feedback. I hope you like this article. You can comment your questions in below section. Please follow our <a href="https://www.facebook.com/Techyaz/">facebook page</a> and <a href="https://twitter.com/Tech_yaz">Twitter </a>handle to get latest updates.</p>
<p><span style="color: #800000;"><em><strong>Read More Interview Q&amp;A:</strong></em></span></p>
<ul>
<li><strong><a href="http://techyaz.com/sql-server/alwayson/sql-server-alwayson-interview-questions-answers/" target="_blank" rel="noopener">SQL Server Interview Q&amp;A on Alwayson Availability Group</a></strong></li>
<li><strong><a href="http://techyaz.com/sql-server/sql-server-interview-questions-answers-indexes/" target="_blank" rel="noopener">SQL Server Interview Q&amp;A on Indexes</a></strong></li>
</ul>
<p>The post <a href="https://techyaz.com/interview-questions/sql-server-interview-questions/sql-server-backup-recovery-interview-questions-answers/">SQL Server Backup &#038; Recovery Interview Questions &#038; Answers</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/interview-questions/sql-server-interview-questions/sql-server-backup-recovery-interview-questions-answers/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Understanding SQL Server Backups</title>
		<link>https://techyaz.com/sql-server/backup-recovery/understanding-sql-server-backups/</link>
					<comments>https://techyaz.com/sql-server/backup-recovery/understanding-sql-server-backups/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Tue, 12 Sep 2017 07:14:28 +0000</pubDate>
				<category><![CDATA[Backup & Recovery]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administration]]></category>
		<category><![CDATA[Backups]]></category>
		<category><![CDATA[recovery]]></category>
		<category><![CDATA[restore]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=838</guid>

					<description><![CDATA[<p>SQL Server Backups are the dump of its databases that can be used to recover them in case of any corruption, outage or emergency. Backups are essential for data protection. We run SQL Server backups to safeguard our databases from&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/backup-recovery/understanding-sql-server-backups/">Understanding SQL Server Backups</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>SQL Server Backups are the dump of its databases that can be used to recover them in case of any corruption, outage or emergency. Backups are essential for data protection. We run SQL Server backups to safeguard our databases from user errors, media failure, hardware failure etc. There are multiple types of backups available in SQL Server.</p>
<ul>
<li>Full Backup</li>
<li>Differential Backup</li>
<li>Transaction Log Backup</li>
<li>Copy-Only Backup</li>
<li>File Backup</li>
<li>Partial Backup</li>
</ul>
<h3><span style="color: #000080;">Full Backup</span></h3>
<p>Full database backup captures dump of whole database including transaction logs. Full backup is supported in all three <a href="https://techyaz.com/sql-server/understanding-sql-server-recovery-model/" target="_blank" rel="noopener">recovery models</a>. Below is T-SQL script that can be used to run a full backup of SQL Server database.</p>
<pre><strong><span style="color: #008000;">-- Back up the TechYaz database to new media set.</span></strong>
 <strong> <span style="color: #0000ff;">BACKUP DATABASE TechYaz</span></strong>
 <strong><span style="color: #0000ff;"> TO DISK = 'D:\Backups\TechYaz_25Aug2017.bak'</span></strong>
 <strong><span style="color: #0000ff;"> WITH FORMAT;</span></strong>
 <strong><span style="color: #0000ff;"> GO</span></strong></pre>
<h3><span style="color: #000080;">Differential Backup</span></h3>
<p>A differential backup depends on the most recent full database backup. A differential backup captures only the data that has changed since that full backup. If your database does not have any full backup yet, you will not be able to run its differential backup. A base full backup is required to run the differential backup. Differential backup is faster because it does not capture full database dump but only the extents that are updated since last full backup.  Database engine reads details about updated extents from <a href="https://techyaz.com/sql-server/understanding-sql-server-data-files-pages-extents/" target="_blank" rel="noopener">Differential Changed Map</a> page type and capture those page ids only into the backup.  Read more about these page types on attached article. Differential backup can be used in all recovery models. Below is T-SQL script that can be used to run a differential backup of SQL Server database.</p>
<pre><strong><span style="color: #008000;">-- Create a full database backup first by running above commands.</span></strong>
 <strong><span style="color: #008000;"> -- Create a differential database backup</span></strong>
 <strong> <span style="color: #0000ff;">BACKUP DATABASE TechYaz</span></strong>
 <strong><span style="color: #0000ff;"> TO DISK= 'D:\Backups\TechYaz_25Aug2017.drn'</span></strong>
 <strong><span style="color: #0000ff;"> WITH DIFFERENTIAL;</span></strong>
 <strong><span style="color: #0000ff;"> GO</span></strong></pre>
<h3><span style="color: #000080;">Transaction Log Backup</span></h3>
<p>Transaction log backup works only in full and bulk-logged recovery model. We cannot run log backup in <a href="https://techyaz.com/sql-server/understanding-sql-server-recovery-model/" target="_blank" rel="noopener">simple recovery model</a>. We must have at least a full database backup to run transaction log backup. If full backup is not performed since the database creation, log backup cannot be executed. We should frequently run log backup to minimize work loss exposure and to truncate the <a href="https://techyaz.com/sql-server/understanding-transaction-log-architecture/" target="_blank" rel="noopener">transaction log</a> that make free space in database log file. Run below T-SQL code to run log backup.</p>
<pre><strong><span style="color: #008000;">-- Create a full database backup first.</span></strong>
 <strong><span style="color: #008000;"> -- Create a log database backup by running below command.</span></strong>
 <span style="color: #0000ff;"><strong> BACKUP LOG TechYaz</strong></span>
 <span style="color: #0000ff;"><strong> TO DISK = 'D:\Backups\TechYaz_25Aug2017.trn'</strong></span>
 <span style="color: #0000ff;"><strong> GO</strong></span></pre>
<h3><span style="color: #000080;">Copy Only Backup</span></h3>
<p>A copy-only backup is independent of the sequence of conventional SQL Server backups. It is just like conventional full backup without affecting the sequence of existing backup chain. Usually, taking a backup changes the database and affects how later backups are restored. However, occasionally, it is useful to take a backup for a special purpose without affecting the overall backup and restore procedures for the database. Copy-only backups serve this purpose. There are two types of copy-only backups.</p>
<ul>
<li>Copy-only full backup</li>
<li>Copy-only transaction log backup</li>
</ul>
<p>You cannot use copy-only full backup as a differential backup base. It means you cannot run differential backup considering copy only full backup as its base neither you can restore any differential backup on top of copy only full backup. A copy-only log backup preserves the existing log archive point and, therefore, does not affect the sequencing of regular log backups. The transaction log is never truncated after a copy-only backup.<br />
Copy-only backups are recorded in the is_copy_only column of the backupset table. Below T-SQL can be used to run copy only backups.</p>
<pre><strong><span style="color: #008000;">--Run Copy-Only Full backup</span></strong>
 <strong> <span style="color: #0000ff;">BACKUP DATABASE TechYaz</span></strong>
 <strong><span style="color: #0000ff;"> TO DISK = 'D:\BACKUP\TechYaz_25Aug2017_Copy.bak'</span></strong>
 <strong><span style="color: #0000ff;"> WITH COPY_ONLY;</span></strong>

<strong><span style="color: #008000;">--Run Copy-Only Log backup</span></strong>
 <strong> <span style="color: #0000ff;">BACKUP LOG TechYaz</span></strong>
 <strong><span style="color: #0000ff;"> TO DISK = 'D:\Backup\TechYaz_25Aug2017_LogCopy.trn'</span></strong>
 <strong><span style="color: #0000ff;"> WITH COPY_ONLY;</span></strong></pre>
<h3><span style="color: #000080;">File Backup</span></h3>
<p>As per Book Online, A full file backup backs up all the data in one or more files or filegroups. The files in a SQL Server database can be backed up and restored individually. Also, you can specify a whole filegroup instead of specifying each constituent file individually. Note that if any file in a filegroup is offline (for example, because the file is being restored), the whole filegroup is offline and cannot be backed up. A file backup can serve as the differential base for differential file backups. File backups can increase the speed of recovery by letting you restore only damaged files, without restoring the rest of the database.</p>
<pre><strong><span style="color: #008000;">--Backup the files in the TechYaz_FG secondary filegroup.</span></strong>
 <strong> <span style="color: #0000ff;">BACKUP DATABASE TechYaz</span></strong>
 <strong><span style="color: #0000ff;"> FILE = 'TechYaz_Data',</span></strong>
 <strong><span style="color: #0000ff;"> FILE = 'Techyaz_Data1'</span></strong>
 <strong><span style="color: #0000ff;"> TO DISK = 'D:\Backups\TechYaz_25Aug2017_filebck.bak';</span></strong>
 <strong><span style="color: #0000ff;"> GO</span></strong>

<strong><span style="color: #008000;">--Back up the files in TechYaz_FG filegroup.</span></strong>
 <strong> <span style="color: #0000ff;">BACKUP DATABASE Sales</span></strong>
 <strong><span style="color: #0000ff;"> FILEGROUP = 'TechYaz_FG'</span></strong>
 <strong><span style="color: #0000ff;"> TO DISK = 'D:\Backups\TechYaz_25Aug2017_filegrp.bak';</span></strong>
 <strong><span style="color: #0000ff;"> Go</span></strong></pre>
<pre><strong><span style="color: #008000;">--Back up the files in TechYaz_FG filegroup.</span></strong>
 <strong> <span style="color: #0000ff;">BACKUP DATABASE Sales</span></strong>
 <strong><span style="color: #0000ff;"> FILEGROUP = 'TechYaz_FG'</span></strong>
 <strong><span style="color: #0000ff;"> TO DISK = 'D:\Backups\TechYaz_25Aug2017_filegrp.drn';</span></strong>
 <strong><span style="color: #0000ff;"> With DIFFERENTIAL</span></strong></pre>
<h3><span style="color: #000080;">Partial Backup</span></h3>
<p>A partial backup resembles a full database backup, but a partial backup does not contain all the filegroups. A partial backup includes all the read/write files in a database: the primary filegroup and any read/write secondary filegroups, and also any specified read-only files or filegroups. A Partial backup can be issued for either a Full or Differential backup. This can not be used for Transaction Log backups. Partial backups are not supported by SQL Server Management Studio or the Maintenance Plan Wizard.</p>
<pre><strong><span style="color: #008000;">--Backup Partial Full Backup</span></strong>
 <strong> <span style="color: #0000ff;">BACKUP DATABASE TechYaz READ_WRITE_FILEGROUPS</span></strong>
 <strong><span style="color: #0000ff;"> TO DISK = 'D:\Backups\TechYaz_25Aug2017_Partial.bak';</span></strong>
 <strong><span style="color: #0000ff;"> GO</span></strong>

<strong><span style="color: #008000;">--Backup Partial Differential Backup</span></strong>
 <strong> <span style="color: #0000ff;">BACKUP DATABASE TechYaz READ_WRITE_FILEGROUPS</span></strong>
 <strong><span style="color: #0000ff;"> TO DISK = 'D:\Backups\TechYaz_25Aug2017_DFNPartial.drn';</span></strong>
 <strong><span style="color: #0000ff;"> WITH DIFFERENTIAL</span></strong>
 <strong><span style="color: #0000ff;"> GO</span></strong></pre>
<p>I hope you like this article. Please follow us on our <a href="https://www.facebook.com/Techyaz/">facebook page</a> and on <a href="https://twitter.com/Tech_yaz">Twitter </a>handle to get latest updates.</p>
<p>The post <a href="https://techyaz.com/sql-server/backup-recovery/understanding-sql-server-backups/">Understanding SQL Server Backups</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/backup-recovery/understanding-sql-server-backups/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Understanding SQL Server Recovery Model</title>
		<link>https://techyaz.com/sql-server/backup-recovery/understanding-sql-server-recovery-model/</link>
					<comments>https://techyaz.com/sql-server/backup-recovery/understanding-sql-server-recovery-model/#comments</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Sat, 09 Sep 2017 12:00:07 +0000</pubDate>
				<category><![CDATA[Backup & Recovery]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administration]]></category>
		<category><![CDATA[Backups]]></category>
		<category><![CDATA[bulk-logged]]></category>
		<category><![CDATA[checkpoints]]></category>
		<category><![CDATA[full]]></category>
		<category><![CDATA[log_files]]></category>
		<category><![CDATA[recovery]]></category>
		<category><![CDATA[Recovery Model]]></category>
		<category><![CDATA[simple]]></category>
		<category><![CDATA[transaction log]]></category>
		<guid isPermaLink="false">http://techyaz.com/?p=829</guid>

					<description><![CDATA[<p>A Recovery Model is a database property that designed to control transaction log maintenance. SQL Server Recovery Model does not define how transactions will be logged but they define how transaction logs will be managed in the transaction log file.&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/backup-recovery/understanding-sql-server-recovery-model/">Understanding SQL Server Recovery Model</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>A Recovery Model is a database property that designed to control transaction log maintenance. SQL Server Recovery Model does not define how transactions will be logged but they define how transaction logs will be managed in the <a href="https://techyaz.com/sql-server/understanding-transaction-log-architecture/" target="_blank" rel="noopener">transaction log file</a>. There are three types of recovery models in SQL Server:</p>
<ul>
<li>Simple</li>
<li>Full</li>
<li>Bulk-Logged</li>
</ul>
<h3><span style="color: #000080;">Simple Recovery Model</span></h3>
<p>Simple recovery model is used for databases that are not critical or the database is static and data is not changing. We generally use SIMPLE model for lower life cycle databases. Main reason for this is point in time recovery is not possible because transaction log backup is not allowed in this recovery model and database engine automatically clears transactional logs during checkpoint operation. If you want to <a href="https://techyaz.com/sql-server/checkpoint/" target="_blank" rel="noopener">understand checkpoint operation</a>, you should read attached article.</p>
<p>A common <strong>myth</strong> is that when a database is configured in Simple recovery model then transactions will not be logged in transaction log files. This is not true and <strong>every transaction is logged to the transaction log file</strong>. Only difference is that, when that <strong>transactions will complete</strong> and data is written to disk all <strong>logs will flush</strong> and be available to log another transaction in same log file. This way you can also deal with the space issue.</p>
<p>Log Shipping, <a href="https://techyaz.com/sql-server/alwayson-availability-group/" target="_blank" rel="noopener">AlwaysOn Availability group</a> and <a href="https://techyaz.com/sql-server/point-in-time-recovery/" target="_blank" rel="noopener">Point-in-Time Restores</a> are not possible in this SIMPLE model because transaction log backups are not allowed in this recovery model. We can recover any database that are running in SIMPLE model till last full or differential backups only. Run below command if you want to view or change the recovery model of the database.</p>
<pre class="brush: sql; title: ; notranslate" title=""><strong><span class="kwrd" style="color: blue;"><span style="color: #008000;">--Check the Recovery Model of the database YourDB_Name
<span style="color: #0000ff;">SELECT name, recovery_model_desc  
   FROM sys.databases  
      WHERE name = 'YOURDB_NAME' ;  
GO</span>
--Change Recovery Model to SIMPLE</span>
ALTER DATABASE DBNAME SET RECOVERY SIMPLE
GO
</span></strong></pre>
<h3><span style="color: #000080;">Full Recovery Model</span></h3>
<p><a href="https://techyaz.com/sql-server/point-in-time-recovery/" target="_blank" rel="noopener">Point in time recovery</a> is possible in full recovery model that is why we use this recovery model for all production and critical databases. Every transactions that are logged in this recovery model can be backed up. Transaction log backup will capture all the logs and clears all the inactive portions of the transaction log file.  You can handle your <a href="https://techyaz.com/sql-server/get-total-virtual-log-files/" target="_blank" rel="noopener">log file space management</a> by scheduling frequent transaction log backups.</p>
<p>You can also clear the transaction logs from log files by switching the recovery model from Full to Simple but this is never recommended for any production database. If you change the SQL Server recovery model from Full to Simple, logs will be flushed from log file without getting captured into transaction log backup. That will break the log sequence and you will end up losing the point in time recovery for your database. That is why switching recovery model from full to simple is not recommended for production database.</p>
<p>As transaction log backups are allowed in this recovery model so you can recover your database till point in time and there will be no data loss in this recovery model.</p>
<pre class="brush: sql; title: ; notranslate" title=""><strong><span class="kwrd" style="color: blue;"><span style="color: #008000;">--Change SQL Server Recovery Model to FULL</span>
ALTER DATABASE DBNAME SET RECOVERY FULL
GO
</span></strong></pre>
<h3><span style="color: #000080;">Bulk-Logged Recovery Model</span></h3>
<p>Bulk-logged recovery model works similar to Full recovery model except few exceptions during bulk operations. You can use this recovery model if you have to run BULK operations on your database. Bulk-logged recovery model minimally logged such bulk operations to reduce the transaction log space.</p>
<p>Point in time recovery is not possible if you have performed any bulk operation during that time due to the nature of minimally logged operation. If you haven&#8217;t performed any bulk operation then point in time recovery can be achieved. Microsoft does not suggest to run any database in bulk-logged recovery model if you don&#8217;t have to run any bulk operations.</p>
<p>Best practice is that you change a database recovery model to the bulk-logged immediately before running bulk operations and restore it back to the full recovery model when those operations complete. Also you should run a log backup before switching to bulk-logged recovery model and again take the log backup once you return back to full recovery model post completing bulk operation. Your backup strategy remains the same and it will not break your log sequence. Run below command to change the recovery model to bulk-logged.</p>
<pre class="brush: sql; title: ; notranslate" title=""><strong><span class="kwrd" style="color: blue;"><span style="color: #008000;">--Change Recovery Model to BULK-Logged</span>
ALTER DATABASE DBNAME SET RECOVERY FULL
GO
</span></strong></pre>
<h3><span style="color: #000080;">Change Recovery Model using GUI</span></h3>
<ol>
<li>Connect to SQL Server Instance. in Object Explorer, click the server name to expand the server tree.</li>
<li>Expand <strong>Databases</strong> folder and click on the database for which either you want to change the recovery model of view the recovery model.</li>
<li>Right-click on that database, and then click <strong>Properties</strong>, which opens the <strong>Database Properties</strong> dialog box.</li>
<li>In the <strong>Select a page</strong> pane, click <strong>Options</strong>.</li>
<li>The current recovery model is displayed in the <strong>Recovery model</strong> list box.</li>
<li>Optionally, to change the recovery model select a different model list. The choices are <strong>Full</strong>, <strong>Bulk-logged</strong>, or <strong>Simple</strong>.</li>
<li>Click <strong>OK</strong>.</li>
</ol>
<p>I hope you like this article. Please follow us on our <a href="https://www.facebook.com/Techyaz/">facebook page</a> and on <a href="https://twitter.com/Tech_yaz">Twitter </a>handle to get latest updates.</p>
<p>The post <a href="https://techyaz.com/sql-server/backup-recovery/understanding-sql-server-recovery-model/">Understanding SQL Server Recovery Model</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/backup-recovery/understanding-sql-server-recovery-model/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Understanding Point in Time Recovery in SQL Server</title>
		<link>https://techyaz.com/sql-server/backup-recovery/point-in-time-recovery/</link>
					<comments>https://techyaz.com/sql-server/backup-recovery/point-in-time-recovery/#respond</comments>
		
		<dc:creator><![CDATA[Manvendra Deo Singh]]></dc:creator>
		<pubDate>Sun, 12 Sep 2010 06:02:00 +0000</pubDate>
				<category><![CDATA[Backup & Recovery]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Backups]]></category>
		<category><![CDATA[recovery]]></category>
		<category><![CDATA[restore]]></category>
		<guid isPermaLink="false">http://techyaz.com/big-data/point-in-time-recovery/</guid>

					<description><![CDATA[<p>Point In Time recovery is a process to recover or restore your database till the point it was lost. Sometimes detrimental command will probably be issued against one of your databases and you will need to recover the lost data.&#46;&#46;&#46;</p>
<p>The post <a href="https://techyaz.com/sql-server/backup-recovery/point-in-time-recovery/">Understanding Point in Time Recovery in SQL Server</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Point In Time recovery is a process to recover or restore your database till the point it was lost. Sometimes detrimental command will probably be issued against one of your databases and you will need to recover the lost data. There are several actions that you might be able to take to recover the lost data, but what option makes the most sense. One option that SQL Server offers is the ability to do point in time restores of your data in order to restore your database back to the point right before that detrimental command was issued.</p>
<p><em><strong><span style="color: #800000;">Related Articles:</span></strong></em></p>
<ul>
<li><strong><a href="https://techyaz.com/sql-server/understanding-sql-server-recovery-model/" target="_blank" rel="noopener">Understanding SQL Server Recovery Models</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/understanding-sql-server-backups/" target="_blank" rel="noopener">Read Different Types of SQL Server Backups</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/backup-recovery/sql-server-backup-recovery-interview-questions-answers/" target="_blank" rel="noopener">SQL Server Backup and Recovery Interview Questions</a></strong></li>
<li><strong><a href="https://techyaz.com/sql-server/how-to-get-when-your-db-was-restored-last-time/" target="_blank" rel="noopener">How to get Last Restore Time of your database?</a></strong></li>
</ul>
<h3><span style="color: #000080;">Point in Time Restore</span></h3>
<p>1-This topic is relevant only for databases that are using <strong><a href="https://techyaz.com/sql-server/understanding-sql-server-recovery-model/" target="_blank" rel="noopener">full or bulk-logged recovery mode</a></strong>. Under the bulk-logged recovery model, if a log backup contains bulk-logged changes, point-in-time recovery is not possible to a point within that backup. The database must be recovered to the end of the transaction log backup.<br />
2-Restore the last full database backup and, if any, the last differential database backup without recovering the database (RESTORE DATABASE database_name FROM backup_device <strong>WITH NORECOVERY</strong>).<br />
3-Apply each transaction log backup in the same sequence in which they were created, specifying the time at which you intend to stop restoring log (RESTORE DATABASE database_name FROM WITH STOPAT=time, RECOVERY).<br />
4-The basic syntax is:</p>
<div class="codediv">
<pre class="prettyprint lang-sql"><span style="color: #0000ff;"><strong>RESTORE LOG database_name FROM WITH STOPAT =time, RECOVERY
</strong></span></pre>
</div>
<h5><span style="color: #000080;">T-SQL Code:</span></h5>
<div class="codediv">
<pre class="prettyprint lang-sql"><span style="color: #333399;"><strong><span style="color: #008000;">-- Restore the full database backup.</span>
RESTORE DATABASE AdventureWorks
FROM disk='backup file location'
WITH NORECOVERY;
GO
<span style="color: #008000;">-- Restore the required Log backup with STOPAT keyword.</span>
RESTORE LOG AdventureWorks
FROM disk='backup file location'
WITH RECOVERY, STOPAT = 'Apr 15, 2005 12:00 AM';
GO
</strong></span></pre>
</div>
<p>I hope you like this article. Please follow our <a href="https://www.facebook.com/Techyaz/">facebook</a> page and <a href="https://twitter.com/Tech_yaz">Twitter </a>handle to get latest updates.</p>
<p>The post <a href="https://techyaz.com/sql-server/backup-recovery/point-in-time-recovery/">Understanding Point in Time Recovery in SQL Server</a> appeared first on <a href="https://techyaz.com">Techyaz.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://techyaz.com/sql-server/backup-recovery/point-in-time-recovery/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
