Applying (log backup) LSNs to the secondary node of an Availability Group I have a test instance configured as always-on go down today due to a restart of the primary node and the file-share going down together. I had a bunch of problems in order to get the secondary functioning again during which I had to remove it from the AG and add it again. During this time (the time when it went down till now) the log backup was running on the primary and when I tried to apply these backups to the secondary I got the following error:                                   


  This backup set cannot be applied because it is on a recovery path that is inconsistent with the database. The recovery path is the sequence of data and log backups that have brought the database to a particular recovery point. Find a compatible backup to restore, or restore the rest of the database to match a recovery point within this backup set, which will restore the database to a different point in time. For more information about recovery paths, see SQL Server Books Online.


When I looked at sys.dm_hadr_database_replica_states: 


last_hardened_lsn: 43000043815500001 


When I looked at msdb.dbo.backupset (backup time):   


backup time: 9:50 am 
first_lsn: 43000043783000001 
last_lsn : 43000043887200001


My question is, would there be any way to start applying this log backup starting from LSN 43000043815500001? 

I am ok with restoring everything and then connecting my AGs since this is a very small instance, just want to know if there was an easier way as opposed to doing everything from scratch. I looked up online and did see the option for stopbeforemark or stopatmark but I am looking for something like stopaftermark.
You have 2 options :


Easy one - since this is test instance and its secondary.


Stop the log backup on primary.
Remove the db/s from AG.
Take a differential backup or full backup if dbs are small.
restore then on secondary with norecovery.
take an additional log backup on primary.
restore the additional log backup taken on secondary with norecovery.
join the dbs to AG.

A little bit harder one -


install sp_restoregene on primary.
Remove the db/s from AG.
Run it for the db/s in question and it will generate the full and log backup sequence with stopat.
Restore the sequence on secondary.
Join back to AG.



(I am telling above is a little bit harder since if you have not done a point-in-time recovery and you are doing it for the first time, test it first to be comfortable).