Skip to content

Commit 5a8c857

Browse files
Merge pull request #36797 from MicrosoftDocs/main
Auto Publish – main to live - 2026-03-06 23:30 UTC
2 parents 045b278 + 50ed9d5 commit 5a8c857

2 files changed

Lines changed: 81 additions & 54 deletions

File tree

Lines changed: 80 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
---
2-
title: "Back up to URL best practices & troubleshooting for S3-compatible object storage"
2+
title: "Back up to URL Best Practices & Troubleshooting for S3-Compatible Object Storage"
33
description: Learn about best practices and troubleshooting tips for SQL Server backup and restores to S3-compatible object storage.
44
author: MikeRayMSFT
55
ms.author: mikeray
6-
ms.date: 11/28/2023
6+
ms.date: 03/06/2026
77
ms.service: sql
88
ms.subservice: backup-restore
99
ms.topic: best-practice
10-
monikerRange: ">=sql-server-ver16||>=sql-server-linux-ver16"
10+
monikerRange: ">=sql-server-ver16 || >=sql-server-linux-ver16"
1111
---
1212
# SQL Server back up to URL for S3-compatible object storage best practices and troubleshooting
1313

1414
[!INCLUDE [SQL Server 2022](../../includes/applies-to-version/sqlserver2022.md)]
1515

16-
This article includes best practices and troubleshooting tips for SQL Server backup and restores to S3-compatible object storage.
16+
This article includes best practices and troubleshooting tips for SQL Server backup and restores to S3-compatible object storage.
1717

18-
For more information about using Azure Blob Storage for SQL Server backup or restore operations, see:
19-
20-
- [SQL Server backup and restore with S3-compatible object storage](sql-server-backup-and-restore-with-s3-compatible-object-storage.md)
21-
- [SQL Server backup to URL for S3-compatible object storage](sql-server-backup-to-url-s3-compatible-object-storage.md)
18+
For more information about using Azure Blob Storage for SQL Server backup or restore operations, see:
2219

23-
## Troubleshooting and common error causes
20+
- [Back up and restore SQL Server with S3-compatible object storage](sql-server-backup-and-restore-with-s3-compatible-object-storage.md)
21+
- [SQL Server back up to URL for S3-compatible object storage](sql-server-backup-to-url-s3-compatible-object-storage.md)
22+
23+
<a id="troubleshooting-and-common-error-causes"></a>
2424

2525
Following are some quick ways to troubleshoot errors when backing up to or restoring from the S3-compatible object storage. To avoid errors due to unsupported options or limitations, see [SQL Backup and Restore with S3-compatible object storage](sql-server-backup-to-url-s3-compatible-object-storage.md#limitations).
2626

27-
### Ensure a correctly formed URL
27+
## Ensure a correctly formed URL
2828

2929
Here's an example of a virtual host URL formed correctly when issuing a T-SQL backup query such as follows:
3030

3131
```sql
3232
BACKUP DATABASE AdventureWorks2022
33-
TO URL = 's3://<bucketName>.<virtualHost>/<pathToBackup>/<backupFileName>'
33+
TO URL = 's3://<bucketName>.<virtualHost>/<pathToBackup>/<backupFileName>'
3434
```
3535

3636
Or for URL path style:
@@ -43,43 +43,70 @@ TO URL = 's3://<domainName>/<bucketName>/<pathToBackup>/<backupFileName>';
4343
Review in the URL:
4444

4545
1. The URL starts with `s3://` scheme.
46-
1. 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.
47-
1. `<bucketName>` is the name of this bucket where the backup is written. This must be created before running the backup T-SQL. The backup T-SQL doesn't create the bucket for the customer. For example, if the user doesn't create the bucket 'nonExistingBucket' beforehand and runs a T-SQL statement as follows:
48-
49-
```sql
50-
BACKUP DATABASE AdventureWorks2022
51-
TO URL = 's3://<your-endpoint>/nonExistingBucket/AdventureWorks2022.bak';
52-
```
53-
54-
A URL that is not correctly formed may return the following:
55-
56-
```
57-
Msg 3201, Level 16, State 1, Line 50
58-
Cannot open backup device 's3://<your-endpoint>/nonExistingBucket/AdventureWorks2022.bak'. Operating system error 50(The request is not supported.).
59-
Msg 3013, Level 16, State 1, Line 50
60-
BACKUP DATABASE is terminating abnormally.
61-
```
62-
63-
1. The `<pathToBackup>` need not exist before running the backup T-SQL. It is created in the storage server automatically. For example, if the user creates the bucket 'existingBucket' beforehand and not the path `'existingBucket/sqlbackups'`, the following will still run successfully:
46+
1. The S3 storage virtual host `<virtualHost>` or server domain `<domainName>` exists and is running using HTTPS. A CA installed on the SQL Server OS host validates the endpoint.
47+
1. `<bucketName>` is the name of the bucket where the backup is written. The bucket must be created before you run the backup T-SQL statement. The backup T-SQL doesn't create the bucket. For example, if you don't create the bucket 'nonExistingBucket' beforehand and run a T-SQL statement as follows:
48+
49+
```sql
50+
BACKUP DATABASE AdventureWorks2022
51+
TO URL = 's3://<your-endpoint>/nonExistingBucket/AdventureWorks2022.bak';
52+
```
53+
54+
A URL that isn't correctly formed might return the following error:
55+
56+
```
57+
Msg 3201, Level 16, State 1, Line 50
58+
Cannot open backup device 's3://<your-endpoint>/nonExistingBucket/AdventureWorks2022.bak'. Operating system error 50(The request is not supported.).
59+
Msg 3013, Level 16, State 1, Line 50
60+
BACKUP DATABASE is terminating abnormally.
61+
```
62+
63+
1. The `<pathToBackup>` doesn't need to exist before you run the backup T-SQL. The storage server creates the path automatically. For example, if you create the bucket 'existingBucket' beforehand but not the path `'existingBucket/sqlbackups'`, the following command still runs successfully:
6464

6565
```sql
6666
BACKUP DATABASE AdventureWorks2022
6767
TO URL = 's3://<your-endpoint>/existingBucket/sqlbackups/AdventureWorks2022.bak';
6868
```
6969

70-
### Create a server-level credential prior to running backup/restore
70+
## Create a server-level credential before running backup/restore
71+
72+
Before running BACKUP or RESTORE Transact-SQL commands against S3-compatible object storage, you must create a server-level credential containing the Access Key ID and Secret Key ID that your S3 storage provider requires. There are two ways to name the credential:
73+
74+
- **[Set a credential name](#set-a-credential-name)**: Choose any name you want, but you must explicitly specify the `CREDENTIAL` parameter in each BACKUP/RESTORE statement.
75+
- **[Use the S3 URL path as the credential name](#use-the-s3-url-path-as-the-credential-name)**: Name the credential with the S3 URL path, and SQL Server automatically matches the credential to the backup URL without requiring the `CREDENTIAL` parameter.
76+
77+
### Set a credential name
78+
79+
Choose any credential name, as long as the Access Key ID and Secret Key ID grant access to the S3 backup URL. When you use a credential with an arbitrary name, you must explicitly reference it in the BACKUP/RESTORE statement by adding the `CREDENTIAL` parameter.
80+
81+
The following example creates a credential with an arbitrary name:
82+
83+
```sql
84+
CREATE CREDENTIAL [myOwnCredential]
85+
WITH IDENTITY = 'S3 Access Key',
86+
SECRET = '<AccessKeyID>:<SecretKeyID>';
87+
```
88+
89+
The following example backs up a database using the credential:
90+
91+
```sql
92+
BACKUP DATABASE [Test]
93+
TO URL = 's3://<your-endpoint>/myS3Bucket/sqlbackups/AdventureWorks2022.bak'
94+
WITH COMPRESSION, NOFORMAT, NAME = N'FULL bkp', MAXTRANSFERSIZE = 20971520, CREDENTIAL = N'myOwnCredential'
95+
```
96+
97+
### Use the S3 URL path as the credential name
7198

72-
Before running backup/restore Transact-SQL queries to S3-compatible storage, you must create a server level credential. This credential needs to contain the Access key and Secret Key set up by customers on their S3-compatible object storage server prior to issuing backup/restore queries.
99+
Name the credential using the S3 URL path. With this approach, SQL Server automatically performs credential lookup, and you don't need to specify the `CREDENTIAL` parameter in the BACKUP/RESTORE statement. SQL Server attempts to find the most specific matching credential based on the URL.
73100

74-
An example of a credential that needs to be created for URL: `s3://<your-endpoint>/myS3Bucket/sqlbackups/AdventureWorks2022.bak` would be the following:
101+
The following example creates a credential for the URL `s3://<your-endpoint>/myS3Bucket/sqlbackups/AdventureWorks2022.bak`:
75102

76103
```sql
77104
CREATE CREDENTIAL [s3://<your-endpoint>/myS3Bucket/sqlbackups/AdventureWorks2022.bak]
78105
WITH IDENTITY = 'S3 Access Key',
79106
SECRET = '<AccessKeyID>:<SecretKeyID>';
80107
```
81108

82-
In this statement `<AccessKeyID>` is not allowed to contain a `:` character. If the credential is not created prior to running the backup/restore query, the user will see the following error message:
109+
In this statement, `<AccessKeyID>` can't contain a `:` character. If the credential isn't created before you run the backup/restore query, SQL Server returns the following error message:
83110

84111
```
85112
Msg 3201, Level 16, State 1, Line 50
@@ -88,19 +115,19 @@ Msg 3013, Level 16, State 1, Line 50
88115
BACKUP DATABASE is terminating abnormally.
89116
```
90117

91-
The name of the credential is not required to match the exact URL path. Here is an example how credential lookup will work. If we need to query path `s3://10.193.16.183:9000/myS3Bucket/sqlbackups/AdventureWorks2022.bak`, the following credential names are tried:
118+
The credential name doesn't need to match the exact URL path. The following example shows how credential lookup works. If you need to query path `s3://10.193.16.183:9000/myS3Bucket/sqlbackups/AdventureWorks2022.bak`, SQL Server tries the following credential names:
92119

93120
1. `s3://10.193.16.183:8787/myS3Bucket/sqlbackups/AdventureWorks2022.bak`
94121
1. `s3://10.193.16.183:8787/myS3Bucket/sqlbackups`
95122
1. `s3://10.193.16.183:8787/myS3Bucket`
96123

97-
If there are multiple credentials matching search, such as more specific `s3://10.193.16.183:8787/myS3Bucket/sqlbackups` and more generic `s3://10.193.16.183:8787/myS3Bucket`, choose the most specific one. This allows you to set up more granular access control at directory level for what folders may be accessed from SQL Server.
124+
If multiple credentials match the search, such as the more specific `s3://10.193.16.183:8787/myS3Bucket/sqlbackups` and the more generic `s3://10.193.16.183:8787/myS3Bucket`, SQL Server chooses the most specific one. This behavior lets you set up granular access control at the directory level for which folders can be accessed from SQL Server.
98125

99-
### Unsupported option FILE_SNAPSHOT
126+
## Unsupported option FILE_SNAPSHOT
100127

101-
Currently, the BACKUP TSQL option FILE_SNAPSHOT is not supported for S3-compatible object storage. This is an Azure Blob Storage-specific option.
128+
Currently, the BACKUP Transact-SQL option FILE_SNAPSHOT isn't supported for S3-compatible object storage. FILE_SNAPSHOT is an Azure Blob Storage-specific option.
102129

103-
If the user runs the following Transact-SQL for example:
130+
If you run the following Transact-SQL example:
104131

105132
```sql
106133
BACKUP DATABASE AdventureWorks2022
@@ -117,9 +144,9 @@ Msg 3013, Level 16, State 1, Line 62
117144
BACKUP DATABASE is terminating abnormally.
118145
```
119146

120-
### Backup stripe exceeding 100 GB
147+
## Backup stripe exceeding 100 GB
121148

122-
Currently, the size of a single backup file created by customers in S3-compatible object storage during a backup cannot exceed 100 GB per file, using default `MAXTRANSFERSIZE`. If the backup stripe goes beyond 100 GB, the backup T-SQL syntax statement throws the following error message:
149+
Currently, the size of a single backup file created by customers in S3-compatible object storage during a backup can't exceed 100 GB per file, using default `MAXTRANSFERSIZE`. If the backup stripe goes beyond 100 GB, the backup T-SQL syntax statement throws the following error message:
123150

124151
```
125152
Msg 3202, Level 16, State 1, Line 161
@@ -144,17 +171,17 @@ TO URL = 's3://<your-endpoint>/myS3Bucket/sqlbackups/AdventureWorks2022.bak'
144171
WITH COMPRESSION;
145172
```
146173

147-
### Maximum length of URL
174+
## Maximum length of URL
148175

149-
The total URL length is limited to 259 bytes by the Backup and Restore engine. This means that `s3://hostname/objectkey` shouldn't exceed 259 characters. Leaving aside `s3://` the user can input the path length (hostname + object key) to be 259 5 = 254 characters. Refer to [SQL Server Backup to URL - SQL Server](sql-server-backup-to-url.md). The backup T-SQL syntax statement throws the following error message:
176+
The total URL length is limited to 259 bytes by the Backup and Restore engine. This limit means that `s3://hostname/objectkey` shouldn't exceed 259 characters. Leaving aside `s3://` the user can input the path length (hostname + object key) to be 259 - 5 = 254 characters. Refer to [SQL Server backup to URL for Azure Blob Storage](sql-server-backup-to-url.md). The backup T-SQL syntax statement throws the following error message:
150177

151178
```
152179
SQL Server has a maximum limit of 259 characters for a backup device name. The BACKUP TO URL consumes 36 characters for the required elements used to specify the URL - 'https://.blob.core.windows.net//.bak', leaving 223 characters for account, container, and blob names put together'
153180
```
154181

155-
### Clock-skew correction
182+
## Clock-skew correction
156183

157-
The S3 storage might reject connection, giving a "InvalidSignatureException" error back to SQL Server whenever the time difference between SQL Host and S3 server is bigger than 15 minutes. On SQL Server it shows as:
184+
The S3 storage might reject connection, giving a "InvalidSignatureException" error back to SQL Server whenever the time difference between SQL Host and S3 server is bigger than 15 minutes. On SQL Server, the error appears as:
158185

159186
```
160187
Msg 3201, Level 16, State 1, Line 28
@@ -163,9 +190,9 @@ Msg 3013, Level 16, State 1, Line 28
163190
BACKUP DATABASE is terminating abnormally.
164191
```
165192

166-
### SQL Server on Linux support
193+
## SQL Server on Linux support
167194

168-
SQL Server uses `WinHttp` to implement client of HTTP REST APIs it uses. It relies on OS certificate store for validations of the TLS certificates presented by the HTTP(s) endpoint. However, SQL Server on Linux delegates the certificate validation to SQLPAL, which validates the endpoints' HTTPS certificates with the certificate shipped with PAL. Thus, customer-provided self-signed certificates cannot be used on Linux for HTTPS validation.
195+
SQL Server uses `WinHttp` to implement the client of HTTP REST APIs it uses. SQL Server relies on the OS certificate store for validation of the TLS certificates presented by the HTTPS endpoint. However, SQL Server on Linux delegates the certificate validation to SQLPAL, which validates the endpoints' HTTPS certificates with the certificate shipped with PAL. As a result, customer-provided self-signed certificates can't be used on Linux for HTTPS validation.
169196

170197
During backup/restore the customer gets the following error message on Linux:
171198

@@ -178,16 +205,16 @@ BACKUP DATABASE is terminating abnormally.
178205

179206
To get past this problem, the following predefined location must be created: `/var/opt/mssql/security/ca-certificates`. Place self-signed certificates, or certificates not shipped with PAL in this location. SQL Server reads the certificates from the folder during startup and adds them to the PAL trust store.
180207

181-
Up to 50 files can be stored in this location, if the folder is not created, when SQL Server is started, the SQL Server error log will show:
208+
Up to 50 files can be stored in this location. If the folder doesn't exist when SQL Server starts, the SQL Server error log shows:
182209

183210
```
184211
2022-02-05 00:32:10.86 Server Installing Client TLS certificates to the store.
185212
2022-02-05 00:32:10.88 Server Error searching first file in /var/opt/mssql/security/ca-certificates: 3(The system cannot find the path specified.)
186213
```
187214

188-
### Object Lock - delete retention is not supported
215+
## Object Lock - delete retention isn't supported
189216

190-
The SQL Server backup to S3-compatible object storage feature does not support Object Lock, also called the Delete Retention feature. Object Lock prevents files from being deleted or overwritten for the duration of its retention period.
217+
The SQL Server backup to S3-compatible object storage feature doesn't support Object Lock, also called the Delete Retention feature. Object Lock prevents files from being deleted or overwritten during the retention period.
191218

192219
The bucket and folder location targeted by your backup operation must not have Object Lock enabled. If this feature is enabled and configured in your S3-compatible object storage, the backup operation fails with the following message:
193220

@@ -200,7 +227,7 @@ BACKUP DATABASE is terminating abnormally.
200227

201228
## Related content
202229

203-
- [SQL Server backup and restore with S3-compatible object storage](sql-server-backup-and-restore-with-s3-compatible-object-storage.md)
204-
- [SQL Server backup to URL for S3-compatible object storage](sql-server-backup-to-url-s3-compatible-object-storage.md)
205-
- [BACKUP (Transact-SQL)](../../t-sql/statements/backup-transact-sql.md)
206-
- [RESTORE (Transact-SQL)](../../t-sql/statements/restore-statements-transact-sql.md)
230+
- [Back up and restore SQL Server with S3-compatible object storage](sql-server-backup-and-restore-with-s3-compatible-object-storage.md)
231+
- [SQL Server back up to URL for S3-compatible object storage](sql-server-backup-to-url-s3-compatible-object-storage.md)
232+
- [BACKUP (Transact-SQL)](../../t-sql/statements/backup-transact-sql.md)
233+
- [RESTORE Statements (Transact-SQL)](../../t-sql/statements/restore-statements-transact-sql.md)

docs/t-sql/statements/backup-transact-sql.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ Specifies options to be used with a backup operation.
376376

377377
**Applies to:** [!INCLUDE [ssnoversion-md](../../includes/ssnoversion-md.md)].
378378

379-
Used only when creating a backup to Azure Blob Storage.
379+
Used only when creating a backup to Azure Blob Storage or S3-compatible object storage.
380380

381381
#### FILE_SNAPSHOT
382382

0 commit comments

Comments
 (0)