<?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>sys.database_recovery_status &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/sys-database_recovery_status/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Mon, 20 Mar 2017 20:15:45 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>SQL Server: Find Log Sequence Number (LSN) from Database Backup Files</title>
		<link>https://www.dbrnd.com/2017/03/sql-server-find-log-sequence-number-lsn-from-database-backup-files/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 31 Mar 2017 16:16:06 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbo.backupset]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[fn_dblog()]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[sys.database_recovery_status]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2609</guid>

					<description><![CDATA[In the previous post, I shared the importance of LSN for all the database backup files of the SQL Server. When we have different transaction backup data, sometimes it is required to check LastLSN and FirstLSN of those files. If LSN sequence is not proper, then we cannot restore all database files in the series, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F03%2Fsql-server-find-log-sequence-number-lsn-from-database-backup-files%2F&amp;linkname=SQL%20Server%3A%20Find%20Log%20Sequence%20Number%20%28LSN%29%20from%20Database%20Backup%20Files" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F03%2Fsql-server-find-log-sequence-number-lsn-from-database-backup-files%2F&amp;linkname=SQL%20Server%3A%20Find%20Log%20Sequence%20Number%20%28LSN%29%20from%20Database%20Backup%20Files" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F03%2Fsql-server-find-log-sequence-number-lsn-from-database-backup-files%2F&amp;linkname=SQL%20Server%3A%20Find%20Log%20Sequence%20Number%20%28LSN%29%20from%20Database%20Backup%20Files" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F03%2Fsql-server-find-log-sequence-number-lsn-from-database-backup-files%2F&amp;linkname=SQL%20Server%3A%20Find%20Log%20Sequence%20Number%20%28LSN%29%20from%20Database%20Backup%20Files" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F03%2Fsql-server-find-log-sequence-number-lsn-from-database-backup-files%2F&amp;linkname=SQL%20Server%3A%20Find%20Log%20Sequence%20Number%20%28LSN%29%20from%20Database%20Backup%20Files" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F03%2Fsql-server-find-log-sequence-number-lsn-from-database-backup-files%2F&amp;linkname=SQL%20Server%3A%20Find%20Log%20Sequence%20Number%20%28LSN%29%20from%20Database%20Backup%20Files" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2017%2F03%2Fsql-server-find-log-sequence-number-lsn-from-database-backup-files%2F&#038;title=SQL%20Server%3A%20Find%20Log%20Sequence%20Number%20%28LSN%29%20from%20Database%20Backup%20Files" data-a2a-url="https://www.dbrnd.com/2017/03/sql-server-find-log-sequence-number-lsn-from-database-backup-files/" data-a2a-title="SQL Server: Find Log Sequence Number (LSN) from Database Backup Files"></a></p><p>In the previous post, I shared the importance of LSN for all the database backup files of the SQL Server. </p>
<p>When we have different transaction backup data, sometimes it is required to check LastLSN and FirstLSN of those files. </p>
<p>If LSN sequence is not proper, then we cannot restore all database files in the series, and it generates an error like, LSN doesn&#8217;t match with the previous file. </p>
<p>Below are few different scripts to find LSN information of the Database Backup Files. </p>
<p><strong>Using backupset table:</strong></p>
<pre class="crayon-plain-tag">SELECT	 
	database_name
	,backup_size
	,first_lsn
	,last_lsn
	,checkpoint_lsn
	,database_backup_lsn
	,database_creation_date
	,backup_start_date
	,backup_finish_date	
FROM msdb.dbo.backupset</pre> </p>
<p><strong>Using sys.database_recovery_status:</strong></p>
<pre class="crayon-plain-tag">SELECT 
	last_log_backup_lsn
FROM sys.database_recovery_status
WHERE database_id = DB_ID()</pre> </p>
<p><strong>Using fn_dblog():</strong><br />
It returns all information about the log data, and it contains two parameters, first is starting LSN and the second is ending LSN.<br />
You can pass NULL for all the records. </p>
<pre class="crayon-plain-tag">SELECT 
	last_log_backup_lsn
FROM sys.database_recovery_status
WHERE database_id = DB_ID()</pre> </p>
<p><strong>Using Restore with HeaderOnly option:</strong><br />
You can specify file name and path of the backup files, and it returns all information related to that backup file. </p>
<pre class="crayon-plain-tag">RESTORE HEADERONLY FROM DISK = 'C:\Temp\MyFull.bak'
RESTORE HEADERONLY FROM DISK = 'C:\Temp\MyTran01.trn'</pre> </p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
