@@ -16,7 +16,6 @@ ALTER PROCEDURE [dbo].[DatabaseBackup]
16
16
@CleanupTime int = NULL ,
17
17
@CleanupMode nvarchar (max ) = ' AFTER_BACKUP' ,
18
18
@Compress nvarchar (max ) = NULL ,
19
- @CompressionAlgorithm nvarchar (max ) = NULL ,
20
19
@CopyOnly nvarchar (max ) = ' N' ,
21
20
@ChangeBackupType nvarchar (max ) = ' N' ,
22
21
@BackupSoftware nvarchar (max ) = NULL ,
@@ -67,7 +66,6 @@ ALTER PROCEDURE [dbo].[DatabaseBackup]
67
66
@ObjectLevelRecoveryMap nvarchar (max ) = ' N' ,
68
67
@ExcludeLogShippedFromLogBackup nvarchar (max ) = ' Y' ,
69
68
@DirectoryCheck nvarchar (max ) = ' Y' ,
70
- @BackupOptions nvarchar (max ) = NULL ,
71
69
@StringDelimiter nvarchar (max ) = ' ,' ,
72
70
@DatabaseOrder nvarchar (max ) = NULL ,
73
71
@DatabasesInParallel nvarchar (max ) = ' N' ,
82
80
-- // Source: https://ola.hallengren.com //--
83
81
-- // License: https://ola.hallengren.com/license.html //--
84
82
-- // 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 //--
86
84
-- --------------------------------------------------------------------------------------------------
87
85
88
86
SET NOCOUNT ON
@@ -281,7 +279,6 @@ BEGIN
281
279
SET @Parameters + = ' , @CleanupTime = ' + ISNULL (CAST (@CleanupTime AS nvarchar ),' NULL' )
282
280
SET @Parameters + = ' , @CleanupMode = ' + ISNULL (' '' ' + REPLACE (@CleanupMode,' '' ' ,' '' '' ' ) + ' '' ' ,' NULL' )
283
281
SET @Parameters + = ' , @Compress = ' + ISNULL (' '' ' + REPLACE (@Compress,' '' ' ,' '' '' ' ) + ' '' ' ,' NULL' )
284
- SET @Parameters + = ' , @CompressionAlgorithm = ' + ISNULL (' '' ' + REPLACE (@CompressionAlgorithm,' '' ' ,' '' '' ' ) + ' '' ' ,' NULL' )
285
282
SET @Parameters + = ' , @CopyOnly = ' + ISNULL (' '' ' + REPLACE (@CopyOnly,' '' ' ,' '' '' ' ) + ' '' ' ,' NULL' )
286
283
SET @Parameters + = ' , @ChangeBackupType = ' + ISNULL (' '' ' + REPLACE (@ChangeBackupType,' '' ' ,' '' '' ' ) + ' '' ' ,' NULL' )
287
284
SET @Parameters + = ' , @BackupSoftware = ' + ISNULL (' '' ' + REPLACE (@BackupSoftware,' '' ' ,' '' '' ' ) + ' '' ' ,' NULL' )
@@ -553,7 +550,7 @@ BEGIN
553
550
GROUP BY tmpDatabases .DatabaseName ) SelectedDatabases2
554
551
ON tmpDatabases .DatabaseName = SelectedDatabases2 .DatabaseName
555
552
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 = ' ' ))
557
554
BEGIN
558
555
INSERT INTO @Errors ([Message], Severity, [State])
559
556
SELECT ' The value for the parameter @Databases is not supported.' , 16 , 1
@@ -674,7 +671,7 @@ BEGIN
674
671
SELECT @ErrorMessage = @ErrorMessage + QUOTENAME (DatabaseName) + ' , '
675
672
FROM @tmpDatabases
676
673
WHERE Selected = 1
677
- AND DATALENGTH( DatabaseNameFS) = 0
674
+ AND DatabaseNameFS = ' '
678
675
ORDER BY DatabaseName ASC
679
676
IF @@ROWCOUNT > 0
680
677
BEGIN
@@ -687,7 +684,7 @@ BEGIN
687
684
FROM @tmpDatabases
688
685
WHERE UPPER (DatabaseNameFS) IN (SELECT UPPER (DatabaseNameFS) FROM @tmpDatabases GROUP BY UPPER (DatabaseNameFS) HAVING COUNT (* ) > 1 )
689
686
AND UPPER (DatabaseNameFS) IN (SELECT UPPER (DatabaseNameFS) FROM @tmpDatabases WHERE Selected = 1 )
690
- AND DATALENGTH( DatabaseNameFS) > 0
687
+ AND DatabaseNameFS <> ' '
691
688
ORDER BY DatabaseName ASC
692
689
OPTION (RECOMPILE )
693
690
IF @@ROWCOUNT > 0
@@ -964,7 +961,7 @@ BEGIN
964
961
-- // Check URLs //--
965
962
-- --------------------------------------------------------------------------------------------------
966
963
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://%/%' )
968
965
BEGIN
969
966
INSERT INTO @Errors ([Message], Severity, [State])
970
967
SELECT ' The value for the parameter @URL is not supported.' , 16 , 1
@@ -984,7 +981,7 @@ BEGIN
984
981
985
982
-- --------------------------------------------------------------------------------------------------
986
983
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://%/%' )
988
985
BEGIN
989
986
INSERT INTO @Errors ([Message], Severity, [State])
990
987
SELECT ' The value for the parameter @MirrorURL is not supported.' , 16 , 1
@@ -1066,16 +1063,6 @@ BEGIN
1066
1063
WHEN @BackupSoftware IS NOT NULL AND @CompressionLevel = 0 THEN ' N' END
1067
1064
END
1068
1065
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
-
1079
1066
-- --------------------------------------------------------------------------------------------------
1080
1067
-- // Check input parameters //--
1081
1068
-- --------------------------------------------------------------------------------------------------
@@ -1194,32 +1181,6 @@ BEGIN
1194
1181
1195
1182
-- --------------------------------------------------------------------------------------------------
1196
1183
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
-
1223
1184
IF @CopyOnly NOT IN (' Y' ,' N' ) OR @CopyOnly IS NULL
1224
1185
BEGIN
1225
1186
INSERT INTO @Errors ([Message], Severity, [State])
@@ -1334,7 +1295,7 @@ BEGIN
1334
1295
1335
1296
-- --------------------------------------------------------------------------------------------------
1336
1297
1337
- IF @MaxTransferSize < 65536 OR @MaxTransferSize > 20971520
1298
+ IF @MaxTransferSize < 65536 OR @MaxTransferSize > 4194304
1338
1299
BEGIN
1339
1300
INSERT INTO @Errors ([Message], Severity, [State])
1340
1301
SELECT ' The value for the parameter @MaxTransferSize is not supported.' , 16 , 1
@@ -1420,13 +1381,7 @@ BEGIN
1420
1381
SELECT ' The value for the parameter @NumberOfFiles is not supported.' , 16 , 9
1421
1382
END
1422
1383
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
+ -- --------------------------------------------------------------------------------------------------
1430
1385
1431
1386
IF @MinBackupSizeForMultipleFiles <= 0
1432
1387
BEGIN
@@ -1578,7 +1533,7 @@ BEGIN
1578
1533
SELECT ' The value for the parameter @Encrypt is not supported.' , 16 , 1
1579
1534
END
1580
1535
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 ))
1582
1537
BEGIN
1583
1538
INSERT INTO @Errors ([Message], Severity, [State])
1584
1539
SELECT ' The value for the parameter @Encrypt is not supported.' , 16 , 2
@@ -1783,7 +1738,7 @@ BEGIN
1783
1738
SELECT ' The value for the parameter @Credential is not supported.' , 16 , 2
1784
1739
END
1785
1740
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' )
1787
1742
BEGIN
1788
1743
INSERT INTO @Errors ([Message], Severity, [State])
1789
1744
SELECT ' The value for the parameter @Credential is not supported.' , 16 , 3
@@ -3577,11 +3532,6 @@ BEGIN
3577
3532
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
3578
3533
END
3579
3534
3580
- IF @Compress = ' Y' AND @CompressionAlgorithm IS NOT NULL
3581
- BEGIN
3582
- SET @CurrentCommand + = ' (ALGORITHM = ' + @CompressionAlgorithm + ' )'
3583
- END
3584
-
3585
3535
IF @CurrentBackupType = ' DIFF' SET @CurrentCommand + = ' , DIFFERENTIAL'
3586
3536
3587
3537
IF EXISTS (SELECT * FROM @CurrentFiles WHERE Mirror = 1 )
@@ -3597,7 +3547,6 @@ BEGIN
3597
3547
IF @BufferCount IS NOT NULL SET @CurrentCommand + = ' , BUFFERCOUNT = ' + CAST (@BufferCount AS nvarchar )
3598
3548
IF @CurrentMaxTransferSize IS NOT NULL SET @CurrentCommand + = ' , MAXTRANSFERSIZE = ' + CAST (@CurrentMaxTransferSize AS nvarchar )
3599
3549
IF @Description IS NOT NULL SET @CurrentCommand + = ' , DESCRIPTION = N'' ' + REPLACE (@Description,' '' ' ,' '' '' ' ) + ' '' '
3600
- IF @BackupOptions IS NOT NULL SET @CurrentCommand + = ' , BACKUP_OPTIONS = N'' ' + REPLACE (@BackupOptions,' '' ' ,' '' '' ' ) + ' '' '
3601
3550
IF @Encrypt = ' Y' SET @CurrentCommand + = ' , ENCRYPTION (ALGORITHM = ' + UPPER (@EncryptionAlgorithm) + ' , '
3602
3551
IF @Encrypt = ' Y' AND @ServerCertificate IS NOT NULL SET @CurrentCommand + = ' SERVER CERTIFICATE = ' + QUOTENAME (@ServerCertificate)
3603
3552
IF @Encrypt = ' Y' AND @ServerAsymmetricKey IS NOT NULL SET @CurrentCommand + = ' SERVER ASYMMETRIC KEY = ' + QUOTENAME (@ServerAsymmetricKey)
@@ -3837,7 +3786,6 @@ BEGIN
3837
3786
SET @CurrentCommand + = ' WITH '
3838
3787
IF @CheckSum = ' Y' SET @CurrentCommand + = ' CHECKSUM'
3839
3788
IF @CheckSum = ' N' SET @CurrentCommand + = ' NO_CHECKSUM'
3840
- IF @BackupOptions IS NOT NULL SET @CurrentCommand + = ' , RESTORE_OPTIONS = N'' ' + REPLACE (@BackupOptions,' '' ' ,' '' '' ' ) + ' '' '
3841
3789
IF @URL IS NOT NULL AND @Credential IS NOT NULL SET @CurrentCommand + = ' , CREDENTIAL = N'' ' + REPLACE (@Credential,' '' ' ,' '' '' ' ) + ' '' '
3842
3790
END
3843
3791
0 commit comments