<?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>log_shipping_secondary &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/log_shipping_secondary/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>Sun, 25 Sep 2016 19:51:55 +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: Script to find last Restored Log backup file of the Secondary database in Log Shipping</title>
		<link>https://www.dbrnd.com/2016/10/sql-server-script-to-find-last-restored-log-backup-file-of-the-secondary-database-in-log-shipping/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sun, 23 Oct 2016 16:16:38 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBA Script]]></category>
		<category><![CDATA[.trn file]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[log backup]]></category>
		<category><![CDATA[log shipping]]></category>
		<category><![CDATA[log_shipping_secondary]]></category>
		<category><![CDATA[log_shipping_secondary_databases]]></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[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3670</guid>

					<description><![CDATA[In this post, I am sharing one T-SQL Script to identify the last restored Log backup file of the Secondary database in the SQL Server Log Shipping. The one of the important points in Log Shipping is, both Primary Database and Secondary Database should be in sync. If both are out of sync, SQL Server [&#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%2F2016%2F10%2Fsql-server-script-to-find-last-restored-log-backup-file-of-the-secondary-database-in-log-shipping%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20last%20Restored%20Log%20backup%20file%20of%20the%20Secondary%20database%20in%20Log%20Shipping" 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%2F2016%2F10%2Fsql-server-script-to-find-last-restored-log-backup-file-of-the-secondary-database-in-log-shipping%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20last%20Restored%20Log%20backup%20file%20of%20the%20Secondary%20database%20in%20Log%20Shipping" 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%2F2016%2F10%2Fsql-server-script-to-find-last-restored-log-backup-file-of-the-secondary-database-in-log-shipping%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20last%20Restored%20Log%20backup%20file%20of%20the%20Secondary%20database%20in%20Log%20Shipping" 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%2F2016%2F10%2Fsql-server-script-to-find-last-restored-log-backup-file-of-the-secondary-database-in-log-shipping%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20last%20Restored%20Log%20backup%20file%20of%20the%20Secondary%20database%20in%20Log%20Shipping" 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%2F2016%2F10%2Fsql-server-script-to-find-last-restored-log-backup-file-of-the-secondary-database-in-log-shipping%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20last%20Restored%20Log%20backup%20file%20of%20the%20Secondary%20database%20in%20Log%20Shipping" 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%2F2016%2F10%2Fsql-server-script-to-find-last-restored-log-backup-file-of-the-secondary-database-in-log-shipping%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20last%20Restored%20Log%20backup%20file%20of%20the%20Secondary%20database%20in%20Log%20Shipping" 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%2F2016%2F10%2Fsql-server-script-to-find-last-restored-log-backup-file-of-the-secondary-database-in-log-shipping%2F&#038;title=SQL%20Server%3A%20Script%20to%20find%20last%20Restored%20Log%20backup%20file%20of%20the%20Secondary%20database%20in%20Log%20Shipping" data-a2a-url="https://www.dbrnd.com/2016/10/sql-server-script-to-find-last-restored-log-backup-file-of-the-secondary-database-in-log-shipping/" data-a2a-title="SQL Server: Script to find last Restored Log backup file of the Secondary database in Log Shipping"></a></p><p>In this post, I am sharing one T-SQL Script to identify the last restored Log backup file of the Secondary database in the SQL Server Log Shipping. </p>
<blockquote><p>The one of the important points in Log Shipping is, both Primary Database and Secondary Database should be in sync. </p></blockquote>
<blockquote><p>If both are out of sync, SQL Server stops the Log Shipping and throws error related to log files. </p></blockquote>
<p>As a SQL DBA, I am facing this kind of common errors of Log Shipping like:<br />
<strong>&#8220;.trn is too recent to apply to the secondary database&#8221;<br />
&#8220;Could not find a log backup file that could be applied to secondary database&#8221;</strong></p>
<blockquote><p>Using below T-SQL script, you can find last restored log backup in the Secondary Database which help you to compare with available log backups of Primary Database. </p>
<p>You can also easily find out any pending restore of log backup. </p></blockquote>
<pre class="crayon-plain-tag">SELECT
	[lss].[primary_database]
	,[lss].[last_copied_file]
	,[lss].[last_copied_date]
	,[lssd].[secondary_database]
	,[lssd].[last_restored_file]
	,[lssd].[last_restored_date]
FROM [msdb].[dbo].[log_shipping_secondary] AS lss
INNER JOIN [msdb].[dbo].[log_shipping_secondary_databases] AS lssd
        ON [lss].[primary_database] = [lssd].[secondary_database]
WHERE [lss].[primary_database] ='Primary_Database_Name'
ORDER BY [lss].[primary_database]</pre> </p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
