KB4577467 - Cumulative Update 22 for SQL Server 2017

Applies to: SQL Server 2017 on Windows (all editions)SQL Server 2017 on Linux (all editions)

This article describes Cumulative Update package 22 (CU22) for Microsoft SQL Server 2017. This update contains fixes that were released after the initial release of SQL Server 2017 and updates the SQL Server and Analysis services components to the following builds:

Component Product version File version
SQL Server 14.0.3356.20 2017.140.3356.20
Analysis Services 2017.140.249.54


Important notices

This article also provides important information about the following situations:

  • Pacemaker: A behavioral change is made in distributions that use the latest available version of Pacemaker. Mitigations methods are provided.
  • Query Store: You must run this script if you use Query Store and you have previously installed SQL Server 2017 Cumulative Update 2 (CU2).
  • Analysis Services CU build version: Beginning in SQL Server 2017, the Analysis Services build version number and SQL Server Database Engine build version number do not match. For more information, see Verify Analysis Services cumulative update build version.

Cumulative updates

Cumulative updates (CU) are now available at the Microsoft Download Center.

Only the most recent CU that was released for SQL Server 2017 is available at the Download Center.

CU packages for Linux are available at https://packages.microsoft.com/.


  • Each new CU contains all the fixes that were included with the previous CU for the installed version of SQL Server.
  • SQL Server CUs are certified to the same levels as Service Packs, and should be installed at the same level of confidence.
  • Microsoft recommends ongoing, proactive installation of CUs as they become available according to these guidelines:
    • Historical data shows that a significant number of support cases involve an issue that has already been addressed in a released CU.
    • CUs may contain added value over and above hotfixes. This includes supportability, manageability, and reliability updates.
  • We recommend that you test CUs before you deploy them to production environments.

How to obtain this cumulative update package for Windows

The following update is available from the Microsoft Download Center:

If the download page does not appear, contact Microsoft Customer Service and Support to obtain the cumulative update package.


  • After future cumulative updates are released for SQL Server 2017, this and all previous CUs can be downloaded from the Microsoft Update Catalog. However, we recommend that you always install the latest cumulative update that is available.

How to obtain this cumulative update package for Linux

To update Linux to the latest CU, you must first have the Cumulative Update repository configured. Then, update your SQL Server packages by using the appropriate platform-specific update command.

For installation instructions and direct links to the CU package downloads, see the release notes.

Additional hotfixes that are included in this cumulative update package

VSTS bug number KB article number Description Fix area Platform
13573410 4578887 FIX: Access violation occurs when you run INSERT EXEC with sp_execute_external_script on a table that has IDENTITY column in SQL Server 2017 SQL Engine All
13575424 4568653 FIX: INSERT EXEC doesn't work when you insert row containing explicit identity value into table with IDENTITY column and IDENTITY_INSERT is OFF by default in SQL Server SQL Engine All
13587856 4336873 FIX: A LOB allocator may be leaked when a LOB or off-row column is altered or dropped in SQL Server 2017 In-memory OLTP All
13598930 4561305 FIX: Concurrent inserts against tables with columnstore indexes may cause queries to hang in SQL Server SQL Engine All
13658971   Query Store scalability improvement for adhoc workloads. Query Store now imposes internal limits to the amount of memory it can use and automatically changes the operation mode to READ-ONLY until enough memory has been returned to the Database Engine, preventing performance issues. SQL Engine All
13663198   Intermittent error 6552 occurs when running Spatial query with TOP <param> or OFFSET <param1> ROWS FETCH NEXT <param2> ROWS ONLY clause and parallel plan. SQL Engine All
13477335   This updates adds detailed error information to the pacemaker log when pacemaker agent fails to connect to SQL Server resource to obatin health status High Availability Linux
13477413 4569424 FIX: Intermittent Availability Group failover occurs as AG helper connection times out while connecting to SQL Server 2017 High Availability Linux
13249811 4579966 FIX: UTC time for DST time zone in Brazil/Sao Paulo is reported incorrectly in SQL Server 2017 SQL Engine Linux
13509282 4578011 FIX: Unable to restore SQL Server database from previous versions on NVMe device partitioned in 4K block size SQL Engine Linux
13605758 4573172 FIX: Error occurs when you run Distribution Agent on an instance of SQL Server 2017 on Linux SQL Engine Linux
13624029   SQL Server AG Helper/AG monitoring application waiting more than 30 seconds with epoll and futex_wait_queue_me wait type is unable to connect to SQL Server 2017 resulting in timeout and failover. SQL Engine Linux
13530877 4563007 FIX: VDI backup fails with error after applying SQL Server 2017 CU19/CU20/CU21 SQL Engine Linux
13636126 4575453 FIX: SQL Server fails to start when remote admin connections are enabled and IPV6 is disabled on the host SQL connectivity Linux
12671877 4486936 FIX: "Login failed for user" error occurs when you run Maintenance plan with SQL login account in SQL Server 2016 SQL Engine Windows
13525230 4577932 FIX: Access violation exception occurs in Availability Groups in SQL Server 2017 under certain conditions High availability Windows
13560722 4575689 FIX: Incorrect results can occur when you run linked server query with aggregates or joins on table with filtered index on a remote server in SQL Server 2017 SQL performance Windows
13585164 4469942 FIX: Sharing violation when the “sp_cycle_agent_errorlog” stored procedure is run in SQL Server SQL Engine Windows
13586252 4578110 FIX: Error 8992 occurs when you run DBCC CHECKDB on cloned database in SQL Server 2019 SQL Engine Windows
13594343   Fixes an unexpected error when you run a query against Multi Dimensional Instance using DirectQuery mode.
Unexpected error (file 'FileName', line LineNumber, FunctionName :: start function)
Analysis services Windows
13598882   Non-yielding scheduler error occurs when a query with large number of expressions is run. SQL performance Windows
13598884   DBCC CHECKDB may incorrectly report corruption on Spatial Index if base table has a column called ID. SQL Engine Windows
13598898   When you concurrently create sub directories in a FileTable directory, a deadlock may occur internally in the SQL Server Engine and all subsequent requests to FileTable directories and files may not respond. SQL Engine Windows
13598902   Fixes long package execution time involving SSIS task of type TransferSqlServerObjectsTask when database contains tens of thousands of tables and the db user is not db_owner. Integration services Windows
13598904   When a replication error such as deadlock occurs, random id is inserted in MSRepl_Errors table while it should be just incremented by 1 from the previous id value. This cumulative update (CU) fixes the issue and the MSRepl_Errors will insert entries with row id incremented by 1 instead of using some random value. SQL Engine Windows
13598906   When you run ALTER commands that include ROLLBACK IMMEDIATE option, the rollback may trigger before the command is processed even if the ALTER itself may fail due to lack of permissions. This fix ensures that the rollback is processed only after the ALTER command completes. SQL Engine Windows
13598908 4511771 FIX: Full-Text search auto crawl stops when AG goes offline in SQL Server SQL Engine Windows
13598910 4563115 FIX: Upgrade script fails if you use Always On Failover Cluster Instance as a secondary replica in SQL Server SQL Engine Windows
13598912   Error occurs when DELETE from CONSTITUENT table is run, even when no matching rows exist in the referenced tables.
Msg 547, Level 16, State 0, Line LineNumber
The DELETE statement conflicted with the REFERENCE constraint "constraint name". 
The conflict occurred in database "DatabaseName", table "TableName", column 'ColumnName'.
The statement has been terminated.
SQL performance Windows
13598924   Assertion error occurs on the mirror server during redo process hitting.                               Assertion: File: <FilePath\FileName>, line = LineNumber Failed Assertion = 'result == LCK_OK' SQL Engine Windows
13598926 4560183 FIX: Distributed transactions may experience long waits with DTC_STATE wait type in SQL Server SQL Engine Windows
13598932   Assertion error occurs on the mirror server during redo process hitting.                               Assertion: File: <FilePath\FileName>, line = LineNumber Failed Assertion = 'result == LCK_OK' High availability Windows
13598936   Fixes Access Violation exception that occurs when you run a query that references a non-existing partition function in SQL Server. SQL performance Windows
13600268   "Monitor and Sync replication agent jobs" error occurs when a job runs on the new secondary replica after failover of the Availability group that hosts the distribution database for transactional replication.                                                Unable to post notification to SQLServerAgent 
(reason: The maximum number of pending SQLServerAgent notifications has been exceeded. The notification will be ignored.) 
[SQLSTATE 42000] (Error 22022). The step failed.
SQL Engine Windows
13606604 4577976 FIX: COMPILE blocking occurs when executing many concurrent stored procedures in SQL Server 2017 SQL performance Windows
13606668 4577933 FIX: Cascade delete on key values outside of leading table histogram bounds causes Index scan in SQL Server 2017 SQL performance Windows
13619763   DBCC SHRINKFLE or SHRINKDATABASE can cause an assertion exception error when executed against database or files containing system-versioned temporal tables. SQL Engine Windows
13622776 4578008 FIX: Managed backup is not backing up the database when SQL Agent system jobs are changed to different name other than 'sa' in SQL Server 2017 SQL Engine Windows
13636106   Fixes an error that occurs when you run DISCOVER_CSDL_METADATA on a DirectQuery model perspective in SSAS 2017.                                                              "OLE DB or ODBC error: We're sorry, an error occurred during evaluation.." Analysis services Windows
13637079 4578012 FIX: Unable to use Filestream on Windows Server 2012 or Windows 8 after applying SQL Server 2017 CU21 SQL Engine Windows
13641471   Fixes an unexpected exception that occurs on function XLVariable::WriteVarInfo in SSAS 2017 when you enable trace or profiler to get DAX query plan. Analysis services Windows

Notes for this update

Known issues

Under certain circumstances, there is a known uninstallation issue that affects SQL Server 2017 CU 20. After you uninstall CU 20, SQL Server doesn’t come online, and the following error entry is logged in the SQL Server log:

Mitigation is to enable Trace Flag - T902, then SQL server will come online and you are done. You don’t have to uninstall it again. To upgrade to the new CU, you have to first remove this flag.

SQL Server 2017 CU21 or any later CU release contains the fix.

Hybrid environments deployment

When you deploy an update to a hybrid environment (such as AlwaysOn, replication, cluster, and mirroring), we recommend that you refer to the following articles before you deploy the update:

More CU package information


To apply this Cumulative Update package, you must be running SQL Server 2017.

Restart information

You may have to restart the computer after you apply this Cumulative Update package.

Registry information

To use one of the hotfixes in this package, you do not have to make any changes to the registry.

Pacemaker notice


All distributions (including RHEL 7.3 and 7.4) that use the latest available Pacemaker package 1.1.18-11.el7 introduce a behavior change for the start-failure-is-fatal cluster setting when its value is false. This change affects the failover workflow. If a primary replica experiences an outage, the cluster is expected to failover to one of the available secondary replicas. Instead, users will notice that the cluster keeps trying to start the failed primary replica. If that primary never comes online (because of a permanent outage), the cluster never fails over to another available secondary replica.

This issue affects all SQL Server versions, regardless of the cumulative update version that they are on.

To mitigate the issue, use either of the following methods.

Method 1

Follow these steps:

  1. Remove the start-failure-is-fatal override from the existing cluster. 
       # RHEL, Ubuntu         pcs property unset start-failure-is-fatal         # or         pcs property set start-failure-is-fatal=true   # SLES         crm configure property start-failure-is-fatal=true
  2. Decrease the cluster-recheck-interval value. 
       # RHEL, Ubuntu         pcs property set cluster-recheck-interval=<Xmin>   # SLES         crm configure property cluster-recheck-interval=<Xmin>
  3. Add the failure-timeout meta property to each AG resource. 
       # RHEL, Ubuntu         pcs resource update ag1 meta failure-timeout=60s   # SLES         crm configure edit ag1      # In the text editor, add `meta failure-timeout=60s` after any `param`s and before any `op`s

    Note In this code, substitute the value for <Xmin> as appropriate. If a replica goes down, the cluster tries to restart the replica at an interval that is bound by the failure-timeout value and the cluster-recheck-interval value. For example, if failure-timeout is set to 60 seconds and cluster-recheck-interval is set to 120 seconds, the restart is tried at an interval that is greater than 60 seconds but less than 120 seconds. We recommend that you set failure-timeout to 60s and cluster-recheck-interval to a value that is greater than 60 seconds. Setting cluster-recheck-interval to a small value is not recommended. For more information, refer to the Pacemaker documentation or consult the system provider.

Method 2

Revert to Pacemaker version 1.1.16.

    Query Store notice


    You must run this script if you use Query Store and you are updating from SQL Server 2017 Cumulative Update 2 (CU2) directly to SQL Server 2017 Cumulative Update 3 (CU3) or any later Cumulative Update. Executing this script is not needed if you have previously installed SQL Server 2017 Cumulative Update 3 (CU3) or any later SQL Server 2017 Cumulative Update.

    SET NOCOUNT ON;DROP TABLE IF EXISTS #tmpUserDBs;SELECT [database_id], 0 AS [IsDone]INTO #tmpUserDBsFROM master.sys.databasesWHERE [database_id] > 4 AND [state] = 0 -- must be ONLINE AND is_read_only = 0 -- cannot be READ_ONLY AND [database_id] NOT IN (SELECT dr.database_id FROM sys.dm_hadr_database_replica_states dr -- Except all local Always On secondary replicas  INNER JOIN sys.dm_hadr_availability_replica_states rs ON dr.group_id = rs.group_id  INNER JOIN sys.databases d ON dr.database_id = d.database_id  WHERE rs.role = 2 -- Is Secondary   AND dr.is_local = 1   AND rs.is_local = 1)DECLARE @userDB sysname;WHILE (SELECT COUNT([database_id]) FROM #tmpUserDBs WHERE [IsDone] = 0) > 0BEGIN SELECT TOP 1 @userDB = DB_NAME([database_id]) FROM #tmpUserDBs WHERE [IsDone] = 0 -- PRINT 'Working on database ' + @userDB EXEC ('USE [' + @userDB + '];DECLARE @clearPlan bigint, @clearQry bigint;IF EXISTS (SELECT [actual_state] FROM sys.database_query_store_options WHERE [actual_state] IN (1,2))BEGIN IF EXISTS (SELECT plan_id FROM sys.query_store_plan WHERE engine_version = ''14.0.3008.27'') BEGIN  DROP TABLE IF EXISTS #tmpclearPlans;  SELECT plan_id, query_id, 0 AS [IsDone]  INTO #tmpclearPlans  FROM sys.query_store_plan WHERE engine_version = ''14.0.3008.27''  WHILE (SELECT COUNT(plan_id) FROM #tmpclearPlans WHERE [IsDone] = 0) > 0  BEGIN   SELECT TOP 1 @clearPlan = plan_id, @clearQry = query_id FROM #tmpclearPlans WHERE [IsDone] = 0   EXECUTE sys.sp_query_store_unforce_plan @clearQry, @clearPlan;   EXECUTE sys.sp_query_store_remove_plan @clearPlan;   UPDATE #tmpclearPlans   SET [IsDone] = 1   WHERE plan_id = @clearPlan AND query_id = @clearQry  END;  PRINT ''- Cleared possibly affected plans in database [' + @userDB + ']'' END ELSE BEGIN  PRINT ''- No affected plans in database [' + @userDB + ']'' ENDENDELSEBEGIN PRINT ''- Query Store not enabled in database [' + @userDB + ']''END')  UPDATE #tmpUserDBs  SET [IsDone] = 1  WHERE [database_id] = DB_ID(@userDB)END