Sql-server – SQL Server Log Shipping restore fail – The Log Is too recent to apply

log-shippingsql server

The restore is missing a backup log, and the "physical_device_name" of the missing backup log is "NUL". This is a Transaction Log that gets made out of sequence with the log shipping backup job. I can't find another service/job that triggers this job. If I understand log shipping correctly, this missing log causes the restore to fail every day at about midnight.

The bkSize is 0 but the LSN number did change after the missing backup:

enter image description here

enter image description here

I would appreciate advice to resolve this error.

Regards

Niel

Best Answer

I use the following query to get a good overview of running Backups / LOG Shipping Status.

SELECT  [b].[database_name] ,
            [b].[backup_start_date] ,
            [b].[backup_finish_date] ,
            [b].[type] ,
            [b].[first_lsn] ,
            [b].[last_lsn] ,
            [b].[checkpoint_lsn] ,
            [b].[database_backup_lsn]
            --,f.media_set_id
            ,f.physical_device_name,
            script='RESTORE LOG DBNAME FROM DISK=N''' + f.physical_device_name + ''' WITH NORECOVERY; '
    FROM    [msdb].[dbo].[backupset] AS [b]
    LEFT JOIN  msdb.dbo.backupmediafamily f ON b.media_set_id = f.media_set_id
    WHERE   [b].[database_name] = 'DBNAME'
        AND [b].[backup_start_date] >= '2017-05-10 13:00:00.000' ORDER BY [b].[backup_start_date] asc;

It gives a picture of the Backups taken and so you will See which Backups you need to RESTORE them on secondary DB.

Sample : The Backups Marked yellow need to be restored on 2ndary, only those.

Regarding your NUL backup, have you already scripted All of the stored procedures in Place and Looked for NUL in there?

Have you observed any Logins the time this NUL Backup happens? If a login FROM outside starts this Backup you could cut the login off the Server.

Hope it helps.

enter image description here