@@ -16,7 +16,6 @@ ALTER PROCEDURE [dbo].[DatabaseBackup]
1616@CleanupTime int = NULL ,
1717@CleanupMode nvarchar (max ) = ' AFTER_BACKUP' ,
1818@Compress nvarchar (max ) = NULL ,
19- @CompressionAlgorithm nvarchar (max ) = NULL ,
2019@CopyOnly nvarchar (max ) = ' N' ,
2120@ChangeBackupType nvarchar (max ) = ' N' ,
2221@BackupSoftware nvarchar (max ) = NULL ,
@@ -67,7 +66,6 @@ ALTER PROCEDURE [dbo].[DatabaseBackup]
6766@ObjectLevelRecoveryMap nvarchar (max ) = ' N' ,
6867@ExcludeLogShippedFromLogBackup nvarchar (max ) = ' Y' ,
6968@DirectoryCheck nvarchar (max ) = ' Y' ,
70- @BackupOptions nvarchar (max ) = NULL ,
7169@StringDelimiter nvarchar (max ) = ' ,' ,
7270@DatabaseOrder nvarchar (max ) = NULL ,
7371@DatabasesInParallel nvarchar (max ) = ' N' ,
8280 -- // Source: https://ola.hallengren.com //--
8381 -- // License: https://ola.hallengren.com/license.html //--
8482 -- // GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //--
85- -- // Version: 2024-11-14 14:03:14 //--
83+ -- // Version: 2022-12-03 17:23:44 //--
8684 -- --------------------------------------------------------------------------------------------------
8785
8886 SET NOCOUNT ON
@@ -281,7 +279,6 @@ BEGIN
281279 SET @Parameters + = ' , @CleanupTime = ' + ISNULL (CAST (@CleanupTime AS nvarchar ),' NULL' )
282280 SET @Parameters + = ' , @CleanupMode = ' + ISNULL (' '' ' + REPLACE (@CleanupMode,' '' ' ,' '' '' ' ) + ' '' ' ,' NULL' )
283281 SET @Parameters + = ' , @Compress = ' + ISNULL (' '' ' + REPLACE (@Compress,' '' ' ,' '' '' ' ) + ' '' ' ,' NULL' )
284- SET @Parameters + = ' , @CompressionAlgorithm = ' + ISNULL (' '' ' + REPLACE (@CompressionAlgorithm,' '' ' ,' '' '' ' ) + ' '' ' ,' NULL' )
285282 SET @Parameters + = ' , @CopyOnly = ' + ISNULL (' '' ' + REPLACE (@CopyOnly,' '' ' ,' '' '' ' ) + ' '' ' ,' NULL' )
286283 SET @Parameters + = ' , @ChangeBackupType = ' + ISNULL (' '' ' + REPLACE (@ChangeBackupType,' '' ' ,' '' '' ' ) + ' '' ' ,' NULL' )
287284 SET @Parameters + = ' , @BackupSoftware = ' + ISNULL (' '' ' + REPLACE (@BackupSoftware,' '' ' ,' '' '' ' ) + ' '' ' ,' NULL' )
@@ -553,7 +550,7 @@ BEGIN
553550 GROUP BY tmpDatabases .DatabaseName ) SelectedDatabases2
554551 ON tmpDatabases .DatabaseName = SelectedDatabases2 .DatabaseName
555552
556- IF @Databases IS NOT NULL AND (NOT EXISTS (SELECT * FROM @SelectedDatabases) OR EXISTS (SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DATALENGTH( DatabaseName) = 0 ))
553+ IF @Databases IS NOT NULL AND (NOT EXISTS (SELECT * FROM @SelectedDatabases) OR EXISTS (SELECT * FROM @SelectedDatabases WHERE DatabaseName IS NULL OR DatabaseName = ' ' ))
557554 BEGIN
558555 INSERT INTO @Errors ([Message], Severity, [State])
559556 SELECT ' The value for the parameter @Databases is not supported.' , 16 , 1
@@ -674,7 +671,7 @@ BEGIN
674671 SELECT @ErrorMessage = @ErrorMessage + QUOTENAME (DatabaseName) + ' , '
675672 FROM @tmpDatabases
676673 WHERE Selected = 1
677- AND DATALENGTH( DatabaseNameFS) = 0
674+ AND DatabaseNameFS = ' '
678675 ORDER BY DatabaseName ASC
679676 IF @@ROWCOUNT > 0
680677 BEGIN
@@ -687,7 +684,7 @@ BEGIN
687684 FROM @tmpDatabases
688685 WHERE UPPER (DatabaseNameFS) IN (SELECT UPPER (DatabaseNameFS) FROM @tmpDatabases GROUP BY UPPER (DatabaseNameFS) HAVING COUNT (* ) > 1 )
689686 AND UPPER (DatabaseNameFS) IN (SELECT UPPER (DatabaseNameFS) FROM @tmpDatabases WHERE Selected = 1 )
690- AND DATALENGTH( DatabaseNameFS) > 0
687+ AND DatabaseNameFS <> ' '
691688 ORDER BY DatabaseName ASC
692689 OPTION (RECOMPILE )
693690 IF @@ROWCOUNT > 0
@@ -964,7 +961,7 @@ BEGIN
964961 -- // Check URLs //--
965962 -- --------------------------------------------------------------------------------------------------
966963
967- IF EXISTS (SELECT * FROM @URLs WHERE Mirror = 0 AND NOT ( DirectoryPath LIKE ' https://%/%' OR DirectoryPath LIKE ' s3://%/%' ) )
964+ IF EXISTS (SELECT * FROM @URLs WHERE Mirror = 0 AND DirectoryPath NOT LIKE ' https://%/%' )
968965 BEGIN
969966 INSERT INTO @Errors ([Message], Severity, [State])
970967 SELECT ' The value for the parameter @URL is not supported.' , 16 , 1
@@ -984,7 +981,7 @@ BEGIN
984981
985982 -- --------------------------------------------------------------------------------------------------
986983
987- IF EXISTS (SELECT * FROM @URLs WHERE Mirror = 1 AND NOT ( DirectoryPath LIKE ' https://%/%' OR DirectoryPath LIKE ' s3://%/%' ) )
984+ IF EXISTS (SELECT * FROM @URLs WHERE Mirror = 1 AND DirectoryPath NOT LIKE ' https://%/%' )
988985 BEGIN
989986 INSERT INTO @Errors ([Message], Severity, [State])
990987 SELECT ' The value for the parameter @MirrorURL is not supported.' , 16 , 1
@@ -1066,16 +1063,6 @@ BEGIN
10661063 WHEN @BackupSoftware IS NOT NULL AND @CompressionLevel = 0 THEN ' N' END
10671064 END
10681065
1069- -- --------------------------------------------------------------------------------------------------
1070- -- // Get default compression algorithm //--
1071- -- --------------------------------------------------------------------------------------------------
1072-
1073- IF @CompressionAlgorithm IS NULL AND @BackupSoftware IS NULL AND @Version >= 16
1074- BEGIN
1075- 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'
1076- WHEN @BackupSoftware IS NULL AND EXISTS (SELECT * FROM sys .configurations WHERE name = ' backup compression algorithm' AND value_in_use = 2 ) THEN ' QAT_DEFLATE' END
1077- END
1078-
10791066 -- --------------------------------------------------------------------------------------------------
10801067 -- // Check input parameters //--
10811068 -- --------------------------------------------------------------------------------------------------
@@ -1194,32 +1181,6 @@ BEGIN
11941181
11951182 -- --------------------------------------------------------------------------------------------------
11961183
1197- IF @CompressionAlgorithm NOT IN (' MS_XPRESS' ,' QAT_DEFLATE' )
1198- BEGIN
1199- INSERT INTO @Errors ([Message], Severity, [State])
1200- SELECT ' The value for the parameter @CompressionAlgorithm is not supported. The allowed values are MS_XPRESS and QAT_DEFLATE.' , 16 , 1
1201- END
1202-
1203- IF @CompressionAlgorithm IS NOT NULL AND NOT (@Version >= 16 )
1204- BEGIN
1205- INSERT INTO @Errors ([Message], Severity, [State])
1206- 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
1207- END
1208-
1209- IF @CompressionAlgorithm = ' QAT_DEFLATE' AND NOT (SERVERPROPERTY (' EngineEdition' ) IN (2 , 3 ))
1210- BEGIN
1211- INSERT INTO @Errors ([Message], Severity, [State])
1212- 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
1213- END
1214-
1215- IF @CompressionAlgorithm IS NOT NULL AND @BackupSoftware IS NOT NULL
1216- BEGIN
1217- INSERT INTO @Errors ([Message], Severity, [State])
1218- SELECT ' The value for the parameter @CompressionAlgorithm is not supported. Setting the compression algorithm is only supported with SQL Server native backup' , 16 , 4
1219- END
1220-
1221- -- --------------------------------------------------------------------------------------------------
1222-
12231184 IF @CopyOnly NOT IN (' Y' ,' N' ) OR @CopyOnly IS NULL
12241185 BEGIN
12251186 INSERT INTO @Errors ([Message], Severity, [State])
@@ -1334,7 +1295,7 @@ BEGIN
13341295
13351296 -- --------------------------------------------------------------------------------------------------
13361297
1337- IF @MaxTransferSize < 65536 OR @MaxTransferSize > 20971520
1298+ IF @MaxTransferSize < 65536 OR @MaxTransferSize > 4194304
13381299 BEGIN
13391300 INSERT INTO @Errors ([Message], Severity, [State])
13401301 SELECT ' The value for the parameter @MaxTransferSize is not supported.' , 16 , 1
@@ -1420,13 +1381,7 @@ BEGIN
14201381 SELECT ' The value for the parameter @NumberOfFiles is not supported.' , 16 , 9
14211382 END
14221383
1423- IF @NumberOfFiles > 32 AND @URL LIKE ' s3%' AND @MirrorURL LIKE ' s3%'
1424- BEGIN
1425- INSERT INTO @Errors ([Message], Severity, [State])
1426- 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
1427- END
1428-
1429- -- --------------------------------------------------------------------------------------------------
1384+ -- --------------------------------------------------------------------------------------------------
14301385
14311386 IF @MinBackupSizeForMultipleFiles <= 0
14321387 BEGIN
@@ -1578,7 +1533,7 @@ BEGIN
15781533 SELECT ' The value for the parameter @Encrypt is not supported.' , 16 , 1
15791534 END
15801535
1581- IF @Encrypt = ' Y' AND @BackupSoftware IS NULL AND NOT (@Version >= 12 AND (SERVERPROPERTY (' EngineEdition' ) IN ( 3 , 8 ) OR SERVERPROPERTY (' EditionID' ) IN (- 1534726760 , 284895786 ) ))
1536+ IF @Encrypt = ' Y' AND @BackupSoftware IS NULL AND NOT (@Version >= 12 AND (SERVERPROPERTY (' EngineEdition' ) = 3 ) OR SERVERPROPERTY (' EditionID' ) IN (- 1534726760 , 284895786 ))
15821537 BEGIN
15831538 INSERT INTO @Errors ([Message], Severity, [State])
15841539 SELECT ' The value for the parameter @Encrypt is not supported.' , 16 , 2
@@ -1783,7 +1738,7 @@ BEGIN
17831738 SELECT ' The value for the parameter @Credential is not supported.' , 16 , 2
17841739 END
17851740
1786- 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' ) )
1741+ IF @URL IS NOT NULL AND @Credential IS NULL AND NOT EXISTS (SELECT * FROM sys .credentials WHERE UPPER (credential_identity) = ' SHARED ACCESS SIGNATURE' )
17871742 BEGIN
17881743 INSERT INTO @Errors ([Message], Severity, [State])
17891744 SELECT ' The value for the parameter @Credential is not supported.' , 16 , 3
@@ -3577,11 +3532,6 @@ BEGIN
35773532 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
35783533 END
35793534
3580- IF @Compress = ' Y' AND @CompressionAlgorithm IS NOT NULL
3581- BEGIN
3582- SET @CurrentCommand + = ' (ALGORITHM = ' + @CompressionAlgorithm + ' )'
3583- END
3584-
35853535 IF @CurrentBackupType = ' DIFF' SET @CurrentCommand + = ' , DIFFERENTIAL'
35863536
35873537 IF EXISTS (SELECT * FROM @CurrentFiles WHERE Mirror = 1 )
@@ -3597,7 +3547,6 @@ BEGIN
35973547 IF @BufferCount IS NOT NULL SET @CurrentCommand + = ' , BUFFERCOUNT = ' + CAST (@BufferCount AS nvarchar )
35983548 IF @CurrentMaxTransferSize IS NOT NULL SET @CurrentCommand + = ' , MAXTRANSFERSIZE = ' + CAST (@CurrentMaxTransferSize AS nvarchar )
35993549 IF @Description IS NOT NULL SET @CurrentCommand + = ' , DESCRIPTION = N'' ' + REPLACE (@Description,' '' ' ,' '' '' ' ) + ' '' '
3600- IF @BackupOptions IS NOT NULL SET @CurrentCommand + = ' , BACKUP_OPTIONS = N'' ' + REPLACE (@BackupOptions,' '' ' ,' '' '' ' ) + ' '' '
36013550 IF @Encrypt = ' Y' SET @CurrentCommand + = ' , ENCRYPTION (ALGORITHM = ' + UPPER (@EncryptionAlgorithm) + ' , '
36023551 IF @Encrypt = ' Y' AND @ServerCertificate IS NOT NULL SET @CurrentCommand + = ' SERVER CERTIFICATE = ' + QUOTENAME (@ServerCertificate)
36033552 IF @Encrypt = ' Y' AND @ServerAsymmetricKey IS NOT NULL SET @CurrentCommand + = ' SERVER ASYMMETRIC KEY = ' + QUOTENAME (@ServerAsymmetricKey)
@@ -3837,7 +3786,6 @@ BEGIN
38373786 SET @CurrentCommand + = ' WITH '
38383787 IF @CheckSum = ' Y' SET @CurrentCommand + = ' CHECKSUM'
38393788 IF @CheckSum = ' N' SET @CurrentCommand + = ' NO_CHECKSUM'
3840- IF @BackupOptions IS NOT NULL SET @CurrentCommand + = ' , RESTORE_OPTIONS = N'' ' + REPLACE (@BackupOptions,' '' ' ,' '' '' ' ) + ' '' '
38413789 IF @URL IS NOT NULL AND @Credential IS NOT NULL SET @CurrentCommand + = ' , CREDENTIAL = N'' ' + REPLACE (@Credential,' '' ' ,' '' '' ' ) + ' '' '
38423790 END
38433791
0 commit comments