olahallengren / sql-server-maintenance-solution

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

index optimize procedure with update statistics on memory optimized tables fails #821

Open BernaLudo opened 4 weeks ago

BernaLudo commented 4 weeks ago

Description of the issue Date and time: 2024-09-19 09:30:44 Server: SQLServer\Instance1 Version: 16.0.4085.2 Edition: Enterprise Edition: Core-based Licensing (64-bit) Platform: Windows Procedure: [DbaTools].[dbo].[IndexOptimize] Parameters: @Databases = 'DB', @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 = NULL, @TimeLimit = 600, @Delay = NULL, @WaitAtLowPriorityMaxDuration = NULL, @WaitAtLowPriorityAbortAfterWait = NULL, @Resumable = 'N', @AvailabilityGroups = NULL, @LockTimeout = NULL, @LockMessageSeverity = 16, @StringDelimiter = ',', @DatabaseOrder = NULL, @DatabasesInParallel = 'N', @ExecuteAsUser = NULL, @LogToTable = 'N', @Execute = 'Y' Version: 2022-12-03 17:23:44 Source: https://ola.hallengren.com

Date and time: 2024-09-19 09:30:44 Database: [DB] State: ONLINE Standby: No Updateability: READ_WRITE User access: MULTI_USER Recovery model: SIMPLE Is accessible: Yes

Msg 41317, Level 16, State 0, Line 1 A user transaction that accesses memory optimized tables or natively compiled modules cannot access more than one user database or databases model and msdb, and it cannot write to master.

Completion time: 2024-09-19T09:30:47.0307071+02:00

SQL Server version and edition Execute SELECT @@VERSION Version: 16.0.4085.2 Edition: Enterprise Edition: Core-based Licensing (64-bit)

Version of the script

--// Source: https://ola.hallengren.com //-- --// License: https://ola.hallengren.com/license.html //-- --// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //-- --// Version: 2022-12-03 17:23:44 //--

What command are you executing? EXECUTE dbo.IndexOptimize @Databases = 'SentryOne', @FragmentationLow = NULL, @FragmentationMedium = NULL, @FragmentationHigh = NULL, @UpdateStatistics = 'ALL', @OnlyModifiedStatistics = 'Y', @TimeLimit = 600

What output are you getting? Msg 41317, Level 16, State 0, Line 1 A user transaction that accesses memory optimized tables or natively compiled modules cannot access more than one user database or databases model and msdb, and it cannot write to master.

R-dba commented 3 weeks ago

Hi, I have the same problem. SQL Version 16.0.4131.2 IndexOptimize Version: 2022-12-03 17:23:44
IndexOptimize SP, CommandExecute SP are stored in the DB where I get the error msg.

Script call: USE DB GO EXECUTE dbo.IndexOptimize

@Databases = 'DB',

@FragmentationLow = NULL ,

@FragmentationMedium = NULL ,

@FragmentationHigh = NULL ,

@UpdateStatistics = 'ALL' ,

@OnlyModifiedStatistics = N'Y' ,

@LogToTable = N'Y';

Result: Msg 41317, Level 16, State 0, Line 3 A user transaction that accesses memory optimized tables or natively compiled modules cannot access more than one user database or databases model and msdb, and it cannot write to master.