Skip to content

Commit 36b1236

Browse files
Add files via upload
1 parent 5f5e9d3 commit 36b1236

5 files changed

Lines changed: 23 additions & 19 deletions

File tree

CommandExecute.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ BEGIN
3636
--// Source: https://ola.hallengren.com //--
3737
--// License: https://ola.hallengren.com/license.html //--
3838
--// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //--
39-
--// Version: 2021-12-30 19:45:09 //--
39+
--// Version: 2021-12-31 19:48:31 //--
4040
----------------------------------------------------------------------------------------------------
4141

4242
SET NOCOUNT ON

DatabaseBackup.sql

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ BEGIN
8080
--// Source: https://ola.hallengren.com //--
8181
--// License: https://ola.hallengren.com/license.html //--
8282
--// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //--
83-
--// Version: 2021-12-30 19:45:09 //--
83+
--// Version: 2021-12-31 19:48:31 //--
8484
----------------------------------------------------------------------------------------------------
8585

8686
SET NOCOUNT ON
@@ -1849,13 +1849,13 @@ BEGIN
18491849
IF @ModificationLevel IS NOT NULL AND @ChangeBackupType = 'N'
18501850
BEGIN
18511851
INSERT INTO @Errors ([Message], Severity, [State])
1852-
SELECT 'The value for the parameter @ModificationLevel is not supported.', 16, 2
1852+
SELECT 'The parameter @ModificationLevel can only be used together with @ChangeBackupType = ''Y''.', 16, 2
18531853
END
18541854

18551855
IF @ModificationLevel IS NOT NULL AND @BackupType <> 'DIFF'
18561856
BEGIN
18571857
INSERT INTO @Errors ([Message], Severity, [State])
1858-
SELECT 'The value for the parameter @ModificationLevel is not supported.', 16, 3
1858+
SELECT 'The parameter @ModificationLevel can only be used for differential backups.', 16, 3
18591859
END
18601860

18611861
----------------------------------------------------------------------------------------------------
@@ -2612,7 +2612,7 @@ BEGIN
26122612

26132613
SELECT @CurrentMaxTransferSize = CASE
26142614
WHEN @MaxTransferSize IS NOT NULL THEN @MaxTransferSize
2615-
WHEN @MaxTransferSize IS NULL AND @Compress = 'Y' AND @CurrentIsEncrypted = 1 AND @BackupSoftware IS NULL AND (@Version >= 13 AND @Version < 15.0404316) THEN 65537
2615+
WHEN @MaxTransferSize IS NULL AND @Compress = 'Y' AND @CurrentIsEncrypted = 1 AND @BackupSoftware IS NULL AND (@Version >= 13 AND @Version < 15.0404316) AND @Credential IS NULL THEN 65537
26162616
END
26172617

26182618
IF @CurrentDatabaseState = 'ONLINE'
@@ -2667,6 +2667,8 @@ BEGIN
26672667
END
26682668

26692669
IF @CurrentDatabaseState = 'ONLINE' AND EXISTS(SELECT * FROM sys.all_columns WHERE object_id = OBJECT_ID('sys.dm_db_file_space_usage') AND name = 'modified_extent_page_count') AND (@CurrentAvailabilityGroupRole = 'PRIMARY' OR @CurrentAvailabilityGroupRole IS NULL)
2670+
AND (@BackupType IN('DIFF','FULL') OR (@ChangeBackupType = 'Y' AND @CurrentBackupType = 'LOG' AND @CurrentRecoveryModel IN('FULL','BULK_LOGGED') AND @CurrentLogLSN IS NULL AND @CurrentDatabaseName <> 'master'))
2671+
AND (@ModificationLevel IS NOT NULL OR @MinBackupSizeForMultipleFiles IS NOT NULL OR @MaxFileSize IS NOT NULL)
26702672
BEGIN
26712673
SET @CurrentCommand = 'SELECT @ParamAllocatedExtentPageCount = SUM(allocated_extent_page_count), @ParamModifiedExtentPageCount = SUM(modified_extent_page_count) FROM sys.dm_db_file_space_usage'
26722674

DatabaseIntegrityCheck.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ BEGIN
3939
--// Source: https://ola.hallengren.com //--
4040
--// License: https://ola.hallengren.com/license.html //--
4141
--// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //--
42-
--// Version: 2021-12-30 19:45:09 //--
42+
--// Version: 2021-12-31 19:48:31 //--
4343
----------------------------------------------------------------------------------------------------
4444

4545
SET NOCOUNT ON
@@ -1357,7 +1357,7 @@ BEGIN
13571357
RAISERROR('%s',10,1,@DatabaseMessage) WITH NOWAIT
13581358
END
13591359

1360-
IF @CurrentDatabaseState = 'ONLINE' AND SERVERPROPERTY('EngineEdition') <> 5
1360+
IF @CurrentDatabaseState IN('ONLINE','EMERGENCY') AND SERVERPROPERTY('EngineEdition') <> 5
13611361
BEGIN
13621362
IF EXISTS (SELECT * FROM sys.database_recovery_status WHERE database_id = DB_ID(@CurrentDatabaseName) AND database_guid IS NOT NULL)
13631363
BEGIN
@@ -1441,7 +1441,7 @@ BEGIN
14411441

14421442
RAISERROR(@EmptyLine,10,1) WITH NOWAIT
14431443

1444-
IF @CurrentDatabaseState = 'ONLINE'
1444+
IF @CurrentDatabaseState IN('ONLINE','EMERGENCY')
14451445
AND NOT (@CurrentUserAccess = 'SINGLE_USER' AND @CurrentIsDatabaseAccessible = 0)
14461446
AND (@CurrentAvailabilityGroupRole = 'PRIMARY' OR @CurrentAvailabilityGroupRole IS NULL OR SERVERPROPERTY('EngineEdition') = 3)
14471447
AND ((@AvailabilityGroupReplicas = 'PRIMARY' AND @CurrentAvailabilityGroupRole = 'PRIMARY') OR (@AvailabilityGroupReplicas = 'SECONDARY' AND @CurrentAvailabilityGroupRole = 'SECONDARY') OR (@AvailabilityGroupReplicas = 'PREFERRED_BACKUP_REPLICA' AND @CurrentIsPreferredBackupReplica = 1) OR @AvailabilityGroupReplicas = 'ALL' OR @CurrentAvailabilityGroupRole IS NULL)

IndexOptimize.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ BEGIN
5353
--// Source: https://ola.hallengren.com //--
5454
--// License: https://ola.hallengren.com/license.html //--
5555
--// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //--
56-
--// Version: 2021-12-30 19:45:09 //--
56+
--// Version: 2021-12-31 19:48:31 //--
5757
----------------------------------------------------------------------------------------------------
5858

5959
SET NOCOUNT ON

MaintenanceSolution.sql

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ License: https://ola.hallengren.com/license.html
1010
1111
GitHub: https://github.com/olahallengren/sql-server-maintenance-solution
1212
13-
Version: 2021-12-30 19:45:09
13+
Version: 2021-12-31 19:48:31
1414
1515
You can contact me by e-mail at ola@hallengren.com.
1616
@@ -123,7 +123,7 @@ BEGIN
123123
--// Source: https://ola.hallengren.com //--
124124
--// License: https://ola.hallengren.com/license.html //--
125125
--// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //--
126-
--// Version: 2021-12-30 19:45:09 //--
126+
--// Version: 2021-12-31 19:48:31 //--
127127
----------------------------------------------------------------------------------------------------
128128

129129
SET NOCOUNT ON
@@ -459,7 +459,7 @@ BEGIN
459459
--// Source: https://ola.hallengren.com //--
460460
--// License: https://ola.hallengren.com/license.html //--
461461
--// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //--
462-
--// Version: 2021-12-30 19:45:09 //--
462+
--// Version: 2021-12-31 19:48:31 //--
463463
----------------------------------------------------------------------------------------------------
464464

465465
SET NOCOUNT ON
@@ -2228,13 +2228,13 @@ BEGIN
22282228
IF @ModificationLevel IS NOT NULL AND @ChangeBackupType = 'N'
22292229
BEGIN
22302230
INSERT INTO @Errors ([Message], Severity, [State])
2231-
SELECT 'The value for the parameter @ModificationLevel is not supported.', 16, 2
2231+
SELECT 'The parameter @ModificationLevel can only be used together with @ChangeBackupType = ''Y''.', 16, 2
22322232
END
22332233

22342234
IF @ModificationLevel IS NOT NULL AND @BackupType <> 'DIFF'
22352235
BEGIN
22362236
INSERT INTO @Errors ([Message], Severity, [State])
2237-
SELECT 'The value for the parameter @ModificationLevel is not supported.', 16, 3
2237+
SELECT 'The parameter @ModificationLevel can only be used for differential backups.', 16, 3
22382238
END
22392239

22402240
----------------------------------------------------------------------------------------------------
@@ -2991,7 +2991,7 @@ BEGIN
29912991

29922992
SELECT @CurrentMaxTransferSize = CASE
29932993
WHEN @MaxTransferSize IS NOT NULL THEN @MaxTransferSize
2994-
WHEN @MaxTransferSize IS NULL AND @Compress = 'Y' AND @CurrentIsEncrypted = 1 AND @BackupSoftware IS NULL AND (@Version >= 13 AND @Version < 15.0404316) THEN 65537
2994+
WHEN @MaxTransferSize IS NULL AND @Compress = 'Y' AND @CurrentIsEncrypted = 1 AND @BackupSoftware IS NULL AND (@Version >= 13 AND @Version < 15.0404316) AND @Credential IS NULL THEN 65537
29952995
END
29962996

29972997
IF @CurrentDatabaseState = 'ONLINE'
@@ -3046,6 +3046,8 @@ BEGIN
30463046
END
30473047

30483048
IF @CurrentDatabaseState = 'ONLINE' AND EXISTS(SELECT * FROM sys.all_columns WHERE object_id = OBJECT_ID('sys.dm_db_file_space_usage') AND name = 'modified_extent_page_count') AND (@CurrentAvailabilityGroupRole = 'PRIMARY' OR @CurrentAvailabilityGroupRole IS NULL)
3049+
AND (@BackupType IN('DIFF','FULL') OR (@ChangeBackupType = 'Y' AND @CurrentBackupType = 'LOG' AND @CurrentRecoveryModel IN('FULL','BULK_LOGGED') AND @CurrentLogLSN IS NULL AND @CurrentDatabaseName <> 'master'))
3050+
AND (@ModificationLevel IS NOT NULL OR @MinBackupSizeForMultipleFiles IS NOT NULL OR @MaxFileSize IS NOT NULL)
30493051
BEGIN
30503052
SET @CurrentCommand = 'SELECT @ParamAllocatedExtentPageCount = SUM(allocated_extent_page_count), @ParamModifiedExtentPageCount = SUM(modified_extent_page_count) FROM sys.dm_db_file_space_usage'
30513053

@@ -4509,7 +4511,7 @@ BEGIN
45094511
--// Source: https://ola.hallengren.com //--
45104512
--// License: https://ola.hallengren.com/license.html //--
45114513
--// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //--
4512-
--// Version: 2021-12-30 19:45:09 //--
4514+
--// Version: 2021-12-31 19:48:31 //--
45134515
----------------------------------------------------------------------------------------------------
45144516

45154517
SET NOCOUNT ON
@@ -5827,7 +5829,7 @@ BEGIN
58275829
RAISERROR('%s',10,1,@DatabaseMessage) WITH NOWAIT
58285830
END
58295831

5830-
IF @CurrentDatabaseState = 'ONLINE' AND SERVERPROPERTY('EngineEdition') <> 5
5832+
IF @CurrentDatabaseState IN('ONLINE','EMERGENCY') AND SERVERPROPERTY('EngineEdition') <> 5
58315833
BEGIN
58325834
IF EXISTS (SELECT * FROM sys.database_recovery_status WHERE database_id = DB_ID(@CurrentDatabaseName) AND database_guid IS NOT NULL)
58335835
BEGIN
@@ -5911,7 +5913,7 @@ BEGIN
59115913

59125914
RAISERROR(@EmptyLine,10,1) WITH NOWAIT
59135915

5914-
IF @CurrentDatabaseState = 'ONLINE'
5916+
IF @CurrentDatabaseState IN('ONLINE','EMERGENCY')
59155917
AND NOT (@CurrentUserAccess = 'SINGLE_USER' AND @CurrentIsDatabaseAccessible = 0)
59165918
AND (@CurrentAvailabilityGroupRole = 'PRIMARY' OR @CurrentAvailabilityGroupRole IS NULL OR SERVERPROPERTY('EngineEdition') = 3)
59175919
AND ((@AvailabilityGroupReplicas = 'PRIMARY' AND @CurrentAvailabilityGroupRole = 'PRIMARY') OR (@AvailabilityGroupReplicas = 'SECONDARY' AND @CurrentAvailabilityGroupRole = 'SECONDARY') OR (@AvailabilityGroupReplicas = 'PREFERRED_BACKUP_REPLICA' AND @CurrentIsPreferredBackupReplica = 1) OR @AvailabilityGroupReplicas = 'ALL' OR @CurrentAvailabilityGroupRole IS NULL)
@@ -6411,7 +6413,7 @@ BEGIN
64116413
--// Source: https://ola.hallengren.com //--
64126414
--// License: https://ola.hallengren.com/license.html //--
64136415
--// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //--
6414-
--// Version: 2021-12-30 19:45:09 //--
6416+
--// Version: 2021-12-31 19:48:31 //--
64156417
----------------------------------------------------------------------------------------------------
64166418

64176419
SET NOCOUNT ON

0 commit comments

Comments
 (0)