Search code examples
sql-serversql-server-2012database-backupslog-shipping

Log Shipping LSN in backup too recent to apply


Log shipped has been working. I get the message:

Error: The log in this backup set begins at LSN 193489000090302900001, which is too recent to apply to the database. An earlier log backup that includes LSN 192973000046320700001 can be restored.

I checked using Restore HEADERONLY and found the file that LSN is in and performed:

RESTORE LOG MicrosoftDynamicsAX 
FROM DISK = N'F:\RLASQL07\MicrosoftDynamicsAX\MicrosoftDynamicsAX_20170813161501.trn' WITH NORECOVERY;

This restored fine but when I rerun the LSRESTORE and it fails. What am I missing?


Solution

  • This article may be of some use.

    https://blogs.technet.microsoft.com/mdegre/2009/08/08/logshipping-secondary-server-is-out-of-sync-and-lsrestore-job-failing/

    At this time, to check if there are a gaps in the Restore Process. You can run the query below to try to find out whether a redundant Backup Log was performed :

    SELECT 
        s.database_name,s.backup_finish_date,y.physical_device_name
    FROM 
        msdb..backupset AS s INNER JOIN
        msdb..backupfile AS f ON f.backup_set_id = s.backup_set_id INNER JOIN
        msdb..backupmediaset AS m ON s.media_set_id = m.media_set_id INNER JOIN
        msdb..backupmediafamily AS y ON m.media_set_id = y.media_set_id
    WHERE 
        (s.database_name = 'databaseNamePrimaryServer')
    ORDER BY 
        s.backup_finish_date DESC;