olahallengren / sql-server-maintenance-solution

SQL Server Maintenance Solution
https://ola.hallengren.com
MIT License
2.91k stars 756 forks source link

IndexOptimize with UpdateStatistics = 'ALL' causes 'the session is in the kill state' #749

Open stanom opened 1 year ago

stanom commented 1 year ago

Description of the issue [IndexOptimize] with @UpdateStatistics = 'ALL' causes 'the session is in the kill state'

SQL Server version and edition Microsoft SQL Server 2014 (SP3-CU4-GDR) (KB4583462) - 12.0.6433.1 (X64) Oct 31 2020 02:54:45 Copyright (c) Microsoft Corporation Developer Edition (64-bit) on Windows NT 6.3 (Build 9600: ) (Hypervisor)

Version of the script 2022-12-03 17:23:44

What command are you executing? USE [master] EXECUTE [dbo].[IndexOptimize] @Databases = 'database1', @FragmentationLow = NULL, @FragmentationMedium = NULL, @FragmentationHigh = NULL, @Indexes = 'database1.dbo.TABLE1._NC_IX_TABLE1_DateTime', @UpdateStatistics = 'ALL', @OnlyModifiedStatistics = 'Y', @LogToTable = 'Y'

What output are you getting? Date and time: 2023-05-11 15:18:05 Server: TESTDB Version: 12.0.6433.1 Edition: Developer Edition (64-bit) Platform: Windows Procedure: [master].[dbo].[IndexOptimize] Parameters: @Databases = 'database1', @FragmentationLow = NULL, @FragmentationMedium = NULL, @FragmentationHigh = NULL, @FragmentationLevel1 = 5, @FragmentationLevel2 = 30, @MinNumberOfPages = 1000, @MaxNumberOfPages = NULL, @SortInTempdb = 'N', @MaxDOP = NULL, @FillFactor = NULL, @PadIndex = NULL, @LOBCompaction = 'Y', @UpdateStatistics = 'ALL', @OnlyModifiedStatistics = 'Y', @StatisticsModificationLevel = NULL, @StatisticsSample = NULL, @StatisticsResample = 'N', @PartitionLevel = 'Y', @MSShippedObjects = 'N', @Indexes = 'database1.dbo.TABLE1._NC_IX_TABLE1_DateTime', @TimeLimit = NULL, @Delay = NULL, @WaitAtLowPriorityMaxDuration = NULL, @WaitAtLowPriorityAbortAfterWait = NULL, @Resumable = 'N', @AvailabilityGroups = NULL, @LockTimeout = NULL, @LockMessageSeverity = 16, @StringDelimiter = ',', @DatabaseOrder = NULL, @DatabasesInParallel = 'N', @ExecuteAsUser = NULL, @LogToTable = 'Y', @Execute = 'Y' Version: 2022-12-03 17:23:44 Source: https://ola.hallengren.com

Date and time: 2023-05-11 15:18:05 Database: [database1] State: ONLINE Standby: No Updateability: READ_WRITE User access: MULTI_USER Recovery model: FULL Is accessible: Yes

Msg 596, Level 21, State 1, Line 0 Cannot continue the execution because the session is in the kill state. Msg 0, Level 20, State 0, Line 0 A severe error occurred on the current command. The results, if any, should be discarded.


It's UPDATE STATISTICS of _NC_IX_TABLE1_DateTime index.

stanom commented 1 year ago

When I set @UpdateStatistics = 'INDEX', the script finishes successfully.

stanom commented 1 year ago

The same error, when I set parameter @UpdateStatistics = 'COLUMNS'.