Along with performance tuning, I do provide consultancy services for deployments, including AlwaysOn availability group deployments. One of my clients who had a multi GB database wanted to configure AlwaysOn availability group and add a replica for disaster recovery purpose as well. They already had a secondary replica in the same data center for high availability purpose. Let us learn about AlwaysOn Join Error.
Since its not advisable to use UI for such big database to initialize the secondary, they were initializing secondary by will manual backup / restore of backup from primary followed by “join” option in the wizard. Whenever they tried this, below was the error.
Msg 1408, Level 16, State 211
The remote copy of database “SQLAUTH” is not recovered far enough to enable database mirroring or to join it to the availability group. You need to apply missing log records to the remote database by restoring the current log backups from the principal/primary database.
They contacted me because they were sure that there are no backups taken on primary replica, even then, somehow, they were seeing the error 1408 while trying to join the database to AG. They knew that the error is reported when there is a log backup taken from primary replica and there is a mismatch of LSN between the restored copy of secondary and current copy on the primary.
WORKAROUND/SOLUTION
While they knew that the error is due to the LSN mismatch, they missed one of the core concepts of backup taken from the AlwaysOn availability database.
It was easy to explain and demonstrate that they error would appear when a log backup is taken, after the full back-up from primary, even on a secondary replica. I used my below blog to find the history of the backup of the database.
When we ran the same query on the current secondary replica (remember, they already had one secondary) we found that log backups are taken regularly on that replica. As soon as we restored all the pending log backups to new secondary and tried join option again – it worked!
So whenever you see such errors, always use the script from my blog and find out the log backups which are taken. These log backups can happen even on secondary replica and would still maintain the chain with another log backup on other replicas.
Reference: Pinal Dave (http://blog.SQLAuthority.com)