FIX: Backing up a SQL Server database by using a VSS backup application may fail after installing SQL Server 2016 and 2017

Applies to: SQL Server 2017 Developer on WindowsSQL Server 2017 Enterprise on WindowsSQL Server 2017 Enterprise Core on Windows More

Symptoms


Consider the following scenario:

  • You run a server that hosts multiple instances with different major versions, including not only Microsoft SQL server 2008, 2008 R2, 2012 or 2014, but also SQL server 2016 or 2017 (This includes lightweight editions instances such as SQL Express).

In this scenario, the VSS application may not successfully collect SQL Server databases. Additionally, you may receive an error message in Windows Application Event logs that resembles the following:

For a SQL Server 2008 OR 2008 R2 instance

Error state: 1, Severity: 16
Source: Microsoft SQL Server Native Client 11.0
Error message: Invalid object name 'master.sys.availability_replicas'.

Note: The error will occur when you execute the following query:
declare @sql nvarchar(MAX)DECLARE @DatabaseName VARCHAR(256)set @DatabaseName =N'master'set @sql = SELECT 1 FROM master.sys.availability_replicas AS ar INNER JOIN master.sys.databases AS d ON DB_ID(''' + @DatabaseName + ''') = d.database_id AND ar.replica_id = d.replica_id INNER JOIN master.sys.dm_hadr_availability_replica_states AS st ON ar.replica_id = st.replica_id AND st.role = 2'EXEC(@sql)

For a SQL Server 2012 or SQL Server 2014 instance hosting AlwaysOn Availability Group Secondary Databases

‎Error state: 1, Severity: 16
‎Source: Microsoft SQL Server Native Client 11.0
‎Error message: Invalid column name 'basic_features'.

And in this case the query hitting the error will be :

'select database_id, ar.replica_id, replica_server_name, is_primary_replica, ar.group_id, basic_features from master.sys.availability_replicas ar, master.sys.dm_hadr_database_replica_states rs, master.sys.availability_groups ag where database_id = DB_ID(''' + @DatabaseName + ''' ) AND replica_server_name = ''' + @INSTANCENAME + ''' AND ar.replica_id = rs.replica_id AND ar.group_id = ag.group_id'

Resolution


This issue is fixed in the following cumulative updates for SQL Server:

      Cumulative Update 12 for SQL Server 2017

      Cumulative Update 4 for SQL Server 2016 SP2

Status


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

References


Learn about the terminology Microsoft uses to describe software updates.