From 0e11c4bcb5863fb0d7d88e80049e22142c533684 Mon Sep 17 00:00:00 2001 From: Mikey Bronowski Date: Wed, 13 Nov 2024 08:56:27 +0000 Subject: [PATCH 1/6] Security updates for SQL 2022, 2019, 2017, 2016 --- bin/dbatools-buildref-index.json | 34 +++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/bin/dbatools-buildref-index.json b/bin/dbatools-buildref-index.json index 84ea805ead..22df7b1dad 100644 --- a/bin/dbatools-buildref-index.json +++ b/bin/dbatools-buildref-index.json @@ -1,5 +1,5 @@ { - "LastUpdated": "2024-11-02T00:00:00", + "LastUpdated": "2024-11-13T00:00:00", "Data": [ { "Version": "8.0.47", @@ -4127,6 +4127,10 @@ "Version": "13.0.6450", "KBList": "5046063" }, + { + "Version": "13.0.6455", + "KBList": "5046855" + }, { "Version": "13.0.7000", "KBList": "5014242" @@ -4155,6 +4159,10 @@ "Version": "13.0.7045", "KBList": "5046062" }, + { + "Version": "13.0.7050", + "KBList": "5046856" + }, { "Version": "14.0.1", "Name": "2017" @@ -4228,6 +4236,10 @@ "Version": "14.0.2065", "KBList": "5046058" }, + { + "Version": "14.0.2070", + "KBList": "5046857" + }, { "CU": "CU1", "Version": "14.0.3006", @@ -4431,6 +4443,10 @@ "Version": "14.0.3480", "KBList": "5046061" }, + { + "Version": "14.0.3485", + "KBList": "5046858" + }, { "Version": "15.0.1000", "Name": "2019" @@ -4488,6 +4504,10 @@ "Version": "15.0.2125", "KBList": "5046056" }, + { + "Version": "15.0.2130", + "KBList": "5046859" + }, { "CU": "CU1", "Version": "15.0.4003", @@ -4666,6 +4686,10 @@ "Version": "15.0.4405", "KBList": "5046365" }, + { + "Version": "15.0.4410", + "KBList": "5046860" + }, { "Version": "16.0.100", "Name": "2022" @@ -4711,6 +4735,10 @@ "Version": "16.0.1130", "KBList": "5046057" }, + { + "Version": "16.0.1135", + "KBList": "5046861" + }, { "CU": "CU1", "Version": "16.0.4003", @@ -4809,6 +4837,10 @@ { "Version": "16.0.4150", "KBList": "5046059" + }, + { + "Version": "16.0.4155", + "KBList": "5046862" } ] } From 87174f5eaa6216dae512b3014be70f2e0d7bed56 Mon Sep 17 00:00:00 2001 From: Randolph West MSFT <97149825+rwestMSFT@users.noreply.github.com> Date: Thu, 14 Nov 2024 13:14:17 -0700 Subject: [PATCH 2/6] Update dbatools-buildref-index.json --- bin/dbatools-buildref-index.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/dbatools-buildref-index.json b/bin/dbatools-buildref-index.json index 22df7b1dad..ad06d64cd3 100644 --- a/bin/dbatools-buildref-index.json +++ b/bin/dbatools-buildref-index.json @@ -4841,6 +4841,11 @@ { "Version": "16.0.4155", "KBList": "5046862" + }, + { + "CU": "CU16", + "Version": "16.0.4165", + "KBList": "5048033" } ] } From dd8cf9f4ff3cdef8139389787ef3d42a27f4a59d Mon Sep 17 00:00:00 2001 From: Simone Bizzotto Date: Thu, 14 Nov 2024 22:08:31 +0100 Subject: [PATCH 3/6] buildref, bumping date --- bin/dbatools-buildref-index.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/dbatools-buildref-index.json b/bin/dbatools-buildref-index.json index ad06d64cd3..11be055dc9 100644 --- a/bin/dbatools-buildref-index.json +++ b/bin/dbatools-buildref-index.json @@ -1,5 +1,5 @@ { - "LastUpdated": "2024-11-13T00:00:00", + "LastUpdated": "2024-11-14T00:00:00", "Data": [ { "Version": "8.0.47", From 8b922ad81a0e3150828b345ca772afc145f9425b Mon Sep 17 00:00:00 2001 From: Andreas Jordan <66946165+andreasjordan@users.noreply.github.com> Date: Sun, 17 Nov 2024 19:27:13 +0100 Subject: [PATCH 4/6] Include new version of SQL Server Maintenance Solution by Ola Hallengren (#9550) --- bin/maintenancesolution/CommandExecute.sql | 2 +- bin/maintenancesolution/DatabaseBackup.sql | 72 +++++++++++++--- .../DatabaseIntegrityCheck.sql | 4 +- bin/maintenancesolution/IndexOptimize.sql | 4 +- .../MaintenanceSolution.sql | 84 +++++++++++++++---- 5 files changed, 135 insertions(+), 31 deletions(-) diff --git a/bin/maintenancesolution/CommandExecute.sql b/bin/maintenancesolution/CommandExecute.sql index 2246d69c47..8654475d88 100644 --- a/bin/maintenancesolution/CommandExecute.sql +++ b/bin/maintenancesolution/CommandExecute.sql @@ -36,7 +36,7 @@ BEGIN --// 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 //-- + --// Version: 2024-11-14 14:03:14 //-- ---------------------------------------------------------------------------------------------------- SET NOCOUNT ON diff --git a/bin/maintenancesolution/DatabaseBackup.sql b/bin/maintenancesolution/DatabaseBackup.sql index d804328186..f0f859f52f 100644 --- a/bin/maintenancesolution/DatabaseBackup.sql +++ b/bin/maintenancesolution/DatabaseBackup.sql @@ -16,6 +16,7 @@ ALTER PROCEDURE [dbo].[DatabaseBackup] @CleanupTime int = NULL, @CleanupMode nvarchar(max) = 'AFTER_BACKUP', @Compress nvarchar(max) = NULL, +@CompressionAlgorithm nvarchar(max) = NULL, @CopyOnly nvarchar(max) = 'N', @ChangeBackupType nvarchar(max) = 'N', @BackupSoftware nvarchar(max) = NULL, @@ -66,6 +67,7 @@ ALTER PROCEDURE [dbo].[DatabaseBackup] @ObjectLevelRecoveryMap nvarchar(max) = 'N', @ExcludeLogShippedFromLogBackup nvarchar(max) = 'Y', @DirectoryCheck nvarchar(max) = 'Y', +@BackupOptions nvarchar(max) = NULL, @StringDelimiter nvarchar(max) = ',', @DatabaseOrder nvarchar(max) = NULL, @DatabasesInParallel nvarchar(max) = 'N', @@ -80,7 +82,7 @@ BEGIN --// 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 //-- + --// Version: 2024-11-14 14:03:14 //-- ---------------------------------------------------------------------------------------------------- SET NOCOUNT ON @@ -279,6 +281,7 @@ BEGIN SET @Parameters += ', @CleanupTime = ' + ISNULL(CAST(@CleanupTime AS nvarchar),'NULL') SET @Parameters += ', @CleanupMode = ' + ISNULL('''' + REPLACE(@CleanupMode,'''','''''') + '''','NULL') SET @Parameters += ', @Compress = ' + ISNULL('''' + REPLACE(@Compress,'''','''''') + '''','NULL') + SET @Parameters += ', @CompressionAlgorithm = ' + ISNULL('''' + REPLACE(@CompressionAlgorithm,'''','''''') + '''','NULL') SET @Parameters += ', @CopyOnly = ' + ISNULL('''' + REPLACE(@CopyOnly,'''','''''') + '''','NULL') SET @Parameters += ', @ChangeBackupType = ' + ISNULL('''' + REPLACE(@ChangeBackupType,'''','''''') + '''','NULL') SET @Parameters += ', @BackupSoftware = ' + ISNULL('''' + REPLACE(@BackupSoftware,'''','''''') + '''','NULL') @@ -550,7 +553,7 @@ BEGIN GROUP BY tmpDatabases.DatabaseName) SelectedDatabases2 ON tmpDatabases.DatabaseName = SelectedDatabases2.DatabaseName - IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DatabaseName = '')) + IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DATALENGTH(DatabaseName) = 0)) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @Databases is not supported.', 16, 1 @@ -671,7 +674,7 @@ BEGIN SELECT @ErrorMessage = @ErrorMessage + QUOTENAME(DatabaseName) + ', ' FROM @tmpDatabases WHERE Selected = 1 - AND DatabaseNameFS = '' + AND DATALENGTH(DatabaseNameFS) = 0 ORDER BY DatabaseName ASC IF @@ROWCOUNT > 0 BEGIN @@ -684,7 +687,7 @@ BEGIN FROM @tmpDatabases WHERE UPPER(DatabaseNameFS) IN(SELECT UPPER(DatabaseNameFS) FROM @tmpDatabases GROUP BY UPPER(DatabaseNameFS) HAVING COUNT(*) > 1) AND UPPER(DatabaseNameFS) IN(SELECT UPPER(DatabaseNameFS) FROM @tmpDatabases WHERE Selected = 1) - AND DatabaseNameFS <> '' + AND DATALENGTH(DatabaseNameFS) > 0 ORDER BY DatabaseName ASC OPTION (RECOMPILE) IF @@ROWCOUNT > 0 @@ -961,7 +964,7 @@ BEGIN --// Check URLs //-- ---------------------------------------------------------------------------------------------------- - IF EXISTS(SELECT * FROM @URLs WHERE Mirror = 0 AND DirectoryPath NOT LIKE 'https://%/%') + IF EXISTS(SELECT * FROM @URLs WHERE Mirror = 0 AND NOT (DirectoryPath LIKE 'https://%/%' OR DirectoryPath LIKE 's3://%/%')) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @URL is not supported.', 16, 1 @@ -981,7 +984,7 @@ BEGIN ---------------------------------------------------------------------------------------------------- - IF EXISTS(SELECT * FROM @URLs WHERE Mirror = 1 AND DirectoryPath NOT LIKE 'https://%/%') + IF EXISTS(SELECT * FROM @URLs WHERE Mirror = 1 AND NOT (DirectoryPath LIKE 'https://%/%' OR DirectoryPath LIKE 's3://%/%')) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @MirrorURL is not supported.', 16, 1 @@ -1063,6 +1066,16 @@ BEGIN WHEN @BackupSoftware IS NOT NULL AND @CompressionLevel = 0 THEN 'N' END END + ---------------------------------------------------------------------------------------------------- + --// Get default compression algorithm //-- + ---------------------------------------------------------------------------------------------------- + + IF @CompressionAlgorithm IS NULL AND @BackupSoftware IS NULL AND @Version >= 16 + BEGIN + SELECT @CompressionAlgorithm = CASE WHEN @BackupSoftware IS NULL AND EXISTS(SELECT * FROM sys.configurations WHERE name = 'backup compression algorithm' AND value_in_use = 1) THEN 'MS_XPRESS' + WHEN @BackupSoftware IS NULL AND EXISTS(SELECT * FROM sys.configurations WHERE name = 'backup compression algorithm' AND value_in_use = 2) THEN 'QAT_DEFLATE' END + END + ---------------------------------------------------------------------------------------------------- --// Check input parameters //-- ---------------------------------------------------------------------------------------------------- @@ -1181,6 +1194,32 @@ BEGIN ---------------------------------------------------------------------------------------------------- + IF @CompressionAlgorithm NOT IN ('MS_XPRESS','QAT_DEFLATE') + BEGIN + INSERT INTO @Errors ([Message], Severity, [State]) + SELECT 'The value for the parameter @CompressionAlgorithm is not supported. The allowed values are MS_XPRESS and QAT_DEFLATE.', 16, 1 + END + + IF @CompressionAlgorithm IS NOT NULL AND NOT (@Version >= 16) + BEGIN + INSERT INTO @Errors ([Message], Severity, [State]) + SELECT 'The value for the parameter @CompressionAlgorithm is not supported. Specifying the compression algorithm is only supported in SQL Server 2022 and later.', 16, 2 + END + + IF @CompressionAlgorithm = 'QAT_DEFLATE' AND NOT (SERVERPROPERTY('EngineEdition') IN(2, 3)) + BEGIN + INSERT INTO @Errors ([Message], Severity, [State]) + SELECT 'The value for the parameter @CompressionAlgorithm is not supported. Setting the compression algorithm to QAT_DEFLATE is only supported in Standard and Enterprise Edition.', 16, 3 + END + + IF @CompressionAlgorithm IS NOT NULL AND @BackupSoftware IS NOT NULL + BEGIN + INSERT INTO @Errors ([Message], Severity, [State]) + SELECT 'The value for the parameter @CompressionAlgorithm is not supported. Setting the compression algorithm is only supported with SQL Server native backup', 16, 4 + END + + ---------------------------------------------------------------------------------------------------- + IF @CopyOnly NOT IN ('Y','N') OR @CopyOnly IS NULL BEGIN INSERT INTO @Errors ([Message], Severity, [State]) @@ -1295,7 +1334,7 @@ BEGIN ---------------------------------------------------------------------------------------------------- - IF @MaxTransferSize < 65536 OR @MaxTransferSize > 4194304 + IF @MaxTransferSize < 65536 OR @MaxTransferSize > 20971520 BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @MaxTransferSize is not supported.', 16, 1 @@ -1381,7 +1420,13 @@ BEGIN SELECT 'The value for the parameter @NumberOfFiles is not supported.', 16, 9 END - ---------------------------------------------------------------------------------------------------- + IF @NumberOfFiles > 32 AND @URL LIKE 's3%' AND @MirrorURL LIKE 's3%' + BEGIN + INSERT INTO @Errors ([Message], Severity, [State]) + SELECT 'The value for the parameter @NumberOfFiles is not supported. The maximum number of files when performing mirrored backups to S3 storage is 32.', 16, 10 + END + + ---------------------------------------------------------------------------------------------------- IF @MinBackupSizeForMultipleFiles <= 0 BEGIN @@ -1533,7 +1578,7 @@ BEGIN SELECT 'The value for the parameter @Encrypt is not supported.', 16, 1 END - IF @Encrypt = 'Y' AND @BackupSoftware IS NULL AND NOT (@Version >= 12 AND (SERVERPROPERTY('EngineEdition') = 3) OR SERVERPROPERTY('EditionID') IN(-1534726760, 284895786)) + IF @Encrypt = 'Y' AND @BackupSoftware IS NULL AND NOT (@Version >= 12 AND (SERVERPROPERTY('EngineEdition') IN(3, 8) OR SERVERPROPERTY('EditionID') IN(-1534726760, 284895786))) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @Encrypt is not supported.', 16, 2 @@ -1738,7 +1783,7 @@ BEGIN SELECT 'The value for the parameter @Credential is not supported.', 16, 2 END - IF @URL IS NOT NULL AND @Credential IS NULL AND NOT EXISTS(SELECT * FROM sys.credentials WHERE UPPER(credential_identity) = 'SHARED ACCESS SIGNATURE') + IF @URL IS NOT NULL AND @Credential IS NULL AND NOT EXISTS(SELECT * FROM sys.credentials WHERE UPPER(credential_identity) IN('SHARED ACCESS SIGNATURE','MANAGED IDENTITY','S3 ACCESS KEY')) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @Credential is not supported.', 16, 3 @@ -3532,6 +3577,11 @@ BEGIN SET @CurrentCommand += CASE WHEN @Compress = 'Y' AND (@CurrentIsEncrypted = 0 OR (@CurrentIsEncrypted = 1 AND ((@Version >= 13 AND @CurrentMaxTransferSize >= 65537) OR @Version >= 15.0404316 OR SERVERPROPERTY('EngineEdition') = 8))) THEN ', COMPRESSION' ELSE ', NO_COMPRESSION' END END + IF @Compress = 'Y' AND @CompressionAlgorithm IS NOT NULL + BEGIN + SET @CurrentCommand += ' (ALGORITHM = ' + @CompressionAlgorithm + ')' + END + IF @CurrentBackupType = 'DIFF' SET @CurrentCommand += ', DIFFERENTIAL' IF EXISTS(SELECT * FROM @CurrentFiles WHERE Mirror = 1) @@ -3547,6 +3597,7 @@ BEGIN IF @BufferCount IS NOT NULL SET @CurrentCommand += ', BUFFERCOUNT = ' + CAST(@BufferCount AS nvarchar) IF @CurrentMaxTransferSize IS NOT NULL SET @CurrentCommand += ', MAXTRANSFERSIZE = ' + CAST(@CurrentMaxTransferSize AS nvarchar) IF @Description IS NOT NULL SET @CurrentCommand += ', DESCRIPTION = N''' + REPLACE(@Description,'''','''''') + '''' + IF @BackupOptions IS NOT NULL SET @CurrentCommand += ', BACKUP_OPTIONS = N''' + REPLACE(@BackupOptions,'''','''''') + '''' IF @Encrypt = 'Y' SET @CurrentCommand += ', ENCRYPTION (ALGORITHM = ' + UPPER(@EncryptionAlgorithm) + ', ' IF @Encrypt = 'Y' AND @ServerCertificate IS NOT NULL SET @CurrentCommand += 'SERVER CERTIFICATE = ' + QUOTENAME(@ServerCertificate) IF @Encrypt = 'Y' AND @ServerAsymmetricKey IS NOT NULL SET @CurrentCommand += 'SERVER ASYMMETRIC KEY = ' + QUOTENAME(@ServerAsymmetricKey) @@ -3786,6 +3837,7 @@ BEGIN SET @CurrentCommand += ' WITH ' IF @CheckSum = 'Y' SET @CurrentCommand += 'CHECKSUM' IF @CheckSum = 'N' SET @CurrentCommand += 'NO_CHECKSUM' + IF @BackupOptions IS NOT NULL SET @CurrentCommand += ', RESTORE_OPTIONS = N''' + REPLACE(@BackupOptions,'''','''''') + '''' IF @URL IS NOT NULL AND @Credential IS NOT NULL SET @CurrentCommand += ', CREDENTIAL = N''' + REPLACE(@Credential,'''','''''') + '''' END diff --git a/bin/maintenancesolution/DatabaseIntegrityCheck.sql b/bin/maintenancesolution/DatabaseIntegrityCheck.sql index daaca94748..e274eb282f 100644 --- a/bin/maintenancesolution/DatabaseIntegrityCheck.sql +++ b/bin/maintenancesolution/DatabaseIntegrityCheck.sql @@ -39,7 +39,7 @@ BEGIN --// 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 //-- + --// Version: 2024-11-14 14:03:14 //-- ---------------------------------------------------------------------------------------------------- SET NOCOUNT ON @@ -429,7 +429,7 @@ BEGIN GROUP BY tmpDatabases.DatabaseName) SelectedDatabases2 ON tmpDatabases.DatabaseName = SelectedDatabases2.DatabaseName - IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DatabaseName = '')) + IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DATALENGTH(DatabaseName) = 0)) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @Databases is not supported.', 16, 1 diff --git a/bin/maintenancesolution/IndexOptimize.sql b/bin/maintenancesolution/IndexOptimize.sql index 2d49384ade..f64cd21323 100644 --- a/bin/maintenancesolution/IndexOptimize.sql +++ b/bin/maintenancesolution/IndexOptimize.sql @@ -53,7 +53,7 @@ BEGIN --// 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 //-- + --// Version: 2024-11-14 14:03:14 //-- ---------------------------------------------------------------------------------------------------- SET NOCOUNT ON @@ -521,7 +521,7 @@ BEGIN GROUP BY tmpDatabases.DatabaseName) SelectedDatabases2 ON tmpDatabases.DatabaseName = SelectedDatabases2.DatabaseName - IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DatabaseName = '')) + IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DATALENGTH(DatabaseName) = 0)) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @Databases is not supported.', 16, 1 diff --git a/bin/maintenancesolution/MaintenanceSolution.sql b/bin/maintenancesolution/MaintenanceSolution.sql index 59dd177350..1bb476b84d 100644 --- a/bin/maintenancesolution/MaintenanceSolution.sql +++ b/bin/maintenancesolution/MaintenanceSolution.sql @@ -10,7 +10,7 @@ License: https://ola.hallengren.com/license.html GitHub: https://github.com/olahallengren/sql-server-maintenance-solution -Version: 2022-12-03 17:23:44 +Version: 2024-11-14 14:03:14 You can contact me by e-mail at ola@hallengren.com. @@ -123,7 +123,7 @@ BEGIN --// 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 //-- + --// Version: 2024-11-14 14:03:14 //-- ---------------------------------------------------------------------------------------------------- SET NOCOUNT ON @@ -395,6 +395,7 @@ ALTER PROCEDURE [dbo].[DatabaseBackup] @CleanupTime int = NULL, @CleanupMode nvarchar(max) = 'AFTER_BACKUP', @Compress nvarchar(max) = NULL, +@CompressionAlgorithm nvarchar(max) = NULL, @CopyOnly nvarchar(max) = 'N', @ChangeBackupType nvarchar(max) = 'N', @BackupSoftware nvarchar(max) = NULL, @@ -445,6 +446,7 @@ ALTER PROCEDURE [dbo].[DatabaseBackup] @ObjectLevelRecoveryMap nvarchar(max) = 'N', @ExcludeLogShippedFromLogBackup nvarchar(max) = 'Y', @DirectoryCheck nvarchar(max) = 'Y', +@BackupOptions nvarchar(max) = NULL, @StringDelimiter nvarchar(max) = ',', @DatabaseOrder nvarchar(max) = NULL, @DatabasesInParallel nvarchar(max) = 'N', @@ -459,7 +461,7 @@ BEGIN --// 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 //-- + --// Version: 2024-11-14 14:03:14 //-- ---------------------------------------------------------------------------------------------------- SET NOCOUNT ON @@ -658,6 +660,7 @@ BEGIN SET @Parameters += ', @CleanupTime = ' + ISNULL(CAST(@CleanupTime AS nvarchar),'NULL') SET @Parameters += ', @CleanupMode = ' + ISNULL('''' + REPLACE(@CleanupMode,'''','''''') + '''','NULL') SET @Parameters += ', @Compress = ' + ISNULL('''' + REPLACE(@Compress,'''','''''') + '''','NULL') + SET @Parameters += ', @CompressionAlgorithm = ' + ISNULL('''' + REPLACE(@CompressionAlgorithm,'''','''''') + '''','NULL') SET @Parameters += ', @CopyOnly = ' + ISNULL('''' + REPLACE(@CopyOnly,'''','''''') + '''','NULL') SET @Parameters += ', @ChangeBackupType = ' + ISNULL('''' + REPLACE(@ChangeBackupType,'''','''''') + '''','NULL') SET @Parameters += ', @BackupSoftware = ' + ISNULL('''' + REPLACE(@BackupSoftware,'''','''''') + '''','NULL') @@ -929,7 +932,7 @@ BEGIN GROUP BY tmpDatabases.DatabaseName) SelectedDatabases2 ON tmpDatabases.DatabaseName = SelectedDatabases2.DatabaseName - IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DatabaseName = '')) + IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DATALENGTH(DatabaseName) = 0)) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @Databases is not supported.', 16, 1 @@ -1050,7 +1053,7 @@ BEGIN SELECT @ErrorMessage = @ErrorMessage + QUOTENAME(DatabaseName) + ', ' FROM @tmpDatabases WHERE Selected = 1 - AND DatabaseNameFS = '' + AND DATALENGTH(DatabaseNameFS) = 0 ORDER BY DatabaseName ASC IF @@ROWCOUNT > 0 BEGIN @@ -1063,7 +1066,7 @@ BEGIN FROM @tmpDatabases WHERE UPPER(DatabaseNameFS) IN(SELECT UPPER(DatabaseNameFS) FROM @tmpDatabases GROUP BY UPPER(DatabaseNameFS) HAVING COUNT(*) > 1) AND UPPER(DatabaseNameFS) IN(SELECT UPPER(DatabaseNameFS) FROM @tmpDatabases WHERE Selected = 1) - AND DatabaseNameFS <> '' + AND DATALENGTH(DatabaseNameFS) > 0 ORDER BY DatabaseName ASC OPTION (RECOMPILE) IF @@ROWCOUNT > 0 @@ -1340,7 +1343,7 @@ BEGIN --// Check URLs //-- ---------------------------------------------------------------------------------------------------- - IF EXISTS(SELECT * FROM @URLs WHERE Mirror = 0 AND DirectoryPath NOT LIKE 'https://%/%') + IF EXISTS(SELECT * FROM @URLs WHERE Mirror = 0 AND NOT (DirectoryPath LIKE 'https://%/%' OR DirectoryPath LIKE 's3://%/%')) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @URL is not supported.', 16, 1 @@ -1360,7 +1363,7 @@ BEGIN ---------------------------------------------------------------------------------------------------- - IF EXISTS(SELECT * FROM @URLs WHERE Mirror = 1 AND DirectoryPath NOT LIKE 'https://%/%') + IF EXISTS(SELECT * FROM @URLs WHERE Mirror = 1 AND NOT (DirectoryPath LIKE 'https://%/%' OR DirectoryPath LIKE 's3://%/%')) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @MirrorURL is not supported.', 16, 1 @@ -1442,6 +1445,16 @@ BEGIN WHEN @BackupSoftware IS NOT NULL AND @CompressionLevel = 0 THEN 'N' END END + ---------------------------------------------------------------------------------------------------- + --// Get default compression algorithm //-- + ---------------------------------------------------------------------------------------------------- + + IF @CompressionAlgorithm IS NULL AND @BackupSoftware IS NULL AND @Version >= 16 + BEGIN + SELECT @CompressionAlgorithm = CASE WHEN @BackupSoftware IS NULL AND EXISTS(SELECT * FROM sys.configurations WHERE name = 'backup compression algorithm' AND value_in_use = 1) THEN 'MS_XPRESS' + WHEN @BackupSoftware IS NULL AND EXISTS(SELECT * FROM sys.configurations WHERE name = 'backup compression algorithm' AND value_in_use = 2) THEN 'QAT_DEFLATE' END + END + ---------------------------------------------------------------------------------------------------- --// Check input parameters //-- ---------------------------------------------------------------------------------------------------- @@ -1560,6 +1573,32 @@ BEGIN ---------------------------------------------------------------------------------------------------- + IF @CompressionAlgorithm NOT IN ('MS_XPRESS','QAT_DEFLATE') + BEGIN + INSERT INTO @Errors ([Message], Severity, [State]) + SELECT 'The value for the parameter @CompressionAlgorithm is not supported. The allowed values are MS_XPRESS and QAT_DEFLATE.', 16, 1 + END + + IF @CompressionAlgorithm IS NOT NULL AND NOT (@Version >= 16) + BEGIN + INSERT INTO @Errors ([Message], Severity, [State]) + SELECT 'The value for the parameter @CompressionAlgorithm is not supported. Specifying the compression algorithm is only supported in SQL Server 2022 and later.', 16, 2 + END + + IF @CompressionAlgorithm = 'QAT_DEFLATE' AND NOT (SERVERPROPERTY('EngineEdition') IN(2, 3)) + BEGIN + INSERT INTO @Errors ([Message], Severity, [State]) + SELECT 'The value for the parameter @CompressionAlgorithm is not supported. Setting the compression algorithm to QAT_DEFLATE is only supported in Standard and Enterprise Edition.', 16, 3 + END + + IF @CompressionAlgorithm IS NOT NULL AND @BackupSoftware IS NOT NULL + BEGIN + INSERT INTO @Errors ([Message], Severity, [State]) + SELECT 'The value for the parameter @CompressionAlgorithm is not supported. Setting the compression algorithm is only supported with SQL Server native backup', 16, 4 + END + + ---------------------------------------------------------------------------------------------------- + IF @CopyOnly NOT IN ('Y','N') OR @CopyOnly IS NULL BEGIN INSERT INTO @Errors ([Message], Severity, [State]) @@ -1674,7 +1713,7 @@ BEGIN ---------------------------------------------------------------------------------------------------- - IF @MaxTransferSize < 65536 OR @MaxTransferSize > 4194304 + IF @MaxTransferSize < 65536 OR @MaxTransferSize > 20971520 BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @MaxTransferSize is not supported.', 16, 1 @@ -1760,7 +1799,13 @@ BEGIN SELECT 'The value for the parameter @NumberOfFiles is not supported.', 16, 9 END - ---------------------------------------------------------------------------------------------------- + IF @NumberOfFiles > 32 AND @URL LIKE 's3%' AND @MirrorURL LIKE 's3%' + BEGIN + INSERT INTO @Errors ([Message], Severity, [State]) + SELECT 'The value for the parameter @NumberOfFiles is not supported. The maximum number of files when performing mirrored backups to S3 storage is 32.', 16, 10 + END + + ---------------------------------------------------------------------------------------------------- IF @MinBackupSizeForMultipleFiles <= 0 BEGIN @@ -1912,7 +1957,7 @@ BEGIN SELECT 'The value for the parameter @Encrypt is not supported.', 16, 1 END - IF @Encrypt = 'Y' AND @BackupSoftware IS NULL AND NOT (@Version >= 12 AND (SERVERPROPERTY('EngineEdition') = 3) OR SERVERPROPERTY('EditionID') IN(-1534726760, 284895786)) + IF @Encrypt = 'Y' AND @BackupSoftware IS NULL AND NOT (@Version >= 12 AND (SERVERPROPERTY('EngineEdition') IN(3, 8) OR SERVERPROPERTY('EditionID') IN(-1534726760, 284895786))) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @Encrypt is not supported.', 16, 2 @@ -2117,7 +2162,7 @@ BEGIN SELECT 'The value for the parameter @Credential is not supported.', 16, 2 END - IF @URL IS NOT NULL AND @Credential IS NULL AND NOT EXISTS(SELECT * FROM sys.credentials WHERE UPPER(credential_identity) = 'SHARED ACCESS SIGNATURE') + IF @URL IS NOT NULL AND @Credential IS NULL AND NOT EXISTS(SELECT * FROM sys.credentials WHERE UPPER(credential_identity) IN('SHARED ACCESS SIGNATURE','MANAGED IDENTITY','S3 ACCESS KEY')) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @Credential is not supported.', 16, 3 @@ -3911,6 +3956,11 @@ BEGIN SET @CurrentCommand += CASE WHEN @Compress = 'Y' AND (@CurrentIsEncrypted = 0 OR (@CurrentIsEncrypted = 1 AND ((@Version >= 13 AND @CurrentMaxTransferSize >= 65537) OR @Version >= 15.0404316 OR SERVERPROPERTY('EngineEdition') = 8))) THEN ', COMPRESSION' ELSE ', NO_COMPRESSION' END END + IF @Compress = 'Y' AND @CompressionAlgorithm IS NOT NULL + BEGIN + SET @CurrentCommand += ' (ALGORITHM = ' + @CompressionAlgorithm + ')' + END + IF @CurrentBackupType = 'DIFF' SET @CurrentCommand += ', DIFFERENTIAL' IF EXISTS(SELECT * FROM @CurrentFiles WHERE Mirror = 1) @@ -3926,6 +3976,7 @@ BEGIN IF @BufferCount IS NOT NULL SET @CurrentCommand += ', BUFFERCOUNT = ' + CAST(@BufferCount AS nvarchar) IF @CurrentMaxTransferSize IS NOT NULL SET @CurrentCommand += ', MAXTRANSFERSIZE = ' + CAST(@CurrentMaxTransferSize AS nvarchar) IF @Description IS NOT NULL SET @CurrentCommand += ', DESCRIPTION = N''' + REPLACE(@Description,'''','''''') + '''' + IF @BackupOptions IS NOT NULL SET @CurrentCommand += ', BACKUP_OPTIONS = N''' + REPLACE(@BackupOptions,'''','''''') + '''' IF @Encrypt = 'Y' SET @CurrentCommand += ', ENCRYPTION (ALGORITHM = ' + UPPER(@EncryptionAlgorithm) + ', ' IF @Encrypt = 'Y' AND @ServerCertificate IS NOT NULL SET @CurrentCommand += 'SERVER CERTIFICATE = ' + QUOTENAME(@ServerCertificate) IF @Encrypt = 'Y' AND @ServerAsymmetricKey IS NOT NULL SET @CurrentCommand += 'SERVER ASYMMETRIC KEY = ' + QUOTENAME(@ServerAsymmetricKey) @@ -4165,6 +4216,7 @@ BEGIN SET @CurrentCommand += ' WITH ' IF @CheckSum = 'Y' SET @CurrentCommand += 'CHECKSUM' IF @CheckSum = 'N' SET @CurrentCommand += 'NO_CHECKSUM' + IF @BackupOptions IS NOT NULL SET @CurrentCommand += ', RESTORE_OPTIONS = N''' + REPLACE(@BackupOptions,'''','''''') + '''' IF @URL IS NOT NULL AND @Credential IS NOT NULL SET @CurrentCommand += ', CREDENTIAL = N''' + REPLACE(@Credential,'''','''''') + '''' END @@ -4502,7 +4554,7 @@ BEGIN --// 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 //-- + --// Version: 2024-11-14 14:03:14 //-- ---------------------------------------------------------------------------------------------------- SET NOCOUNT ON @@ -4892,7 +4944,7 @@ BEGIN GROUP BY tmpDatabases.DatabaseName) SelectedDatabases2 ON tmpDatabases.DatabaseName = SelectedDatabases2.DatabaseName - IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DatabaseName = '')) + IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DATALENGTH(DatabaseName) = 0)) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @Databases is not supported.', 16, 1 @@ -6404,7 +6456,7 @@ BEGIN --// 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 //-- + --// Version: 2024-11-14 14:03:14 //-- ---------------------------------------------------------------------------------------------------- SET NOCOUNT ON @@ -6872,7 +6924,7 @@ BEGIN GROUP BY tmpDatabases.DatabaseName) SelectedDatabases2 ON tmpDatabases.DatabaseName = SelectedDatabases2.DatabaseName - IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DatabaseName = '')) + IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DATALENGTH(DatabaseName) = 0)) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @Databases is not supported.', 16, 1 From b6043dcc2a2fc9e3a48f2c2a06960b369956d42b Mon Sep 17 00:00:00 2001 From: Andreas Jordan <66946165+andreasjordan@users.noreply.github.com> Date: Sun, 17 Nov 2024 19:27:52 +0100 Subject: [PATCH 5/6] Fix for installation of SQL Server Maintenance Solution by Ola Hallengren: Changed name of branch from master to main (#9549) --- public/Install-DbaMaintenanceSolution.ps1 | 2 +- public/Save-DbaCommunitySoftware.ps1 | 2 +- public/Update-DbaMaintenanceSolution.ps1 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/Install-DbaMaintenanceSolution.ps1 b/public/Install-DbaMaintenanceSolution.ps1 index cded18dca9..0a2c1b1acc 100644 --- a/public/Install-DbaMaintenanceSolution.ps1 +++ b/public/Install-DbaMaintenanceSolution.ps1 @@ -258,7 +258,7 @@ function Install-DbaMaintenanceSolution { if (-not $localCachedCopy) { # Do we need a fresly cached version of the software? $dbatoolsData = Get-DbatoolsConfigValue -FullName 'Path.DbatoolsData' - $localCachedCopy = Join-DbaPath -Path $dbatoolsData -Child 'sql-server-maintenance-solution-master' + $localCachedCopy = Join-DbaPath -Path $dbatoolsData -Child 'sql-server-maintenance-solution-main' if ($Force -or $LocalFile -or -not (Test-Path -Path $localCachedCopy)) { if ($PSCmdlet.ShouldProcess('MaintenanceSolution', 'Update local cached copy of the software')) { try { diff --git a/public/Save-DbaCommunitySoftware.ps1 b/public/Save-DbaCommunitySoftware.ps1 index 97b22e95a8..5d8d6ba467 100644 --- a/public/Save-DbaCommunitySoftware.ps1 +++ b/public/Save-DbaCommunitySoftware.ps1 @@ -91,7 +91,7 @@ function Save-DbaCommunitySoftware { # Set Branch, Url and LocalDirectory for known Software if ($Software -eq 'MaintenanceSolution') { if (-not $Branch) { - $Branch = 'master' + $Branch = 'main' } if (-not $Url) { $Url = "https://github.com/olahallengren/sql-server-maintenance-solution/archive/$Branch.zip" diff --git a/public/Update-DbaMaintenanceSolution.ps1 b/public/Update-DbaMaintenanceSolution.ps1 index 6666994045..b30328c275 100644 --- a/public/Update-DbaMaintenanceSolution.ps1 +++ b/public/Update-DbaMaintenanceSolution.ps1 @@ -89,7 +89,7 @@ function Update-DbaMaintenanceSolution { # Do we need a new local cached version of the software? $dbatoolsData = Get-DbatoolsConfigValue -FullName 'Path.DbatoolsData' - $localCachedCopy = Join-DbaPath -Path $dbatoolsData -Child 'sql-server-maintenance-solution-master' + $localCachedCopy = Join-DbaPath -Path $dbatoolsData -Child 'sql-server-maintenance-solution-main' if ($Force -or $LocalFile -or -not (Test-Path -Path $localCachedCopy)) { if ($PSCmdlet.ShouldProcess('MaintenanceSolution', 'Update local cached copy of the software')) { try { From 8669cd6e93077148d49623a78c3f9b2f2f081ac2 Mon Sep 17 00:00:00 2001 From: Chrissy LeMaire Date: Sun, 17 Nov 2024 19:37:32 +0100 Subject: [PATCH 6/6] v2.1.28 --- .../SQLServerDiagnosticQueries_2016SP2.sql | 7 +- .../SQLServerDiagnosticQueries_2017.sql | 5 +- .../SQLServerDiagnosticQueries_2019.sql | 5 +- .../SQLServerDiagnosticQueries_2022.sql | 6 +- bin/maintenancesolution/CommandExecute.sql | 2 +- bin/maintenancesolution/DatabaseBackup.sql | 72 +++------------- .../DatabaseIntegrityCheck.sql | 4 +- bin/maintenancesolution/IndexOptimize.sql | 4 +- .../MaintenanceSolution.sql | 84 ++++--------------- dbatools.psd1 | 2 +- 10 files changed, 50 insertions(+), 141 deletions(-) diff --git a/bin/diagnosticquery/SQLServerDiagnosticQueries_2016SP2.sql b/bin/diagnosticquery/SQLServerDiagnosticQueries_2016SP2.sql index e45502a9fe..a8cb845ebe 100644 --- a/bin/diagnosticquery/SQLServerDiagnosticQueries_2016SP2.sql +++ b/bin/diagnosticquery/SQLServerDiagnosticQueries_2016SP2.sql @@ -1,7 +1,7 @@ -- SQL Server 2016 SP2 Diagnostic Information Queries -- Glenn Berry --- Last Modified: November 1, 2024 +-- Last Modified: November 13, 2024 -- https://glennsqlperformance.com/ -- https://sqlserverperformance.wordpress.com/ -- YouTube: https://bit.ly/2PkoAM1 @@ -94,6 +94,8 @@ SELECT @@SERVERNAME AS [Server Name], @@VERSION AS [SQL Server and OS Version In -- 13.0.6435.1 SP3 + GDR 10/10/2023 https://support.microsoft.com/en-us/topic/kb5029186-description-of-the-security-update-for-sql-server-2016-sp3-gdr-october-10-2023-618b034a-d575-48e0-804a-7b481ba2e600 -- 13.0.6441.1 SP3 + GDR 7/9/2024 https://support.microsoft.com/en-us/topic/kb5040946-description-of-the-security-update-for-sql-server-2016-sp3-gdr-july-9-2024-e943f6a8-7a97-41b4-804c-c52ca775f5dd -- 13.0.6445.1 SP3 + GDR 9/10/2024 https://support.microsoft.com/en-us/topic/kb5042207-description-of-the-security-update-for-sql-server-2016-sp3-gdr-september-10-2024-e27a41df-009d-4a50-85e7-dc8f06b9a5a5 +-- 13.0.6450.1 SP3 + GDR 10/8/2024 https://support.microsoft.com/en-us/topic/kb5046063-description-of-the-security-update-for-sql-server-2016-sp3-gdr-october-8-2024-87f6091b-a0c0-48e7-8de4-b10381559ba7 +-- 13.0.6455.2 SP3 + GDR 11/12/2024 https://support.microsoft.com/en-us/topic/kb5046855-description-of-the-security-update-for-sql-server-2016-sp3-gdr-november-12-2024-736b0a32-912d-4ea5-baf8-50d046cbfa1a -- Azure Connect Pack Builds -- 13.0.7000.253 Azure Connect Pack 5/19/2022 https://learn.microsoft.com/en-us/troubleshoot/sql/releases/sqlserver-2016/servicepack3-azureconnect @@ -102,6 +104,9 @@ SELECT @@SERVERNAME AS [Server Name], @@VERSION AS [SQL Server and OS Version In -- 13.0.7029.3 Azure Connect Pack + GDR 10/10/2023 https://support.microsoft.com/en-us/topic/kb5029187-description-of-the-security-update-for-sql-server-2016-sp3-azure-connect-feature-pack-october-10-2023-e5541468-f243-4000-872c-ac782cfad99f -- 13.0.7037.1 Azure Connect Pack + GDR 7/9/2024 https://support.microsoft.com/en-us/topic/kb5040944-description-of-the-security-update-for-sql-server-2016-sp3-azure-connect-feature-pack-july-9-2024-72b636c9-0619-4c44-b263-f3d7478bcd75 -- 13.0.7040.1 Azure Connect Pack + GDR 9/10/2024 https://support.microsoft.com/en-us/topic/kb5042207-description-of-the-security-update-for-sql-server-2016-sp3-gdr-september-10-2024-e27a41df-009d-4a50-85e7-dc8f06b9a5a5 +-- 13.0.7045.2 Azure Connect Pack + GDR 10/8/2024 https://support.microsoft.com/en-us/topic/kb5046062-description-of-the-security-update-for-sql-server-2016-sp3-azure-connect-feature-pack-october-8-2024-fb7d9289-bbef-4d1f-bd71-fb3e036d81ae +-- 13.0.7050.2 Azure Connect Pack + GDR 11/12/2024 https://support.microsoft.com/en-us/topic/kb5046856-description-of-the-security-update-for-sql-server-2016-sp3-azure-connect-feature-pack-november-12-2024-b180cac0-187e-48eb-b6c6-3d48d0a00902 + -- How to determine the version, edition and update level of SQL Server and its components -- https://bit.ly/2oAjKgW diff --git a/bin/diagnosticquery/SQLServerDiagnosticQueries_2017.sql b/bin/diagnosticquery/SQLServerDiagnosticQueries_2017.sql index bfd64e3147..3b0e85aed6 100644 --- a/bin/diagnosticquery/SQLServerDiagnosticQueries_2017.sql +++ b/bin/diagnosticquery/SQLServerDiagnosticQueries_2017.sql @@ -1,7 +1,7 @@ -- SQL Server 2017 Diagnostic Information Queries -- Glenn Berry --- Last Modified: November 1, 2024 +-- Last Modified: November 13, 2024 -- https://glennsqlperformance.com/ -- https://sqlserverperformance.wordpress.com/ -- YouTube: https://bit.ly/2PkoAM1 @@ -108,6 +108,9 @@ SELECT @@SERVERNAME AS [Server Name], @@VERSION AS [SQL Server and OS Version In -- 14.0.3465.1 CU31 + GDR 10/10/2023 https://support.microsoft.com/en-us/topic/kb5029376-description-of-the-security-update-for-sql-server-2017-cu31-october-10-2023-ce23ddf7-b79e-4ba7-ba9d-2679f23a1ad8 -- 14.0.3471.2 CU31 + GDR 7/9/2024 https://support.microsoft.com/en-us/topic/kb5040940-description-of-the-security-update-for-sql-server-2017-cu31-july-9-2024-bff7ab26-e882-4419-aebb-30356125f5c9 -- 14.0.3475.1 CU31 + GDR 9/10/2024 https://support.microsoft.com/en-us/topic/kb5042215-description-of-the-security-update-for-sql-server-2017-cu31-september-10-2024-55bba26f-548d-466c-9c48-edfb51a53a8a +-- 14.0.3480.1 CU31 + GDR 10/8/2024 https://support.microsoft.com/en-us/topic/kb5046061-description-of-the-security-update-for-sql-server-2017-cu31-october-8-2024-af669e75-bc43-4679-bfbe-e153e679dd2f +-- 14.0.3485.1 CU31 + GDR 11/12/2024 https://support.microsoft.com/en-us/topic/kb5046858-description-of-the-security-update-for-sql-server-2017-cu31-november-12-2024-2984d3a5-0683-4f9b-9e6a-3888e67bd859 + -- How to determine the version, edition and update level of SQL Server and its components -- https://bit.ly/2oAjKgW diff --git a/bin/diagnosticquery/SQLServerDiagnosticQueries_2019.sql b/bin/diagnosticquery/SQLServerDiagnosticQueries_2019.sql index 980f2092e0..3a9fdfe82d 100644 --- a/bin/diagnosticquery/SQLServerDiagnosticQueries_2019.sql +++ b/bin/diagnosticquery/SQLServerDiagnosticQueries_2019.sql @@ -1,7 +1,7 @@ -- SQL Server 2019 Diagnostic Information Queries -- Glenn Berry --- Last Modified: November 1, 2024 +-- Last Modified: November 13, 2024 -- https://glennsqlperformance.com/ -- https://sqlserverperformance.wordpress.com/ -- YouTube: https://bit.ly/2PkoAM1 @@ -105,7 +105,8 @@ SELECT @@SERVERNAME AS [Server Name], @@VERSION AS [SQL Server and OS Version In -- 15.0.4382.1 CU27 + GDR 7/9/2024 https://support.microsoft.com/en-us/topic/kb5040948-description-of-the-security-update-for-sql-server-2019-cu27-july-9-2024-6447dc00-9f1b-484c-9d3d-9e1f1b9f915c -- 15.0.4385.2 CU28 8/1/2024 https://learn.microsoft.com/en-us/troubleshoot/sql/releases/sqlserver-2019/cumulativeupdate28 -- 15.0.4390.2 CU28 + GDR 9/10/2024 https://support.microsoft.com/en-us/topic/kb5042749-description-of-the-security-update-for-sql-server-2019-cu28-september-10-2024-17402ce5-07d3-4e30-9037-9ef997104f34 --- 15.0.4405.4 CU29 11/1/2024 https://learn.microsoft.com/en-us/troubleshoot/sql/releases/sqlserver-2019/cumulativeupdate29 +-- 15.0.4405.4 CU29 10/31/2024 https://learn.microsoft.com/en-us/troubleshoot/sql/releases/sqlserver-2019/cumulativeupdate29 +-- 15.0.4410.1 CU29 + GDR 11/12/2024 https://support.microsoft.com/en-us/topic/kb5046860-description-of-the-security-update-for-sql-server-2019-cu29-november-12-2024-4bddde28-482c-4628-a6e2-2d4f542088b7 -- How to determine the version, edition and update level of SQL Server and its components diff --git a/bin/diagnosticquery/SQLServerDiagnosticQueries_2022.sql b/bin/diagnosticquery/SQLServerDiagnosticQueries_2022.sql index 380a83b894..958d6a26ac 100644 --- a/bin/diagnosticquery/SQLServerDiagnosticQueries_2022.sql +++ b/bin/diagnosticquery/SQLServerDiagnosticQueries_2022.sql @@ -1,7 +1,7 @@ -- SQL Server 2022 Diagnostic Information Queries -- Glenn Berry --- Last Modified: November 1, 2024 +-- Last Modified: November 15, 2024 -- https://glennsqlperformance.com/ -- https://sqlserverperformance.wordpress.com/ -- YouTube: https://bit.ly/2PkoAM1 @@ -84,6 +84,10 @@ SELECT @@SERVERNAME AS [Server Name], @@VERSION AS [SQL Server and OS Version In -- 16.0.4135.4 CU14 7/23/2024 https://learn.microsoft.com/en-us/troubleshoot/sql/releases/sqlserver-2022/cumulativeupdate14 -- 16.0.4140.3 CU14 + GDR 9/10/2024 https://support.microsoft.com/en-us/topic/kb5042578-description-of-the-security-update-for-sql-server-2022-cu14-september-10-2024-560e6e4c-1f49-4c18-9eb7-054e9fdee3c7 -- 16.0.4145.4 CU15 9/25/2024 https://learn.microsoft.com/en-us/troubleshoot/sql/releases/sqlserver-2022/cumulativeupdate15 +-- 16.0.4150.1 CU15 + GDR 10/8/2024 https://support.microsoft.com/en-us/topic/kb5046059-description-of-the-security-update-for-sql-server-2022-cu15-october-8-2024-b592d86f-3351-4f9f-9c80-ef495a0137c1 +-- 16.0.4155.4 CU15 + GDR 11/12/2024 https://support.microsoft.com/en-us/topic/kb5046862-description-of-the-security-update-for-sql-server-2022-cu15-november-12-2024-ab9f3a55-8264-44e9-9a40-0b32bcd83df0 +-- 16.0.4165.4 CU16 11/14/2024 https://learn.microsoft.com/en-us/troubleshoot/sql/releases/sqlserver-2022/cumulativeupdate16 + -- What's new in SQL Server 2022 (16.x) -- https://bit.ly/3MJEjR1 diff --git a/bin/maintenancesolution/CommandExecute.sql b/bin/maintenancesolution/CommandExecute.sql index 8654475d88..2246d69c47 100644 --- a/bin/maintenancesolution/CommandExecute.sql +++ b/bin/maintenancesolution/CommandExecute.sql @@ -36,7 +36,7 @@ BEGIN --// Source: https://ola.hallengren.com //-- --// License: https://ola.hallengren.com/license.html //-- --// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //-- - --// Version: 2024-11-14 14:03:14 //-- + --// Version: 2022-12-03 17:23:44 //-- ---------------------------------------------------------------------------------------------------- SET NOCOUNT ON diff --git a/bin/maintenancesolution/DatabaseBackup.sql b/bin/maintenancesolution/DatabaseBackup.sql index f0f859f52f..d804328186 100644 --- a/bin/maintenancesolution/DatabaseBackup.sql +++ b/bin/maintenancesolution/DatabaseBackup.sql @@ -16,7 +16,6 @@ ALTER PROCEDURE [dbo].[DatabaseBackup] @CleanupTime int = NULL, @CleanupMode nvarchar(max) = 'AFTER_BACKUP', @Compress nvarchar(max) = NULL, -@CompressionAlgorithm nvarchar(max) = NULL, @CopyOnly nvarchar(max) = 'N', @ChangeBackupType nvarchar(max) = 'N', @BackupSoftware nvarchar(max) = NULL, @@ -67,7 +66,6 @@ ALTER PROCEDURE [dbo].[DatabaseBackup] @ObjectLevelRecoveryMap nvarchar(max) = 'N', @ExcludeLogShippedFromLogBackup nvarchar(max) = 'Y', @DirectoryCheck nvarchar(max) = 'Y', -@BackupOptions nvarchar(max) = NULL, @StringDelimiter nvarchar(max) = ',', @DatabaseOrder nvarchar(max) = NULL, @DatabasesInParallel nvarchar(max) = 'N', @@ -82,7 +80,7 @@ BEGIN --// Source: https://ola.hallengren.com //-- --// License: https://ola.hallengren.com/license.html //-- --// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //-- - --// Version: 2024-11-14 14:03:14 //-- + --// Version: 2022-12-03 17:23:44 //-- ---------------------------------------------------------------------------------------------------- SET NOCOUNT ON @@ -281,7 +279,6 @@ BEGIN SET @Parameters += ', @CleanupTime = ' + ISNULL(CAST(@CleanupTime AS nvarchar),'NULL') SET @Parameters += ', @CleanupMode = ' + ISNULL('''' + REPLACE(@CleanupMode,'''','''''') + '''','NULL') SET @Parameters += ', @Compress = ' + ISNULL('''' + REPLACE(@Compress,'''','''''') + '''','NULL') - SET @Parameters += ', @CompressionAlgorithm = ' + ISNULL('''' + REPLACE(@CompressionAlgorithm,'''','''''') + '''','NULL') SET @Parameters += ', @CopyOnly = ' + ISNULL('''' + REPLACE(@CopyOnly,'''','''''') + '''','NULL') SET @Parameters += ', @ChangeBackupType = ' + ISNULL('''' + REPLACE(@ChangeBackupType,'''','''''') + '''','NULL') SET @Parameters += ', @BackupSoftware = ' + ISNULL('''' + REPLACE(@BackupSoftware,'''','''''') + '''','NULL') @@ -553,7 +550,7 @@ BEGIN GROUP BY tmpDatabases.DatabaseName) SelectedDatabases2 ON tmpDatabases.DatabaseName = SelectedDatabases2.DatabaseName - IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DATALENGTH(DatabaseName) = 0)) + IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DatabaseName = '')) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @Databases is not supported.', 16, 1 @@ -674,7 +671,7 @@ BEGIN SELECT @ErrorMessage = @ErrorMessage + QUOTENAME(DatabaseName) + ', ' FROM @tmpDatabases WHERE Selected = 1 - AND DATALENGTH(DatabaseNameFS) = 0 + AND DatabaseNameFS = '' ORDER BY DatabaseName ASC IF @@ROWCOUNT > 0 BEGIN @@ -687,7 +684,7 @@ BEGIN FROM @tmpDatabases WHERE UPPER(DatabaseNameFS) IN(SELECT UPPER(DatabaseNameFS) FROM @tmpDatabases GROUP BY UPPER(DatabaseNameFS) HAVING COUNT(*) > 1) AND UPPER(DatabaseNameFS) IN(SELECT UPPER(DatabaseNameFS) FROM @tmpDatabases WHERE Selected = 1) - AND DATALENGTH(DatabaseNameFS) > 0 + AND DatabaseNameFS <> '' ORDER BY DatabaseName ASC OPTION (RECOMPILE) IF @@ROWCOUNT > 0 @@ -964,7 +961,7 @@ BEGIN --// Check URLs //-- ---------------------------------------------------------------------------------------------------- - IF EXISTS(SELECT * FROM @URLs WHERE Mirror = 0 AND NOT (DirectoryPath LIKE 'https://%/%' OR DirectoryPath LIKE 's3://%/%')) + IF EXISTS(SELECT * FROM @URLs WHERE Mirror = 0 AND DirectoryPath NOT LIKE 'https://%/%') BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @URL is not supported.', 16, 1 @@ -984,7 +981,7 @@ BEGIN ---------------------------------------------------------------------------------------------------- - IF EXISTS(SELECT * FROM @URLs WHERE Mirror = 1 AND NOT (DirectoryPath LIKE 'https://%/%' OR DirectoryPath LIKE 's3://%/%')) + IF EXISTS(SELECT * FROM @URLs WHERE Mirror = 1 AND DirectoryPath NOT LIKE 'https://%/%') BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @MirrorURL is not supported.', 16, 1 @@ -1066,16 +1063,6 @@ BEGIN WHEN @BackupSoftware IS NOT NULL AND @CompressionLevel = 0 THEN 'N' END END - ---------------------------------------------------------------------------------------------------- - --// Get default compression algorithm //-- - ---------------------------------------------------------------------------------------------------- - - IF @CompressionAlgorithm IS NULL AND @BackupSoftware IS NULL AND @Version >= 16 - BEGIN - SELECT @CompressionAlgorithm = CASE WHEN @BackupSoftware IS NULL AND EXISTS(SELECT * FROM sys.configurations WHERE name = 'backup compression algorithm' AND value_in_use = 1) THEN 'MS_XPRESS' - WHEN @BackupSoftware IS NULL AND EXISTS(SELECT * FROM sys.configurations WHERE name = 'backup compression algorithm' AND value_in_use = 2) THEN 'QAT_DEFLATE' END - END - ---------------------------------------------------------------------------------------------------- --// Check input parameters //-- ---------------------------------------------------------------------------------------------------- @@ -1194,32 +1181,6 @@ BEGIN ---------------------------------------------------------------------------------------------------- - IF @CompressionAlgorithm NOT IN ('MS_XPRESS','QAT_DEFLATE') - BEGIN - INSERT INTO @Errors ([Message], Severity, [State]) - SELECT 'The value for the parameter @CompressionAlgorithm is not supported. The allowed values are MS_XPRESS and QAT_DEFLATE.', 16, 1 - END - - IF @CompressionAlgorithm IS NOT NULL AND NOT (@Version >= 16) - BEGIN - INSERT INTO @Errors ([Message], Severity, [State]) - SELECT 'The value for the parameter @CompressionAlgorithm is not supported. Specifying the compression algorithm is only supported in SQL Server 2022 and later.', 16, 2 - END - - IF @CompressionAlgorithm = 'QAT_DEFLATE' AND NOT (SERVERPROPERTY('EngineEdition') IN(2, 3)) - BEGIN - INSERT INTO @Errors ([Message], Severity, [State]) - SELECT 'The value for the parameter @CompressionAlgorithm is not supported. Setting the compression algorithm to QAT_DEFLATE is only supported in Standard and Enterprise Edition.', 16, 3 - END - - IF @CompressionAlgorithm IS NOT NULL AND @BackupSoftware IS NOT NULL - BEGIN - INSERT INTO @Errors ([Message], Severity, [State]) - SELECT 'The value for the parameter @CompressionAlgorithm is not supported. Setting the compression algorithm is only supported with SQL Server native backup', 16, 4 - END - - ---------------------------------------------------------------------------------------------------- - IF @CopyOnly NOT IN ('Y','N') OR @CopyOnly IS NULL BEGIN INSERT INTO @Errors ([Message], Severity, [State]) @@ -1334,7 +1295,7 @@ BEGIN ---------------------------------------------------------------------------------------------------- - IF @MaxTransferSize < 65536 OR @MaxTransferSize > 20971520 + IF @MaxTransferSize < 65536 OR @MaxTransferSize > 4194304 BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @MaxTransferSize is not supported.', 16, 1 @@ -1420,13 +1381,7 @@ BEGIN SELECT 'The value for the parameter @NumberOfFiles is not supported.', 16, 9 END - IF @NumberOfFiles > 32 AND @URL LIKE 's3%' AND @MirrorURL LIKE 's3%' - BEGIN - INSERT INTO @Errors ([Message], Severity, [State]) - SELECT 'The value for the parameter @NumberOfFiles is not supported. The maximum number of files when performing mirrored backups to S3 storage is 32.', 16, 10 - END - - ---------------------------------------------------------------------------------------------------- + ---------------------------------------------------------------------------------------------------- IF @MinBackupSizeForMultipleFiles <= 0 BEGIN @@ -1578,7 +1533,7 @@ BEGIN SELECT 'The value for the parameter @Encrypt is not supported.', 16, 1 END - IF @Encrypt = 'Y' AND @BackupSoftware IS NULL AND NOT (@Version >= 12 AND (SERVERPROPERTY('EngineEdition') IN(3, 8) OR SERVERPROPERTY('EditionID') IN(-1534726760, 284895786))) + IF @Encrypt = 'Y' AND @BackupSoftware IS NULL AND NOT (@Version >= 12 AND (SERVERPROPERTY('EngineEdition') = 3) OR SERVERPROPERTY('EditionID') IN(-1534726760, 284895786)) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @Encrypt is not supported.', 16, 2 @@ -1783,7 +1738,7 @@ BEGIN SELECT 'The value for the parameter @Credential is not supported.', 16, 2 END - IF @URL IS NOT NULL AND @Credential IS NULL AND NOT EXISTS(SELECT * FROM sys.credentials WHERE UPPER(credential_identity) IN('SHARED ACCESS SIGNATURE','MANAGED IDENTITY','S3 ACCESS KEY')) + IF @URL IS NOT NULL AND @Credential IS NULL AND NOT EXISTS(SELECT * FROM sys.credentials WHERE UPPER(credential_identity) = 'SHARED ACCESS SIGNATURE') BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @Credential is not supported.', 16, 3 @@ -3577,11 +3532,6 @@ BEGIN SET @CurrentCommand += CASE WHEN @Compress = 'Y' AND (@CurrentIsEncrypted = 0 OR (@CurrentIsEncrypted = 1 AND ((@Version >= 13 AND @CurrentMaxTransferSize >= 65537) OR @Version >= 15.0404316 OR SERVERPROPERTY('EngineEdition') = 8))) THEN ', COMPRESSION' ELSE ', NO_COMPRESSION' END END - IF @Compress = 'Y' AND @CompressionAlgorithm IS NOT NULL - BEGIN - SET @CurrentCommand += ' (ALGORITHM = ' + @CompressionAlgorithm + ')' - END - IF @CurrentBackupType = 'DIFF' SET @CurrentCommand += ', DIFFERENTIAL' IF EXISTS(SELECT * FROM @CurrentFiles WHERE Mirror = 1) @@ -3597,7 +3547,6 @@ BEGIN IF @BufferCount IS NOT NULL SET @CurrentCommand += ', BUFFERCOUNT = ' + CAST(@BufferCount AS nvarchar) IF @CurrentMaxTransferSize IS NOT NULL SET @CurrentCommand += ', MAXTRANSFERSIZE = ' + CAST(@CurrentMaxTransferSize AS nvarchar) IF @Description IS NOT NULL SET @CurrentCommand += ', DESCRIPTION = N''' + REPLACE(@Description,'''','''''') + '''' - IF @BackupOptions IS NOT NULL SET @CurrentCommand += ', BACKUP_OPTIONS = N''' + REPLACE(@BackupOptions,'''','''''') + '''' IF @Encrypt = 'Y' SET @CurrentCommand += ', ENCRYPTION (ALGORITHM = ' + UPPER(@EncryptionAlgorithm) + ', ' IF @Encrypt = 'Y' AND @ServerCertificate IS NOT NULL SET @CurrentCommand += 'SERVER CERTIFICATE = ' + QUOTENAME(@ServerCertificate) IF @Encrypt = 'Y' AND @ServerAsymmetricKey IS NOT NULL SET @CurrentCommand += 'SERVER ASYMMETRIC KEY = ' + QUOTENAME(@ServerAsymmetricKey) @@ -3837,7 +3786,6 @@ BEGIN SET @CurrentCommand += ' WITH ' IF @CheckSum = 'Y' SET @CurrentCommand += 'CHECKSUM' IF @CheckSum = 'N' SET @CurrentCommand += 'NO_CHECKSUM' - IF @BackupOptions IS NOT NULL SET @CurrentCommand += ', RESTORE_OPTIONS = N''' + REPLACE(@BackupOptions,'''','''''') + '''' IF @URL IS NOT NULL AND @Credential IS NOT NULL SET @CurrentCommand += ', CREDENTIAL = N''' + REPLACE(@Credential,'''','''''') + '''' END diff --git a/bin/maintenancesolution/DatabaseIntegrityCheck.sql b/bin/maintenancesolution/DatabaseIntegrityCheck.sql index e274eb282f..daaca94748 100644 --- a/bin/maintenancesolution/DatabaseIntegrityCheck.sql +++ b/bin/maintenancesolution/DatabaseIntegrityCheck.sql @@ -39,7 +39,7 @@ BEGIN --// Source: https://ola.hallengren.com //-- --// License: https://ola.hallengren.com/license.html //-- --// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //-- - --// Version: 2024-11-14 14:03:14 //-- + --// Version: 2022-12-03 17:23:44 //-- ---------------------------------------------------------------------------------------------------- SET NOCOUNT ON @@ -429,7 +429,7 @@ BEGIN GROUP BY tmpDatabases.DatabaseName) SelectedDatabases2 ON tmpDatabases.DatabaseName = SelectedDatabases2.DatabaseName - IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DATALENGTH(DatabaseName) = 0)) + IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DatabaseName = '')) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @Databases is not supported.', 16, 1 diff --git a/bin/maintenancesolution/IndexOptimize.sql b/bin/maintenancesolution/IndexOptimize.sql index f64cd21323..2d49384ade 100644 --- a/bin/maintenancesolution/IndexOptimize.sql +++ b/bin/maintenancesolution/IndexOptimize.sql @@ -53,7 +53,7 @@ BEGIN --// Source: https://ola.hallengren.com //-- --// License: https://ola.hallengren.com/license.html //-- --// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //-- - --// Version: 2024-11-14 14:03:14 //-- + --// Version: 2022-12-03 17:23:44 //-- ---------------------------------------------------------------------------------------------------- SET NOCOUNT ON @@ -521,7 +521,7 @@ BEGIN GROUP BY tmpDatabases.DatabaseName) SelectedDatabases2 ON tmpDatabases.DatabaseName = SelectedDatabases2.DatabaseName - IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DATALENGTH(DatabaseName) = 0)) + IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DatabaseName = '')) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @Databases is not supported.', 16, 1 diff --git a/bin/maintenancesolution/MaintenanceSolution.sql b/bin/maintenancesolution/MaintenanceSolution.sql index 1bb476b84d..59dd177350 100644 --- a/bin/maintenancesolution/MaintenanceSolution.sql +++ b/bin/maintenancesolution/MaintenanceSolution.sql @@ -10,7 +10,7 @@ License: https://ola.hallengren.com/license.html GitHub: https://github.com/olahallengren/sql-server-maintenance-solution -Version: 2024-11-14 14:03:14 +Version: 2022-12-03 17:23:44 You can contact me by e-mail at ola@hallengren.com. @@ -123,7 +123,7 @@ BEGIN --// Source: https://ola.hallengren.com //-- --// License: https://ola.hallengren.com/license.html //-- --// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //-- - --// Version: 2024-11-14 14:03:14 //-- + --// Version: 2022-12-03 17:23:44 //-- ---------------------------------------------------------------------------------------------------- SET NOCOUNT ON @@ -395,7 +395,6 @@ ALTER PROCEDURE [dbo].[DatabaseBackup] @CleanupTime int = NULL, @CleanupMode nvarchar(max) = 'AFTER_BACKUP', @Compress nvarchar(max) = NULL, -@CompressionAlgorithm nvarchar(max) = NULL, @CopyOnly nvarchar(max) = 'N', @ChangeBackupType nvarchar(max) = 'N', @BackupSoftware nvarchar(max) = NULL, @@ -446,7 +445,6 @@ ALTER PROCEDURE [dbo].[DatabaseBackup] @ObjectLevelRecoveryMap nvarchar(max) = 'N', @ExcludeLogShippedFromLogBackup nvarchar(max) = 'Y', @DirectoryCheck nvarchar(max) = 'Y', -@BackupOptions nvarchar(max) = NULL, @StringDelimiter nvarchar(max) = ',', @DatabaseOrder nvarchar(max) = NULL, @DatabasesInParallel nvarchar(max) = 'N', @@ -461,7 +459,7 @@ BEGIN --// Source: https://ola.hallengren.com //-- --// License: https://ola.hallengren.com/license.html //-- --// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //-- - --// Version: 2024-11-14 14:03:14 //-- + --// Version: 2022-12-03 17:23:44 //-- ---------------------------------------------------------------------------------------------------- SET NOCOUNT ON @@ -660,7 +658,6 @@ BEGIN SET @Parameters += ', @CleanupTime = ' + ISNULL(CAST(@CleanupTime AS nvarchar),'NULL') SET @Parameters += ', @CleanupMode = ' + ISNULL('''' + REPLACE(@CleanupMode,'''','''''') + '''','NULL') SET @Parameters += ', @Compress = ' + ISNULL('''' + REPLACE(@Compress,'''','''''') + '''','NULL') - SET @Parameters += ', @CompressionAlgorithm = ' + ISNULL('''' + REPLACE(@CompressionAlgorithm,'''','''''') + '''','NULL') SET @Parameters += ', @CopyOnly = ' + ISNULL('''' + REPLACE(@CopyOnly,'''','''''') + '''','NULL') SET @Parameters += ', @ChangeBackupType = ' + ISNULL('''' + REPLACE(@ChangeBackupType,'''','''''') + '''','NULL') SET @Parameters += ', @BackupSoftware = ' + ISNULL('''' + REPLACE(@BackupSoftware,'''','''''') + '''','NULL') @@ -932,7 +929,7 @@ BEGIN GROUP BY tmpDatabases.DatabaseName) SelectedDatabases2 ON tmpDatabases.DatabaseName = SelectedDatabases2.DatabaseName - IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DATALENGTH(DatabaseName) = 0)) + IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DatabaseName = '')) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @Databases is not supported.', 16, 1 @@ -1053,7 +1050,7 @@ BEGIN SELECT @ErrorMessage = @ErrorMessage + QUOTENAME(DatabaseName) + ', ' FROM @tmpDatabases WHERE Selected = 1 - AND DATALENGTH(DatabaseNameFS) = 0 + AND DatabaseNameFS = '' ORDER BY DatabaseName ASC IF @@ROWCOUNT > 0 BEGIN @@ -1066,7 +1063,7 @@ BEGIN FROM @tmpDatabases WHERE UPPER(DatabaseNameFS) IN(SELECT UPPER(DatabaseNameFS) FROM @tmpDatabases GROUP BY UPPER(DatabaseNameFS) HAVING COUNT(*) > 1) AND UPPER(DatabaseNameFS) IN(SELECT UPPER(DatabaseNameFS) FROM @tmpDatabases WHERE Selected = 1) - AND DATALENGTH(DatabaseNameFS) > 0 + AND DatabaseNameFS <> '' ORDER BY DatabaseName ASC OPTION (RECOMPILE) IF @@ROWCOUNT > 0 @@ -1343,7 +1340,7 @@ BEGIN --// Check URLs //-- ---------------------------------------------------------------------------------------------------- - IF EXISTS(SELECT * FROM @URLs WHERE Mirror = 0 AND NOT (DirectoryPath LIKE 'https://%/%' OR DirectoryPath LIKE 's3://%/%')) + IF EXISTS(SELECT * FROM @URLs WHERE Mirror = 0 AND DirectoryPath NOT LIKE 'https://%/%') BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @URL is not supported.', 16, 1 @@ -1363,7 +1360,7 @@ BEGIN ---------------------------------------------------------------------------------------------------- - IF EXISTS(SELECT * FROM @URLs WHERE Mirror = 1 AND NOT (DirectoryPath LIKE 'https://%/%' OR DirectoryPath LIKE 's3://%/%')) + IF EXISTS(SELECT * FROM @URLs WHERE Mirror = 1 AND DirectoryPath NOT LIKE 'https://%/%') BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @MirrorURL is not supported.', 16, 1 @@ -1445,16 +1442,6 @@ BEGIN WHEN @BackupSoftware IS NOT NULL AND @CompressionLevel = 0 THEN 'N' END END - ---------------------------------------------------------------------------------------------------- - --// Get default compression algorithm //-- - ---------------------------------------------------------------------------------------------------- - - IF @CompressionAlgorithm IS NULL AND @BackupSoftware IS NULL AND @Version >= 16 - BEGIN - SELECT @CompressionAlgorithm = CASE WHEN @BackupSoftware IS NULL AND EXISTS(SELECT * FROM sys.configurations WHERE name = 'backup compression algorithm' AND value_in_use = 1) THEN 'MS_XPRESS' - WHEN @BackupSoftware IS NULL AND EXISTS(SELECT * FROM sys.configurations WHERE name = 'backup compression algorithm' AND value_in_use = 2) THEN 'QAT_DEFLATE' END - END - ---------------------------------------------------------------------------------------------------- --// Check input parameters //-- ---------------------------------------------------------------------------------------------------- @@ -1573,32 +1560,6 @@ BEGIN ---------------------------------------------------------------------------------------------------- - IF @CompressionAlgorithm NOT IN ('MS_XPRESS','QAT_DEFLATE') - BEGIN - INSERT INTO @Errors ([Message], Severity, [State]) - SELECT 'The value for the parameter @CompressionAlgorithm is not supported. The allowed values are MS_XPRESS and QAT_DEFLATE.', 16, 1 - END - - IF @CompressionAlgorithm IS NOT NULL AND NOT (@Version >= 16) - BEGIN - INSERT INTO @Errors ([Message], Severity, [State]) - SELECT 'The value for the parameter @CompressionAlgorithm is not supported. Specifying the compression algorithm is only supported in SQL Server 2022 and later.', 16, 2 - END - - IF @CompressionAlgorithm = 'QAT_DEFLATE' AND NOT (SERVERPROPERTY('EngineEdition') IN(2, 3)) - BEGIN - INSERT INTO @Errors ([Message], Severity, [State]) - SELECT 'The value for the parameter @CompressionAlgorithm is not supported. Setting the compression algorithm to QAT_DEFLATE is only supported in Standard and Enterprise Edition.', 16, 3 - END - - IF @CompressionAlgorithm IS NOT NULL AND @BackupSoftware IS NOT NULL - BEGIN - INSERT INTO @Errors ([Message], Severity, [State]) - SELECT 'The value for the parameter @CompressionAlgorithm is not supported. Setting the compression algorithm is only supported with SQL Server native backup', 16, 4 - END - - ---------------------------------------------------------------------------------------------------- - IF @CopyOnly NOT IN ('Y','N') OR @CopyOnly IS NULL BEGIN INSERT INTO @Errors ([Message], Severity, [State]) @@ -1713,7 +1674,7 @@ BEGIN ---------------------------------------------------------------------------------------------------- - IF @MaxTransferSize < 65536 OR @MaxTransferSize > 20971520 + IF @MaxTransferSize < 65536 OR @MaxTransferSize > 4194304 BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @MaxTransferSize is not supported.', 16, 1 @@ -1799,13 +1760,7 @@ BEGIN SELECT 'The value for the parameter @NumberOfFiles is not supported.', 16, 9 END - IF @NumberOfFiles > 32 AND @URL LIKE 's3%' AND @MirrorURL LIKE 's3%' - BEGIN - INSERT INTO @Errors ([Message], Severity, [State]) - SELECT 'The value for the parameter @NumberOfFiles is not supported. The maximum number of files when performing mirrored backups to S3 storage is 32.', 16, 10 - END - - ---------------------------------------------------------------------------------------------------- + ---------------------------------------------------------------------------------------------------- IF @MinBackupSizeForMultipleFiles <= 0 BEGIN @@ -1957,7 +1912,7 @@ BEGIN SELECT 'The value for the parameter @Encrypt is not supported.', 16, 1 END - IF @Encrypt = 'Y' AND @BackupSoftware IS NULL AND NOT (@Version >= 12 AND (SERVERPROPERTY('EngineEdition') IN(3, 8) OR SERVERPROPERTY('EditionID') IN(-1534726760, 284895786))) + IF @Encrypt = 'Y' AND @BackupSoftware IS NULL AND NOT (@Version >= 12 AND (SERVERPROPERTY('EngineEdition') = 3) OR SERVERPROPERTY('EditionID') IN(-1534726760, 284895786)) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @Encrypt is not supported.', 16, 2 @@ -2162,7 +2117,7 @@ BEGIN SELECT 'The value for the parameter @Credential is not supported.', 16, 2 END - IF @URL IS NOT NULL AND @Credential IS NULL AND NOT EXISTS(SELECT * FROM sys.credentials WHERE UPPER(credential_identity) IN('SHARED ACCESS SIGNATURE','MANAGED IDENTITY','S3 ACCESS KEY')) + IF @URL IS NOT NULL AND @Credential IS NULL AND NOT EXISTS(SELECT * FROM sys.credentials WHERE UPPER(credential_identity) = 'SHARED ACCESS SIGNATURE') BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @Credential is not supported.', 16, 3 @@ -3956,11 +3911,6 @@ BEGIN SET @CurrentCommand += CASE WHEN @Compress = 'Y' AND (@CurrentIsEncrypted = 0 OR (@CurrentIsEncrypted = 1 AND ((@Version >= 13 AND @CurrentMaxTransferSize >= 65537) OR @Version >= 15.0404316 OR SERVERPROPERTY('EngineEdition') = 8))) THEN ', COMPRESSION' ELSE ', NO_COMPRESSION' END END - IF @Compress = 'Y' AND @CompressionAlgorithm IS NOT NULL - BEGIN - SET @CurrentCommand += ' (ALGORITHM = ' + @CompressionAlgorithm + ')' - END - IF @CurrentBackupType = 'DIFF' SET @CurrentCommand += ', DIFFERENTIAL' IF EXISTS(SELECT * FROM @CurrentFiles WHERE Mirror = 1) @@ -3976,7 +3926,6 @@ BEGIN IF @BufferCount IS NOT NULL SET @CurrentCommand += ', BUFFERCOUNT = ' + CAST(@BufferCount AS nvarchar) IF @CurrentMaxTransferSize IS NOT NULL SET @CurrentCommand += ', MAXTRANSFERSIZE = ' + CAST(@CurrentMaxTransferSize AS nvarchar) IF @Description IS NOT NULL SET @CurrentCommand += ', DESCRIPTION = N''' + REPLACE(@Description,'''','''''') + '''' - IF @BackupOptions IS NOT NULL SET @CurrentCommand += ', BACKUP_OPTIONS = N''' + REPLACE(@BackupOptions,'''','''''') + '''' IF @Encrypt = 'Y' SET @CurrentCommand += ', ENCRYPTION (ALGORITHM = ' + UPPER(@EncryptionAlgorithm) + ', ' IF @Encrypt = 'Y' AND @ServerCertificate IS NOT NULL SET @CurrentCommand += 'SERVER CERTIFICATE = ' + QUOTENAME(@ServerCertificate) IF @Encrypt = 'Y' AND @ServerAsymmetricKey IS NOT NULL SET @CurrentCommand += 'SERVER ASYMMETRIC KEY = ' + QUOTENAME(@ServerAsymmetricKey) @@ -4216,7 +4165,6 @@ BEGIN SET @CurrentCommand += ' WITH ' IF @CheckSum = 'Y' SET @CurrentCommand += 'CHECKSUM' IF @CheckSum = 'N' SET @CurrentCommand += 'NO_CHECKSUM' - IF @BackupOptions IS NOT NULL SET @CurrentCommand += ', RESTORE_OPTIONS = N''' + REPLACE(@BackupOptions,'''','''''') + '''' IF @URL IS NOT NULL AND @Credential IS NOT NULL SET @CurrentCommand += ', CREDENTIAL = N''' + REPLACE(@Credential,'''','''''') + '''' END @@ -4554,7 +4502,7 @@ BEGIN --// Source: https://ola.hallengren.com //-- --// License: https://ola.hallengren.com/license.html //-- --// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //-- - --// Version: 2024-11-14 14:03:14 //-- + --// Version: 2022-12-03 17:23:44 //-- ---------------------------------------------------------------------------------------------------- SET NOCOUNT ON @@ -4944,7 +4892,7 @@ BEGIN GROUP BY tmpDatabases.DatabaseName) SelectedDatabases2 ON tmpDatabases.DatabaseName = SelectedDatabases2.DatabaseName - IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DATALENGTH(DatabaseName) = 0)) + IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DatabaseName = '')) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @Databases is not supported.', 16, 1 @@ -6456,7 +6404,7 @@ BEGIN --// Source: https://ola.hallengren.com //-- --// License: https://ola.hallengren.com/license.html //-- --// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //-- - --// Version: 2024-11-14 14:03:14 //-- + --// Version: 2022-12-03 17:23:44 //-- ---------------------------------------------------------------------------------------------------- SET NOCOUNT ON @@ -6924,7 +6872,7 @@ BEGIN GROUP BY tmpDatabases.DatabaseName) SelectedDatabases2 ON tmpDatabases.DatabaseName = SelectedDatabases2.DatabaseName - IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DATALENGTH(DatabaseName) = 0)) + IF @Databases IS NOT NULL AND (NOT EXISTS(SELECT * FROM @SelectedDatabases) OR EXISTS(SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DatabaseName = '')) BEGIN INSERT INTO @Errors ([Message], Severity, [State]) SELECT 'The value for the parameter @Databases is not supported.', 16, 1 diff --git a/dbatools.psd1 b/dbatools.psd1 index a1e7758c8a..ddb84d8a8c 100644 --- a/dbatools.psd1 +++ b/dbatools.psd1 @@ -11,7 +11,7 @@ RootModule = 'dbatools.psm1' # Version number of this module. - ModuleVersion = '2.1.27' + ModuleVersion = '2.1.28' # ID used to uniquely identify this module GUID = '9d139310-ce45-41ce-8e8b-d76335aa1789'