You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IF (SELECTCOUNT(*) FROM @Directories WHERE Mirror =0) <> (SELECTCOUNT(*) FROM @Directories WHERE Mirror =1) AND (SELECTCOUNT(*) FROM @Directories WHERE Mirror =1) >0
801
801
BEGIN
802
802
INSERTINTO @Errors ([Message], Severity, [State])
803
-
SELECT'The value for the parameter @Directory is not supported.', 16, 3
803
+
SELECT'The number of directories for the parameters @Directory and @MirrorDirectory has to be the same.', 16, 3
804
804
END
805
805
806
806
IF (@Directory ISNOTNULLANDSERVERPROPERTY('EngineEdition') =8) OR (@Directory ISNOTNULLAND @BackupSoftware ='DATA_DOMAIN_BOOST')
@@ -818,7 +818,7 @@ BEGIN
818
818
IFEXISTS (SELECT*FROM @Directories WHERE Mirror =0AND DirectoryPath ='NUL') ANDEXISTS(SELECT*FROM @Directories WHERE Mirror =1)
819
819
BEGIN
820
820
INSERTINTO @Errors ([Message], Severity, [State])
821
-
SELECT'The value for the parameter @Directory is not supported.', 16, 6
821
+
SELECT'Mirrored backup is not supported when backing up to NUL', 16, 6
SELECT'The value for the parameter @MirrorDirectory is not supported.', 16, 2
836
836
END
837
837
838
-
IF (SELECTCOUNT(*) FROM @Directories WHERE Mirror =0) <> (SELECTCOUNT(*) FROM @Directories WHERE Mirror =1) AND (SELECTCOUNT(*) FROM @Directories WHERE Mirror =1) >0
839
-
BEGIN
840
-
INSERTINTO @Errors ([Message], Severity, [State])
841
-
SELECT'The value for the parameter @MirrorDirectory is not supported.', 16, 3
842
-
END
843
-
844
838
IF @BackupSoftware IN('SQLBACKUP','SQLSAFE') AND (SELECTCOUNT(*) FROM @Directories WHERE Mirror =1) >1
845
839
BEGIN
846
840
INSERTINTO @Errors ([Message], Severity, [State])
@@ -859,12 +853,6 @@ BEGIN
859
853
SELECT'The value for the parameter @MirrorDirectory is not supported.', 16, 6
860
854
END
861
855
862
-
IFEXISTS(SELECT*FROM @Directories WHERE Mirror =0AND DirectoryPath ='NUL') ANDEXISTS(SELECT*FROM @Directories WHERE Mirror =1)
863
-
BEGIN
864
-
INSERTINTO @Errors ([Message], Severity, [State])
865
-
SELECT'The value for the parameter @MirrorDirectory is not supported.', 16, 7
866
-
END
867
-
868
856
IF (@BackupSoftware ISNULLANDEXISTS(SELECT*FROM @Directories WHERE Mirror =1) ANDSERVERPROPERTY('EngineEdition') <>3)
869
857
BEGIN
870
858
INSERTINTO @Errors ([Message], Severity, [State])
@@ -1176,7 +1164,7 @@ BEGIN
1176
1164
IF @Compress ='Y'AND @BackupSoftware ISNULLANDNOT ((@Version >=10AND @Version <10.5ANDSERVERPROPERTY('EngineEdition') =3) OR (@Version >=10.5AND (SERVERPROPERTY('EngineEdition') IN (3, 8) ORSERVERPROPERTY('EditionID') IN (-1534726760, 284895786))))
1177
1165
BEGIN
1178
1166
INSERTINTO @Errors ([Message], Severity, [State])
1179
-
SELECT'The value for the parameter @Compress is not supported.', 16, 2
1167
+
SELECT'The value for the parameter @Compress is not supported. Backup compression is not supported in this version and edition of SQL Server.', 16, 2
1180
1168
END
1181
1169
1182
1170
IF @Compress ='N'AND @BackupSoftware IN ('LITESPEED','SQLBACKUP','SQLSAFE') AND (@CompressionLevel ISNULLOR @CompressionLevel >=1)
@@ -1276,7 +1264,7 @@ BEGIN
1276
1264
IF @BlockSize ISNOTNULLAND @URL ISNOTNULLAND @Credential ISNOTNULL
1277
1265
BEGIN
1278
1266
INSERTINTO @Errors ([Message], Severity, [State])
1279
-
SELECT'The value for the parameter @BlockSize is not supported.', 16, 4
1267
+
SELECT'BLOCKSIZE is not supported when backing up to URL with page blobs. See https://docs.microsoft.com/en-us/sql/relational-databases/backup-restore/sql-server-backup-to-url', 16, 4
1280
1268
END
1281
1269
1282
1270
IF @BlockSize ISNOTNULLAND @BackupSoftware ='DATA_DOMAIN_BOOST'
@@ -1328,7 +1316,7 @@ BEGIN
1328
1316
IF @MaxTransferSize ISNOTNULLAND @URL ISNOTNULLAND @Credential ISNOTNULL
1329
1317
BEGIN
1330
1318
INSERTINTO @Errors ([Message], Severity, [State])
1331
-
SELECT'The value for the parameter @MaxTransferSize is not supported.', 16, 4
1319
+
SELECT'MAXTRANSFERSIZE is not supported when backing up to URL with page blobs. See https://docs.microsoft.com/en-us/sql/relational-databases/backup-restore/sql-server-backup-to-url', 16, 4
1332
1320
END
1333
1321
1334
1322
IF @MaxTransferSize ISNOTNULLAND @BackupSoftware ='DATA_DOMAIN_BOOST'
@@ -1366,7 +1354,7 @@ BEGIN
1366
1354
IF @URL ISNOTNULLAND @Credential ISNOTNULLAND @NumberOfFiles <>1
1367
1355
BEGIN
1368
1356
INSERTINTO @Errors ([Message], Severity, [State])
1369
-
SELECT'The value for the parameter @NumberOfFiles is not supported.', 16, 5
1357
+
SELECT'Backup striping to URL with page blobs is not supported. See https://docs.microsoft.com/en-us/sql/relational-databases/backup-restore/sql-server-backup-to-url', 16, 5
1370
1358
END
1371
1359
1372
1360
IF @NumberOfFiles >1AND @BackupSoftware IN('SQLBACKUP','SQLSAFE') ANDEXISTS(SELECT*FROM @Directories WHERE Mirror =1)
@@ -2615,7 +2603,7 @@ BEGIN
2615
2603
WHEN @MaxTransferSize ISNULLAND @Compress ='Y'AND @CurrentIsEncrypted =1AND @BackupSoftware ISNULLAND (@Version >=13AND @Version <15.0404316) AND @Credential ISNULLTHEN65537
2616
2604
END
2617
2605
2618
-
IF @CurrentDatabaseState ='ONLINE'
2606
+
IF @CurrentDatabaseState ='ONLINE'ANDNOT (@CurrentInStandby =1)
2619
2607
BEGIN
2620
2608
IFEXISTS (SELECT*FROMsys.database_recovery_statusWHERE database_id =DB_ID(@CurrentDatabaseName) AND database_guid ISNOTNULL)
2621
2609
BEGIN
@@ -2659,14 +2647,16 @@ BEGIN
2659
2647
AND [type] =0
2660
2648
AND [file_id] =1
2661
2649
2662
-
IF @CurrentDatabaseState ='ONLINE'
2650
+
IF @CurrentDatabaseState ='ONLINE'ANDNOT (@CurrentInStandby =1)
2663
2651
BEGIN
2664
2652
SELECT @CurrentLogLSN = last_log_backup_lsn
2665
2653
FROMsys.database_recovery_status
2666
2654
WHERE database_id =DB_ID(@CurrentDatabaseName)
2667
2655
END
2668
2656
2669
-
IF @CurrentDatabaseState ='ONLINE'ANDEXISTS(SELECT*FROMsys.all_columnsWHEREobject_id=OBJECT_ID('sys.dm_db_file_space_usage') ANDname='modified_extent_page_count') AND (@CurrentAvailabilityGroupRole ='PRIMARY'OR @CurrentAvailabilityGroupRole ISNULL)
2657
+
IF @CurrentDatabaseState ='ONLINE'ANDNOT (@CurrentInStandby =1)
AND (@CurrentAvailabilityGroupRole ='PRIMARY'OR @CurrentAvailabilityGroupRole ISNULL)
2670
2660
AND (@BackupType IN('DIFF','FULL') OR (@ChangeBackupType ='Y'AND @CurrentBackupType ='LOG'AND @CurrentRecoveryModel IN('FULL','BULK_LOGGED') AND @CurrentLogLSN ISNULLAND @CurrentDatabaseName <>'master'))
2671
2661
AND (@ModificationLevel ISNOTNULLOR @MinBackupSizeForMultipleFiles ISNOTNULLOR @MaxFileSize ISNOTNULL)
2672
2662
BEGIN
@@ -2689,7 +2679,8 @@ BEGIN
2689
2679
END
2690
2680
END
2691
2681
2692
-
IF @CurrentDatabaseState ='ONLINE'ANDEXISTS(SELECT*FROMsys.all_columnsWHEREobject_id=OBJECT_ID('sys.dm_db_log_stats') ANDname='log_since_last_log_backup_mb')
2682
+
IF @CurrentDatabaseState ='ONLINE'ANDNOT (@CurrentInStandby =1)
IF (SELECTCOUNT(*) FROM @Directories WHERE Mirror =0) <> (SELECTCOUNT(*) FROM @Directories WHERE Mirror =1) AND (SELECTCOUNT(*) FROM @Directories WHERE Mirror =1) >0
1180
1180
BEGIN
1181
1181
INSERTINTO @Errors ([Message], Severity, [State])
1182
-
SELECT'The value for the parameter @Directory is not supported.', 16, 3
1182
+
SELECT'The number of directories for the parameters @Directory and @MirrorDirectory has to be the same.', 16, 3
1183
1183
END
1184
1184
1185
1185
IF (@Directory ISNOTNULLANDSERVERPROPERTY('EngineEdition') =8) OR (@Directory ISNOTNULLAND @BackupSoftware ='DATA_DOMAIN_BOOST')
@@ -1197,7 +1197,7 @@ BEGIN
1197
1197
IFEXISTS (SELECT*FROM @Directories WHERE Mirror =0AND DirectoryPath ='NUL') ANDEXISTS(SELECT*FROM @Directories WHERE Mirror =1)
1198
1198
BEGIN
1199
1199
INSERTINTO @Errors ([Message], Severity, [State])
1200
-
SELECT'The value for the parameter @Directory is not supported.', 16, 6
1200
+
SELECT'Mirrored backup is not supported when backing up to NUL', 16, 6
SELECT'The value for the parameter @MirrorDirectory is not supported.', 16, 2
1215
1215
END
1216
1216
1217
-
IF (SELECTCOUNT(*) FROM @Directories WHERE Mirror =0) <> (SELECTCOUNT(*) FROM @Directories WHERE Mirror =1) AND (SELECTCOUNT(*) FROM @Directories WHERE Mirror =1) >0
1218
-
BEGIN
1219
-
INSERTINTO @Errors ([Message], Severity, [State])
1220
-
SELECT'The value for the parameter @MirrorDirectory is not supported.', 16, 3
1221
-
END
1222
-
1223
1217
IF @BackupSoftware IN('SQLBACKUP','SQLSAFE') AND (SELECTCOUNT(*) FROM @Directories WHERE Mirror =1) >1
1224
1218
BEGIN
1225
1219
INSERTINTO @Errors ([Message], Severity, [State])
@@ -1238,12 +1232,6 @@ BEGIN
1238
1232
SELECT'The value for the parameter @MirrorDirectory is not supported.', 16, 6
1239
1233
END
1240
1234
1241
-
IFEXISTS(SELECT*FROM @Directories WHERE Mirror =0AND DirectoryPath ='NUL') ANDEXISTS(SELECT*FROM @Directories WHERE Mirror =1)
1242
-
BEGIN
1243
-
INSERTINTO @Errors ([Message], Severity, [State])
1244
-
SELECT'The value for the parameter @MirrorDirectory is not supported.', 16, 7
1245
-
END
1246
-
1247
1235
IF (@BackupSoftware ISNULLANDEXISTS(SELECT*FROM @Directories WHERE Mirror =1) ANDSERVERPROPERTY('EngineEdition') <>3)
1248
1236
BEGIN
1249
1237
INSERTINTO @Errors ([Message], Severity, [State])
@@ -1555,7 +1543,7 @@ BEGIN
1555
1543
IF @Compress ='Y'AND @BackupSoftware ISNULLANDNOT ((@Version >=10AND @Version <10.5ANDSERVERPROPERTY('EngineEdition') =3) OR (@Version >=10.5AND (SERVERPROPERTY('EngineEdition') IN (3, 8) ORSERVERPROPERTY('EditionID') IN (-1534726760, 284895786))))
1556
1544
BEGIN
1557
1545
INSERTINTO @Errors ([Message], Severity, [State])
1558
-
SELECT'The value for the parameter @Compress is not supported.', 16, 2
1546
+
SELECT'The value for the parameter @Compress is not supported. Backup compression is not supported in this version and edition of SQL Server.', 16, 2
1559
1547
END
1560
1548
1561
1549
IF @Compress ='N'AND @BackupSoftware IN ('LITESPEED','SQLBACKUP','SQLSAFE') AND (@CompressionLevel ISNULLOR @CompressionLevel >=1)
@@ -1655,7 +1643,7 @@ BEGIN
1655
1643
IF @BlockSize ISNOTNULLAND @URL ISNOTNULLAND @Credential ISNOTNULL
1656
1644
BEGIN
1657
1645
INSERTINTO @Errors ([Message], Severity, [State])
1658
-
SELECT'The value for the parameter @BlockSize is not supported.', 16, 4
1646
+
SELECT'BLOCKSIZE is not supported when backing up to URL with page blobs. See https://docs.microsoft.com/en-us/sql/relational-databases/backup-restore/sql-server-backup-to-url', 16, 4
1659
1647
END
1660
1648
1661
1649
IF @BlockSize ISNOTNULLAND @BackupSoftware ='DATA_DOMAIN_BOOST'
@@ -1707,7 +1695,7 @@ BEGIN
1707
1695
IF @MaxTransferSize ISNOTNULLAND @URL ISNOTNULLAND @Credential ISNOTNULL
1708
1696
BEGIN
1709
1697
INSERTINTO @Errors ([Message], Severity, [State])
1710
-
SELECT'The value for the parameter @MaxTransferSize is not supported.', 16, 4
1698
+
SELECT'MAXTRANSFERSIZE is not supported when backing up to URL with page blobs. See https://docs.microsoft.com/en-us/sql/relational-databases/backup-restore/sql-server-backup-to-url', 16, 4
1711
1699
END
1712
1700
1713
1701
IF @MaxTransferSize ISNOTNULLAND @BackupSoftware ='DATA_DOMAIN_BOOST'
@@ -1745,7 +1733,7 @@ BEGIN
1745
1733
IF @URL ISNOTNULLAND @Credential ISNOTNULLAND @NumberOfFiles <>1
1746
1734
BEGIN
1747
1735
INSERTINTO @Errors ([Message], Severity, [State])
1748
-
SELECT'The value for the parameter @NumberOfFiles is not supported.', 16, 5
1736
+
SELECT'Backup striping to URL with page blobs is not supported. See https://docs.microsoft.com/en-us/sql/relational-databases/backup-restore/sql-server-backup-to-url', 16, 5
1749
1737
END
1750
1738
1751
1739
IF @NumberOfFiles >1AND @BackupSoftware IN('SQLBACKUP','SQLSAFE') ANDEXISTS(SELECT*FROM @Directories WHERE Mirror =1)
@@ -2994,7 +2982,7 @@ BEGIN
2994
2982
WHEN @MaxTransferSize ISNULLAND @Compress ='Y'AND @CurrentIsEncrypted =1AND @BackupSoftware ISNULLAND (@Version >=13AND @Version <15.0404316) AND @Credential ISNULLTHEN65537
2995
2983
END
2996
2984
2997
-
IF @CurrentDatabaseState ='ONLINE'
2985
+
IF @CurrentDatabaseState ='ONLINE'ANDNOT (@CurrentInStandby =1)
2998
2986
BEGIN
2999
2987
IFEXISTS (SELECT*FROMsys.database_recovery_statusWHERE database_id =DB_ID(@CurrentDatabaseName) AND database_guid ISNOTNULL)
3000
2988
BEGIN
@@ -3038,14 +3026,16 @@ BEGIN
3038
3026
AND [type] =0
3039
3027
AND [file_id] =1
3040
3028
3041
-
IF @CurrentDatabaseState ='ONLINE'
3029
+
IF @CurrentDatabaseState ='ONLINE'ANDNOT (@CurrentInStandby =1)
3042
3030
BEGIN
3043
3031
SELECT @CurrentLogLSN = last_log_backup_lsn
3044
3032
FROMsys.database_recovery_status
3045
3033
WHERE database_id =DB_ID(@CurrentDatabaseName)
3046
3034
END
3047
3035
3048
-
IF @CurrentDatabaseState ='ONLINE'ANDEXISTS(SELECT*FROMsys.all_columnsWHEREobject_id=OBJECT_ID('sys.dm_db_file_space_usage') ANDname='modified_extent_page_count') AND (@CurrentAvailabilityGroupRole ='PRIMARY'OR @CurrentAvailabilityGroupRole ISNULL)
3036
+
IF @CurrentDatabaseState ='ONLINE'ANDNOT (@CurrentInStandby =1)
AND (@CurrentAvailabilityGroupRole ='PRIMARY'OR @CurrentAvailabilityGroupRole ISNULL)
3049
3039
AND (@BackupType IN('DIFF','FULL') OR (@ChangeBackupType ='Y'AND @CurrentBackupType ='LOG'AND @CurrentRecoveryModel IN('FULL','BULK_LOGGED') AND @CurrentLogLSN ISNULLAND @CurrentDatabaseName <>'master'))
3050
3040
AND (@ModificationLevel ISNOTNULLOR @MinBackupSizeForMultipleFiles ISNOTNULLOR @MaxFileSize ISNOTNULL)
3051
3041
BEGIN
@@ -3068,7 +3058,8 @@ BEGIN
3068
3058
END
3069
3059
END
3070
3060
3071
-
IF @CurrentDatabaseState ='ONLINE'ANDEXISTS(SELECT*FROMsys.all_columnsWHEREobject_id=OBJECT_ID('sys.dm_db_log_stats') ANDname='log_since_last_log_backup_mb')
3061
+
IF @CurrentDatabaseState ='ONLINE'ANDNOT (@CurrentInStandby =1)
0 commit comments