Greetings. Like everyone else, I've always taken a Full backup, followed by a Transaction Log backup, and restored them in noRecovery mode to the Secondary server, to add a DB to an Availability Group.
However, I ran into a scenario today where that wasn't possible. The scenario was needing to add a DB to an AG in a non-prod environment, using backups created several months ago in the Prod environment.
This simply wouldn't work. SQL Server would yell at me to first take a TLog backup and apply it to the Secondary server. As you can imagine that didn't work well.
So I turned to Google. I came up with some ideas on trying various things, which I did to no avail. However, in trying various things I accidentally discovered a workaround that I'm still scratching my head over.....
As long as I first recover my Full backup onto the Secondary server (in noRecovery of course), THEN (and only then) restore the Primary server (in Recovery of course), I am able to add the DB to the AG as desired.
I've been able to reproduce both the issue and the solution several times. My question is why? Why would this make any difference at all? How could this impact being able to add a DB to an AG or not?
All insights are welcome!
Thanks in advance! ChrisRDBA