1 Answer
- Newest
- Most votes
- Most comments
0
The S3 URLs used in the T-SQL statements should start with s3://
instead of https://
to indicate the protocol in the URLs.
Looking at the examples in this Microsoft documentation article: 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, it seems you should first associate the AWS credentials with the S3 path containing the backups with a CREATE CREDENTIAL statement. Once that's done, simply specify the URL parameter, containing the s3://...
style URL, to the RESTORE statement. SQL Server should identify that credentials exist for the S3 URL and use them automatically to access the objects.
Relevant content
- asked 10 months ago
- asked a year ago
- AWS OFFICIALUpdated 4 months ago
I haven’t taken backup using url. I have uploaded the backups from my local file system to s3 bucket. Then, I created the credentials on target server and performed the restore. Regarding using the s3 instead of https, as per backup/restore syntax, backup path or url always starts with https.
The examples here: https://learn.microsoft.com/en-us/sql/relational-databases/backup-restore/sql-server-backup-to-url-s3-compatible-object-storage?view=sql-server-ver16#restore-from-url all use regular
s3://
URLs, which they should be also in a general S3 context. Where are you seeing URLs starting withhttps://
?I have tried with url s3:// and getting below error:
Msg 3201, Level 16, State 2, Line 1 Cannot open backup device 's3://Bucket_name/folder/file_name.bak'. Operating system error 12007(failed to retrieve text for this error. Reason: 15100). Msg 3013, Level 16, State 1, Line 1 VERIFY DATABASE is terminating abnormally.
Which version of SQL Server are you using?
SELECT @@VERSION
It is solved, actually my bucket name has region <west> within its name and my bucket is existing in west region. while running restore command, I was putting <east> in bucket region name as west. soi it was syntax issue. it worked now thanks.
bucket name: s3://abc-us-west-2-def.s3.us-west-2.amazonaws.com/backups
while running restore command I was using syntax like: s3://abc-us-east-2-def.s3.us-west-2.amazonaws.com/backups