I'm looking at https://learn.microsoft.com/en-us/sql/relational-databases/backup-restore/sql-server-backup-to-url-s3-compatible-object-storage?view=sql-server-ver16#examples and it seems to me that you need to specify an endpoint and port before the bucket.
SQL SERVER Backup to S3 bucket fail: "Msg 3078, Level 16, State 1, Line 21 The file name "s3://mybucket/foder" is invalid as a backup device name for the specified device type."
We have created a role in AWS to store the backups in a bucket, we have checked its correct operation using the "aws s3 cp" command and it works fine. But when we launch the backup we get this error:
CREATE CREDENTIAL [s3://MyBucket/] WITH IDENTITY = 'S3 Access Key' ,SECRET = 'AKIAT----------:KrA4ky0ADqNFtaWDOKh/Wq-------'; BACKUP DATABASE [My_database] TO URL = 's3://MyBucket/database.bak' WITH COMPRESSION, STATS = 10, FORMAT, INIT;
Msg 3078, Level 16, State 1, Line 10 The file name "s3://MyBucket/database.bak" is invalid as a backup device name for the specified device type. Reissue the BACKUP statement with a valid file name and device type.
Msg 3013, Level 16, State 1, Line 10 BACKUP DATABASE is terminating abnormally.
2 additional answers
Sort by: Most helpful
-
LiHongMSFT-4306 26,791 Reputation points
2024-02-27T02:23:23.4966667+00:00 The file name "s3://MyBucket/database.bak" is invalid as a backup device name for the specified device type. Reissue the BACKUP statement with a valid file name and device type.
The S3 storage virtual host
<virtualHost>
or server domain<domainName>
exists and is running using HTTPS. The endpoint will be validated by a CA installed on the SQL Server OS Host.<bucketName>
is the name of this bucket where the backup is written. This must be created before running the backup T-SQL.Refer to this doc: SQL Server back up to URL for S3-compatible object storage best practices and troubleshooting.
Best regards,
Cosmog Hong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
-
Mariano Facundo Podesta 20 Reputation points
2024-02-27T13:56:30.3633333+00:00 Hello everyone, thanks for the help. I think we have found the problem and it is the version of my database, currently my version is:
Microsoft SQL Server 2019 (RTM-CU22) (KB5027702) - 15.0.4322.2 (X64) Jul 27 2023 18:11:00 Copyright (C) 2019 Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2019 Datacenter 10.0 <X64> (Build 17763: ) (Hypervisor)
Reviewing the links that they sent me I could see that the compatibility with S3 URL is from version 16.X, therefore I must migrate the version as a first task. Thanks for your help.