olahallengren / sql-server-maintenance-solution

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

DatabaseIntegrityCheck - DatabaseOrder DATABASE_LAST_GOOD_CHECK_ASC not managed instance aware #721

Open KitLemmonds opened 1 year ago

KitLemmonds commented 1 year ago

Description of the issue DatabaseIntegrityCheck incorrectly reports that @DatabaseOrder DATABASE_LAST_GOOD_CHECK_ASC is not compatible with this version of sql server when running on managed instance. This is because the check only looks at @Version without considering SERVERPROPERTY('EngineEdition') (8 for managed instance). Engine Edition 8 does support the DATABASE_LAST_GOOD_CHECK_ASC parameter - even in lower compatibility modes. If I comment out your error check for that parameter on managed instance with databases in SQL17 compatibility level (140), DatabaseIntegrityCheck successfully checks databases in the correct order.

SQL Server version and edition Execute SELECT @@VERSION Microsoft SQL Azure (RTM) - 12.0.2000.8 Nov 16 2022 04:43:19 Copyright (C) 2022 Microsoft Corporation

Version of the script Check the header of the stored procedure 2022-12-03 17:23:44
What command are you executing? EXEC DatabaseIntegrityCheck @Databases='mcfareports', @CheckCommands='CheckDB', @PhysicalOnly='N', @DataPurity='N', @NoIndex='N', @ExtendedLogicalChecks='Y', @TabLock='N', @Objects=NULL, @MaxDOP=2, @AvailabilityGroups=NULL, @AvailabilityGroupReplicas=NULL, @Updateability=NULL, @TimeLimit=14400, @LockTimeout=360, @LockMessageSeverity=NULL, @StringDelimiter=',', @DatabaseOrder='DATABASE_LAST_GOOD_CHECK_ASC', @DatabasesInParallel='Y', @LogToTable='Y', @Execute='N'; What output are you getting? Msg 50000, Level 16, State 2, Procedure DatabaseIntegrityCheck, Line 1017 [Batch Start Line 132] The value for the parameter @DatabaseOrder is not supported. DATABASEPROPERTYEX('DatabaseName', 'LastGoodCheckDbTime') is not available in this version of SQL Server.