Assume that you use Always On Failover Cluster Instance (FCI) as a secondary replica. When you try to upgrade Microsoft SQL Server 2016 to Service Pack 2 (SP2) Cumulative Update 11 (CU11) or later versions, the upgrade script fails, and you may receive the following errors messages:
DateTime spidSpidId Upgrading subscription settings and system objects in database [DatabaseName].
DateTime spidSpidId Failed to update database "DatabaseName" because the database is read-only.
DateTime spidSpidId Error executing sp_vupgrade_replication.
When an upgrade is performed on the secondary replica of SQL FCI, there is a race between the database recovery and the upgrade script execution. Therefore, the cursor that you use inside sp_vupgrade_replication cannot filter out the read-only databases correctly. For a short time, the secondary databases in recovery phase are included in the list of editable database. Therefore, when you try to update these databases, an exception is returned because the databases are read-only.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
This issue is fixed in the following cumulative updates for SQL Server:
About cumulative updates for SQL Server:
Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:
Learn about the terminology that Microsoft uses to describe software updates.