I was consulting a client for migration from SQL 2014 to SQL 2016. They were using methodology discussed in books online here. https://msdn.microsoft.com/en-us/library/dn178483.aspx (Upgrading AlwaysOn Availability Group Replica Instances). Let us learn about how to fix error 946.
While doing that, they noticed that once they added SQL Server 2016 as secondary replica everything was looking great, but availability database on SQL Server 2016 were stuck in Synchronized / In Recovery in SSMS.
I have asked them to check SQL Server ERRORLOG on the secondary replica (SQL Server 2016) and found below the message.
Error: 946, Severity: 14, State: 1.
Cannot open database ‘ProdDB’ version 782. Upgrade the database to the latest version.
I asked to check sys.sysdatabases using below
SELECT name, version FROM sys.sysdatabases
Since databases are part of availability group and have not been recoveredvered yet, it’s expected to see that version and state as “In recovery”. Once we have failed over the databases to secondary replica and made it as primary everything was looking good and database on SQL 2012 were shown as Not Synchronizing because SQL Server doesn’t allow database secondary replicaplica to be of lower version.
One thing which I noticed is that once I upgraded old primary to SQL 2016 then also databases were not getting synchronized. To fix that I must run below command on current secondary replica which is now upgraded to SQL 2016.
ALTER DATABASE [SQLAuthority] SET HADR RESUME;
Have you ever done upgrade of SQL in AlwaysOn availability group? How was your experience?
Reference: Pinal Dave (http://blog.SQLAuthority.com)
First appeared on SQL SERVER – Fix: Error 946, Severity: 14 – Cannot open database ‘DB’ version 782. Upgrade the database to the latest version