While testing an upgrade from SQL Server 2014 SP1 (12.0.4422.0) to SQL Server 2016 CTP 3.2 (13.0.900.73) I was following the recommended update process and ran into an issue where the database would not start on the old primary after failing over to the updated secondary. Our setup is a primary replica and a single secondary replica, and the steps I completed were:
- Remove automatic failover on synchronous-commit secondary replica
- Upgrade secondary server instances to new version
- Manually fail over to the secondary replica
- Verify databases are online on new primary replica
- Upgrade previous-primary replica to new version
The upgrade of the secondary and failover to make it the primary worked exactly as expected. But after upgrading the previously-primary replica I noticed that the databases on it were listed in SSMS as Not Synchronizing / In Recovery. Also trying to access them would generate an error message:
The database ... is not accessible. (ObjectExplorer)
Checking thru the SQL Server Logs I saw
Cannot open database '...' version 782. Upgrade the database to the latest version.
Querying the master..sysdatabases table showed that it was indeed an older version and had not been updated during the upgrade:
Unfortunately the logs did not indicate why it wasn't updated, and the Availability Groups Dashboard only gave a generic warning indicating the Data synchronization state of some availability database is not healthy with no reason why.
I tried using TSQL to detach the databases or set them offline to "kick" it into updating, but since they are part of the SQL AG those commands don't work.
How can I upgrade the database to the latest version when it is part of a SQL AG?