Restoring database that's part of an Availability Group.

  • Hi,

    I'm hoping someone can help me. I'm trying to restore a backup of my production database (which is part of an availability group) onto my development server (which has an older copy of the production database which is also in a separate availability group).

    On the dev server, I've removed the old production database from the availability group, then deleted it on both the primary and secondary servers.

    I've tried multiple things to get this new backup restored on the primary and synchronized with the secondary.

    First, I restored the full backup on the primary server. Then, I went to add it to the availability group using "Full" synchronization (that's what I've used before and it has always worked). However, after a little while, I get an error "The log in this backup set begins at LSN xxxxxxxxxxxxxx, which is too recent to apply to the database. An earlier log backup that includes LSN xxxxxxxxxxxxxx can be restored"

    I can't figure out why I'm getting this. I thought the "Full" synchronization option was supposed to handle most of this for me.

    So then I thought, what if I start over and just take the full backup and restore it to the primary, then the secondary (so they should be the exact same), then add them to the availability group with the "Join Only" synchronization option. After several minutes, I get the error "Database <DatabaseName> is not in a recovering state which is required for a mirror database or secondary database. The remote database must be restored using the "WITH NORECOVERY". (Microsoft SQL Server, Error:1464)."

    I'm sure I'm missing a key step here. Can anyone shed some light?

    Thank you,

    Mike

    Mike Scalise, PMP
    https://www.michaelscalise.com

  •  can't figure out why I'm getting this. I thought the "Full" synchronization option was supposed to handle most of this for me.

    No, if another transaction log backup is taken between the initial full backup and the transaction log backup, this can happen. It can end up being a bit of a race against time. Try disabling transaction log backup jobs for the duration of the operation (or just exclude that database from the job if you don't want to disable all of them).

  • Beatrix,

    Thank you. This makes a lot of sense! I'll give that a try and then let you know.

    Thanks again,

    Mike

    Mike Scalise, PMP
    https://www.michaelscalise.com

  • Good luck! Honestly it can be like playing Whack-A-Mole if you have a busy database :D.

  • Beatrix Kiddo - Friday, March 15, 2019 6:55 AM

    Good luck! Honestly it can be like playing Whack-A-Mole if you have a busy database :D.

    Thanks again. That was it! Successfully added the database back to the AG. Really appreciate the help with this!

    Mike

    Mike Scalise, PMP
    https://www.michaelscalise.com

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply