Resolving Failover Log-shipping errors

Here is an error I recent received when failing-over our databases at work from our Primary SQL Server to our Secondary during a scheduled DR event:

E:\Projects\SQL_Failback_Script.sql: Error (124,1): The log in this backup set terminates at LSN 4130551000000262300001, which is too early to apply to the database. A more recent log backup that includes LSN 4177759000000047900001 can be restored.

What seemed to have happened is when I ran the following:

…that the issue was there were files of the same name left from last quarters’ DR event. It seems that the write to disk did not work for when I tried to apply the tail log to the database and bring it online on the Secondary server, running this T-SQL below:

…is when I received that error. It seems like the file was not successfully over-written. When trying to apply that log file, we get the error which seems to be the LSN entry in that log file from the previous DR event.

Here is another type of restore error you can receive. Let’s take a look at it:

Msg 4305, Level 16, State 1, Line 1
The log in this backup set begins at LSN 18000000015300001, which is too recent to apply to the database. An earlier log backup that includes LSN 18000000014000001 can be restored.
Msg 3013, Level 16, State 1, Line 1
RESTORE LOG is terminating abnormally.

SQL SERVER – Working with LSN for Restore and Backup Databases. (Error: Msg 4305, Level 16, State 1, Line 1)

Views – 2196