Backup Database with Mirror To fails with "Cannot open backup device 's3://my.domain.com/bucket/some-filder/db.bak'. Operating system error 5(Access is denied.)."

Stofer Stephan 1 Reputation point
2023-09-19T07:39:14.7266667+00:00

Using a containerised MSSQL Server 2022 we want to backup our database to URL for S3-compatible object storage and mirror the backup to the same bucket but different path. As soon we add the Mirror to URL option, the statement fails with "Cannot open backup device 's3://my.domain.com/bucket/some-filder/db-mirror.bak'. Operating system error 5(Access is denied.).". The mentioned Url is the one from the MIRROR TO URL option. The access rights on S3 are correct. We are able to back up to both destinations separately, when omitting the "MIRROR TO URL" option.

Our Statement:

BACKUP DATABASE $db_name TO URL = '$target' MIRROR TO URL = '$target_mirror' WITH FORMAT, COMPRESSION, STATS;

both targets points to same bucket but different paths.

the errorlog on /var/opt/mssql/log shows

2023-09-19 06:57:55.48 spid53 Error: 18204, Severity: 16, State: 1. 2023-09-19 06:57:55.48 spid53 BackupDiskFile::CreateMedia: Backup device 's3://my.domain.com/bucket/some-filder/db-mirror.bak' failed to create. Operating system error 5(Access is denied.). 2023-09-19 06:57:55.50 Backup Error: 3041, Severity: 16, State: 1. 2023-09-19 06:57:55.50 Backup BACKUP failed to complete the command BACKUP DATABASE DATABASE_NAME. Check the backup application log for detailed messages.

Any idea whats wrong? Where can I find the application log on the linux container?

SQL Server Other
{count} votes

2 answers

Sort by: Most helpful
  1. Olaf Helper 47,436 Reputation points
    2023-09-19T08:35:16.68+00:00

    Operating system error 5(Access is denied.).

    You get a clear error message: Access denied, the SQL Server service account don't have permission th write to the destination.


  2. ZoeHui-MSFT 41,491 Reputation points
    2023-09-20T06:00:40.7966667+00:00

    Hi @Stofer Stephan,

    both targets points to same bucket but different paths.

    BackupDiskFile::CreateMedia: Backup device 's3://my.domain.com/bucket/some-filder/db-mirror.bak' failed to create. Operating system error 5(Access is denied.).

    Please double check the account has full permission to access the device.

    Regards,

    Zoe Hui


    If the answer is helpful, please click "Accept Answer" and upvote it.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.