The script [IndexOptimize] is being excecuted in a Elastic Job for a SQL Azure DB, the job start to work with no issus but after some time its throw the following exception:
System.AggregateException: One or more errors occurred.
---> Command failed: A severe error occurred on the current command. The results, if any, should be discarded.
---> Microsoft.Data.SqlClient.SqlException: A severe error occurred on the current command. The results, if any, should be discarded.
at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
in D:\a_work\1\s\src\Microsoft.Data.SqlClient\netfx\src\Microsoft\Data\SqlClient\SqlConnection.cs:line 2287
at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
in D:\a_work\1\s\src\Microsoft.Data.SqlClient\netfx\src\Microsoft\Data\SqlClient\TdsParser.cs:line 1693
at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream,
BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) in
D:\a_work\1\s\src\Microsoft.Data.SqlClient\netfx\src\Microsoft\Data\SqlClient\TdsParser.cs:line 0
at Microsoft.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
in D:\a_work\1\s\src\Microsoft.Data.SqlClient\netfx\src\Microsoft\Data\SqlClient\SqlDataReader.cs:line 1333
at Microsoft.Data.SqlClient.SqlDataReader.get_MetaData() in
D:\a_work\1\s\src\Microsoft.Data.SqlClient\netfx\src\Microsoft\Data\SqlClient\SqlDataReader.cs:line 283
at Microsoft.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal,
Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) ........"
SQL Server version and edition
Microsoft SQL Azure (RTM) - 12.0.2000.8 May 22 2023 22:22:02 Copyright (C) 2022 Microsoft Corporation
Version of the script
Version: 2022-12-03 17:23:44
Description of the issue
The script [IndexOptimize] is being excecuted in a Elastic Job for a SQL Azure DB, the job start to work with no issus but after some time its throw the following exception:
System.AggregateException: One or more errors occurred. ---> Command failed: A severe error occurred on the current command. The results, if any, should be discarded. ---> Microsoft.Data.SqlClient.SqlException: A severe error occurred on the current command. The results, if any, should be discarded. at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) in D:\a_work\1\s\src\Microsoft.Data.SqlClient\netfx\src\Microsoft\Data\SqlClient\SqlConnection.cs:line 2287 at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) in D:\a_work\1\s\src\Microsoft.Data.SqlClient\netfx\src\Microsoft\Data\SqlClient\TdsParser.cs:line 1693
at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) in D:\a_work\1\s\src\Microsoft.Data.SqlClient\netfx\src\Microsoft\Data\SqlClient\TdsParser.cs:line 0 at Microsoft.Data.SqlClient.SqlDataReader.TryConsumeMetaData() in D:\a_work\1\s\src\Microsoft.Data.SqlClient\netfx\src\Microsoft\Data\SqlClient\SqlDataReader.cs:line 1333 at Microsoft.Data.SqlClient.SqlDataReader.get_MetaData() in D:\a_work\1\s\src\Microsoft.Data.SqlClient\netfx\src\Microsoft\Data\SqlClient\SqlDataReader.cs:line 283
at Microsoft.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) ........"
SQL Server version and edition Microsoft SQL Azure (RTM) - 12.0.2000.8 May 22 2023 22:22:02 Copyright (C) 2022 Microsoft Corporation
Version of the script Version: 2022-12-03 17:23:44
What command are you executing?
exec [dbo].[IndexOptimize] @Databases = 'ods', @FragmentationLow = NULL, @FragmentationMedium = 'INDEX_REORGANIZE,INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE', @FragmentationHigh = 'INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE', @FragmentationLevel1 = 5, @FragmentationLevel2 = 30, @MinNumberOfPages = 1000, @MaxNumberOfPages = 300000, @SortInTempdb = 'Y', @Indexes = 'ALL_INDEXES',-ods.dbo.dim_player_personal.ix_pres_updated_at_dim_player_personal', @LogToTable = 'Y', @LOBCompaction = 'Y', @TimeLimit= 14400, @PartitionLevel = 'Y', @MSShippedObjects = 'Y'
What output are you getting?
Command failed: A severe error occurred on the current command. The results, if any, should be discarded.