Skip to content

Commit 5f5e9d3

Browse files
Add files via upload
1 parent 4e6c932 commit 5f5e9d3

5 files changed

Lines changed: 37 additions & 15 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: 2020-12-31 18:58:56 //--
39+
--// Version: 2021-12-30 19:45:09 //--
4040
----------------------------------------------------------------------------------------------------
4141

4242
SET NOCOUNT ON

DatabaseBackup.sql

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ ALTER PROCEDURE [dbo].[DatabaseBackup]
6565
@Format nvarchar(max) = 'N',
6666
@ObjectLevelRecoveryMap nvarchar(max) = 'N',
6767
@ExcludeLogShippedFromLogBackup nvarchar(max) = 'Y',
68+
@DirectoryCheck nvarchar(max) = 'Y',
6869
@StringDelimiter nvarchar(max) = ',',
6970
@DatabaseOrder nvarchar(max) = NULL,
7071
@DatabasesInParallel nvarchar(max) = 'N',
@@ -79,7 +80,7 @@ BEGIN
7980
--// Source: https://ola.hallengren.com //--
8081
--// License: https://ola.hallengren.com/license.html //--
8182
--// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //--
82-
--// Version: 2020-12-31 18:58:56 //--
83+
--// Version: 2021-12-30 19:45:09 //--
8384
----------------------------------------------------------------------------------------------------
8485

8586
SET NOCOUNT ON
@@ -327,6 +328,7 @@ BEGIN
327328
SET @Parameters += ', @Format = ' + ISNULL('''' + REPLACE(@Format,'''','''''') + '''','NULL')
328329
SET @Parameters += ', @ObjectLevelRecoveryMap = ' + ISNULL('''' + REPLACE(@ObjectLevelRecoveryMap,'''','''''') + '''','NULL')
329330
SET @Parameters += ', @ExcludeLogShippedFromLogBackup = ' + ISNULL('''' + REPLACE(@ExcludeLogShippedFromLogBackup,'''','''''') + '''','NULL')
331+
SET @Parameters += ', @DirectoryCheck = ' + ISNULL('''' + REPLACE(@DirectoryCheck,'''','''''') + '''','NULL')
330332
SET @Parameters += ', @StringDelimiter = ' + ISNULL('''' + REPLACE(@StringDelimiter,'''','''''') + '''','NULL')
331333
SET @Parameters += ', @DatabaseOrder = ' + ISNULL('''' + REPLACE(@DatabaseOrder,'''','''''') + '''','NULL')
332334
SET @Parameters += ', @DatabasesInParallel = ' + ISNULL('''' + REPLACE(@DatabasesInParallel,'''','''''') + '''','NULL')
@@ -871,7 +873,7 @@ BEGIN
871873

872874
----------------------------------------------------------------------------------------------------
873875

874-
IF NOT EXISTS (SELECT * FROM @Errors WHERE Severity >= 16)
876+
IF NOT EXISTS (SELECT * FROM @Errors WHERE Severity >= 16) AND @DirectoryCheck = 'Y'
875877
BEGIN
876878
WHILE (1 = 1)
877879
BEGIN
@@ -2172,6 +2174,14 @@ BEGIN
21722174

21732175
----------------------------------------------------------------------------------------------------
21742176

2177+
IF @DirectoryCheck NOT IN('Y','N') OR @DirectoryCheck IS NULL
2178+
BEGIN
2179+
INSERT INTO @Errors ([Message], Severity, [State])
2180+
SELECT 'The value for the parameter @DirectoryCheck is not supported.', 16, 1
2181+
END
2182+
2183+
----------------------------------------------------------------------------------------------------
2184+
21752185
IF @StringDelimiter IS NULL OR LEN(@StringDelimiter) > 1
21762186
BEGIN
21772187
INSERT INTO @Errors ([Message], Severity, [State])
@@ -3332,7 +3342,7 @@ BEGIN
33323342
-- Create directory
33333343
IF @HostPlatform = 'Windows'
33343344
AND (@BackupSoftware <> 'DATA_DOMAIN_BOOST' OR @BackupSoftware IS NULL)
3335-
AND NOT EXISTS(SELECT * FROM @CurrentDirectories WHERE DirectoryPath = 'NUL')
3345+
AND NOT EXISTS(SELECT * FROM @CurrentDirectories WHERE DirectoryPath = 'NUL' OR DirectoryPath IN(SELECT DirectoryPath FROM @Directories))
33363346
BEGIN
33373347
WHILE (1 = 1)
33383348
BEGIN
@@ -3484,7 +3494,8 @@ BEGIN
34843494
END
34853495

34863496
-- Perform a backup
3487-
IF NOT EXISTS (SELECT * FROM @CurrentDirectories WHERE DirectoryPath <> 'NUL' AND (CreateOutput <> 0 OR CreateOutput IS NULL)) OR @HostPlatform = 'Linux'
3497+
IF NOT EXISTS (SELECT * FROM @CurrentDirectories WHERE DirectoryPath <> 'NUL' AND DirectoryPath NOT IN(SELECT DirectoryPath FROM @Directories) AND (CreateOutput <> 0 OR CreateOutput IS NULL))
3498+
OR @HostPlatform = 'Linux'
34883499
BEGIN
34893500
IF @BackupSoftware IS NULL
34903501
BEGIN

DatabaseIntegrityCheck.sql

Lines changed: 1 addition & 1 deletion
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: 2020-12-31 18:58:56 //--
42+
--// Version: 2021-12-30 19:45:09 //--
4343
----------------------------------------------------------------------------------------------------
4444

4545
SET NOCOUNT ON

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: 2020-12-31 18:58:56 //--
56+
--// Version: 2021-12-30 19:45:09 //--
5757
----------------------------------------------------------------------------------------------------
5858

5959
SET NOCOUNT ON

MaintenanceSolution.sql

Lines changed: 19 additions & 8 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: 2020-12-31 18:58:56
13+
Version: 2021-12-30 19:45:09
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: 2020-12-31 18:58:56 //--
126+
--// Version: 2021-12-30 19:45:09 //--
127127
----------------------------------------------------------------------------------------------------
128128

129129
SET NOCOUNT ON
@@ -444,6 +444,7 @@ ALTER PROCEDURE [dbo].[DatabaseBackup]
444444
@Format nvarchar(max) = 'N',
445445
@ObjectLevelRecoveryMap nvarchar(max) = 'N',
446446
@ExcludeLogShippedFromLogBackup nvarchar(max) = 'Y',
447+
@DirectoryCheck nvarchar(max) = 'Y',
447448
@StringDelimiter nvarchar(max) = ',',
448449
@DatabaseOrder nvarchar(max) = NULL,
449450
@DatabasesInParallel nvarchar(max) = 'N',
@@ -458,7 +459,7 @@ BEGIN
458459
--// Source: https://ola.hallengren.com //--
459460
--// License: https://ola.hallengren.com/license.html //--
460461
--// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //--
461-
--// Version: 2020-12-31 18:58:56 //--
462+
--// Version: 2021-12-30 19:45:09 //--
462463
----------------------------------------------------------------------------------------------------
463464

464465
SET NOCOUNT ON
@@ -706,6 +707,7 @@ BEGIN
706707
SET @Parameters += ', @Format = ' + ISNULL('''' + REPLACE(@Format,'''','''''') + '''','NULL')
707708
SET @Parameters += ', @ObjectLevelRecoveryMap = ' + ISNULL('''' + REPLACE(@ObjectLevelRecoveryMap,'''','''''') + '''','NULL')
708709
SET @Parameters += ', @ExcludeLogShippedFromLogBackup = ' + ISNULL('''' + REPLACE(@ExcludeLogShippedFromLogBackup,'''','''''') + '''','NULL')
710+
SET @Parameters += ', @DirectoryCheck = ' + ISNULL('''' + REPLACE(@DirectoryCheck,'''','''''') + '''','NULL')
709711
SET @Parameters += ', @StringDelimiter = ' + ISNULL('''' + REPLACE(@StringDelimiter,'''','''''') + '''','NULL')
710712
SET @Parameters += ', @DatabaseOrder = ' + ISNULL('''' + REPLACE(@DatabaseOrder,'''','''''') + '''','NULL')
711713
SET @Parameters += ', @DatabasesInParallel = ' + ISNULL('''' + REPLACE(@DatabasesInParallel,'''','''''') + '''','NULL')
@@ -1250,7 +1252,7 @@ BEGIN
12501252

12511253
----------------------------------------------------------------------------------------------------
12521254

1253-
IF NOT EXISTS (SELECT * FROM @Errors WHERE Severity >= 16)
1255+
IF NOT EXISTS (SELECT * FROM @Errors WHERE Severity >= 16) AND @DirectoryCheck = 'Y'
12541256
BEGIN
12551257
WHILE (1 = 1)
12561258
BEGIN
@@ -2551,6 +2553,14 @@ BEGIN
25512553

25522554
----------------------------------------------------------------------------------------------------
25532555

2556+
IF @DirectoryCheck NOT IN('Y','N') OR @DirectoryCheck IS NULL
2557+
BEGIN
2558+
INSERT INTO @Errors ([Message], Severity, [State])
2559+
SELECT 'The value for the parameter @DirectoryCheck is not supported.', 16, 1
2560+
END
2561+
2562+
----------------------------------------------------------------------------------------------------
2563+
25542564
IF @StringDelimiter IS NULL OR LEN(@StringDelimiter) > 1
25552565
BEGIN
25562566
INSERT INTO @Errors ([Message], Severity, [State])
@@ -3711,7 +3721,7 @@ BEGIN
37113721
-- Create directory
37123722
IF @HostPlatform = 'Windows'
37133723
AND (@BackupSoftware <> 'DATA_DOMAIN_BOOST' OR @BackupSoftware IS NULL)
3714-
AND NOT EXISTS(SELECT * FROM @CurrentDirectories WHERE DirectoryPath = 'NUL')
3724+
AND NOT EXISTS(SELECT * FROM @CurrentDirectories WHERE DirectoryPath = 'NUL' OR DirectoryPath IN(SELECT DirectoryPath FROM @Directories))
37153725
BEGIN
37163726
WHILE (1 = 1)
37173727
BEGIN
@@ -3863,7 +3873,8 @@ BEGIN
38633873
END
38643874

38653875
-- Perform a backup
3866-
IF NOT EXISTS (SELECT * FROM @CurrentDirectories WHERE DirectoryPath <> 'NUL' AND (CreateOutput <> 0 OR CreateOutput IS NULL)) OR @HostPlatform = 'Linux'
3876+
IF NOT EXISTS (SELECT * FROM @CurrentDirectories WHERE DirectoryPath <> 'NUL' AND DirectoryPath NOT IN(SELECT DirectoryPath FROM @Directories) AND (CreateOutput <> 0 OR CreateOutput IS NULL))
3877+
OR @HostPlatform = 'Linux'
38673878
BEGIN
38683879
IF @BackupSoftware IS NULL
38693880
BEGIN
@@ -4498,7 +4509,7 @@ BEGIN
44984509
--// Source: https://ola.hallengren.com //--
44994510
--// License: https://ola.hallengren.com/license.html //--
45004511
--// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //--
4501-
--// Version: 2020-12-31 18:58:56 //--
4512+
--// Version: 2021-12-30 19:45:09 //--
45024513
----------------------------------------------------------------------------------------------------
45034514

45044515
SET NOCOUNT ON
@@ -6400,7 +6411,7 @@ BEGIN
64006411
--// Source: https://ola.hallengren.com //--
64016412
--// License: https://ola.hallengren.com/license.html //--
64026413
--// GitHub: https://github.com/olahallengren/sql-server-maintenance-solution //--
6403-
--// Version: 2020-12-31 18:58:56 //--
6414+
--// Version: 2021-12-30 19:45:09 //--
64046415
----------------------------------------------------------------------------------------------------
64056416

64066417
SET NOCOUNT ON

0 commit comments

Comments
 (0)