olahallengren / sql-server-maintenance-solution

SQL Server Maintenance Solution
https://ola.hallengren.com
MIT License
2.91k stars 756 forks source link

AWS S3 backup - specify MirrorURL - 64 files causes an error #824

Closed fill-e closed 3 weeks ago

fill-e commented 4 weeks ago

Backup to S3 URL only supports 64 total files (ie adding 1 mirror means 32 urls per backup command..4 mirrors means 16 urls - url counts do need to match across all mirror backups.

SQL Server version and edition Microsoft SQL Server 2022 (RTM-CU6) (KB5027505) - 16.0.4055.4 (X64) Jun 29 2023 15:43:13 Copyright (C) 2022 Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2022 Datacenter 10.0 (Build 20348: ) (Hypervisor)

Version of the script Version: 2024-10-19 20:13:17

What command are you executing? EXECUTE [dbo].[DatabaseBackup] @Databases = 'USER_DATABASES', @Directory = NULL, @BackupType = 'FULL', @Verify = 'Y', @CleanupTime = NULL, @CheckSum = 'Y', @LogToTable = 'Y', @URL = 's3://sql-backups-ekins.s3.us-east-2.amazonaws.com/backups', @MirrorURL = 's3://sql-backups-ekins-ohio.s3.us-east-2.amazonaws.com/backups', @NumberOfFiles = 64, @MaxTransferSize = 20971520, @Compress = 'Y'

What output are you getting? Date and time: 2024-10-24 22:45:26 Server: EC2AMAZ-SM2Q69S Version: 16.0.4055.4 Edition: Enterprise Edition: Core-based Licensing (64-bit) Platform: Windows Procedure: [master].[dbo].[DatabaseBackup] Parameters: @Databases = 'USER_DATABASES', @Directory = NULL, @BackupType = 'FULL', @Verify = 'Y', @CleanupTime = NULL, @CleanupMode = 'AFTER_BACKUP', @Compress = 'Y', @CopyOnly = 'N', @ChangeBackupType = 'N', @BackupSoftware = NULL, @CheckSum = 'Y', @BlockSize = NULL, @BufferCount = NULL, @MaxTransferSize = 20971520, @NumberOfFiles = 64, @MinBackupSizeForMultipleFiles = NULL, @MaxFileSize = NULL, @CompressionLevel = NULL, @Description = NULL, @Threads = NULL, @Throttle = NULL, @Encrypt = 'N', @EncryptionAlgorithm = NULL, @ServerCertificate = NULL, @ServerAsymmetricKey = NULL, @EncryptionKey = NULL, @ReadWriteFileGroups = 'N', @OverrideBackupPreference = 'N', @NoRecovery = 'N', @URL = 's3://sql-backups-ekins.s3.us-east-2.amazonaws.com/backups', @Credential = NULL, @MirrorDirectory = NULL, @MirrorCleanupTime = NULL, @MirrorCleanupMode = 'AFTERBACKUP', @MirrorURL = 's3://sql-backups-ekins-ohio.s3.us-east-2.amazonaws.com/backups', @AvailabilityGroups = NULL, @Updateability = 'ALL', @AdaptiveCompression = NULL, @ModificationLevel = NULL, @LogSizeSinceLastLogBackup = NULL, @TimeSinceLastLogBackup = NULL, @DataDomainBoostHost = NULL, @DataDomainBoostUser = NULL, @DataDomainBoostDevicePath = NULL, @DataDomainBoostLockboxPath = NULL, @DirectoryStructure = '{ServerName}${InstanceName}{DirectorySeparator}{DatabaseName}{DirectorySeparator}{BackupType}{Partial}{CopyOnly}', @AvailabilityGroupDirectoryStructure = '{ClusterName}${AvailabilityGroupName}{DirectorySeparator}{DatabaseName}{DirectorySeparator}{BackupType}{Partial}{CopyOnly}', @FileName = '{ServerName}${InstanceName}{DatabaseName}{BackupType}{Partial}{CopyOnly}{Year}{Month}{Day}{Hour}{Minute}{Second}{FileNumber}.{FileExtension}', @AvailabilityGroupFileName = '{ClusterName}${AvailabilityGroupName}{DatabaseName}{BackupType}{Partial}{CopyOnly}{Year}{Month}{Day}{Hour}{Minute}{Second}_{FileNumber}.{FileExtension}', @FileExtensionFull = NULL, @FileExtensionDiff = NULL, @FileExtensionLog = NULL, @Init = 'N', @Format = 'N', @ObjectLevelRecoveryMap = 'N'... Version: 2024-10-19 20:13:17 Source: https://ola.hallengren.com

Date and time: 2024-10-24 22:45:26 Database: [db1] State: ONLINE Standby: No Updateability: READ_WRITE User access: MULTI_USER Recovery model: FULL Encrypted: No Is accessible: Yes Differential base LSN: 42000000103200001 Last log backup LSN: 39000000038400001 Allocated extent page count: N/A Modified extent page count: N/A

Date and time: 2024-10-24 22:45:26 Database context: [master] Command: BACKUP DATABASE [db1] TO URL = N's3://sql-backups-ekins.s3.us-east-2.amazonaws.com/backups/EC2AMAZ-SM2Q69S/db1/FULL/EC2AMAZ-SM2Q69S_db1_FULL_20241024_224526_01.bak', URL = N's3://sql-backups-ekins.s3.us-east-2.amazonaws.com/backups/EC2AMAZ-SM2Q69S/db1/FULL/EC2AMAZ-SM2Q69S_db1_FULL_20241024_224526_02.bak', URL = N's3://sql-backups-ekins.s3.us-east-2.amazonaws.com/backups/EC2AMAZ-SM2Q69S/db1/FULL/EC2AMAZ-SM2Q69S_db1_FULL_20241024_224526_03.bak', URL = N's3://sql-backups-ekins.s3.us-east-2.amazonaws.com/backups/EC2AMAZ-SM2Q69S/db1/FULL/EC2AMAZ-SM2Q69S_db1_FULL_20241024_224526_04.bak', URL = N's3://sql-backups-ekins.s3.us-east-2.amazonaws.com/backups/EC2AMAZ-SM2Q69S/db1/FULL/EC2AMAZ-SM2Q69S_db1_FULL_20241024_224526_05.bak', URL = N's3://sql-backups-ekins.s3.us-east-2.amazonaws.com/backups/EC2AMAZ-SM2Q69S/db1/FULL/EC2AMAZ-SM2Q69S_db1_FULL_20241024_224526_06.bak', URL = N's3://sql-backups-ekins.s3.us-east-2.amazonaws.com/backups/EC2AMAZ-SM2Q69S/db1/FULL/EC2AMAZ-SM2Q69S_db1_FULL_20241024_224526_07.bak', URL = N's3://sql-backups-ekins.s3.us-east-2.amazonaws.com/backups/EC2AMAZ-SM2Q69S/db1/FULL/EC2AMAZ-SM2Q69S_db1_FULL_20241024_224526_08.bak', URL = N's3://sql-backups-ekins.s3.us-east-2.amazonaws.com/backups/EC2AMAZ-SM2Q69S/db1/FULL/EC2AMAZ-SM2Q69S_db1_FULL_20241024_224526_09.bak', URL = N's3://sql-backups-ekins.s3.us-east-2.amazonaws.com/backups/EC2AMAZ-SM2Q69S/db1/FULL/EC2AMAZ-SM2Q69S_db1_FULL_20241024_224526_10.bak', URL = N's3://sql-backups-ekins.s3.us-east-2.amazonaws.com/backups/EC2AMAZ-SM2Q69S/db1/FULL/EC2AMAZ-SM2Q69S_db1_FULL_20241024_224526_11.bak', URL = N's3://sql-backups-ekins.s3.us-east-2.amazonaws.com/backups/EC2AMAZ-SM2Q69S/db1/FULL/EC2AMAZ-SM2Q69S_db1_FULL_20241024_224526_12.bak', URL = N's3://sql-backups-ekins.s3.us-east-2.amazonaws.com/backups/EC2AMAZ-SM2Q69S/db1/FULL/EC2AMAZ-SM2Q69S_db1_FULL_20241024_224526_13.bak', URL = N's3://sql-backups-ekins.s3.us-east-2.amazonaws.com/backups/EC2AMAZ-SM2Q69S/db1/FULL/EC2AMAZ-SM2Q69S_db1_FULL_20241024_224526_14.bak', URL = N's3://sql-backups-ekins.s3.us... Msg 3205, Level 16, State 1, Line 1 Too many backup devices specified for backup or restore; only 64 are allowed. Msg 3013, Level 16, State 1, Line 1 BACKUP DATABASE is terminating abnormally. Outcome: Failed Duration: 00:00:00 Date and time: 2024-10-24 22:45:26

Date and time: 2024-10-24 22:45:26

Completion time: 2024-10-24T22:45:26.6366797+00:00

olahallengren commented 3 weeks ago

Thank you for catching this issue. I have added a check for this in https://github.com/olahallengren/sql-server-maintenance-solution/pull/822

olahallengren commented 3 weeks ago

This fix has been released to main now.