Restore SQL Server from S3 (support)
Use this page when you need to restore a database from an S3 backup (.bak) and recover/unblock work.
Restore from S3
Section titled “Restore from S3”Verify what’s inside the backup (and whether MOVE is needed)
Section titled “Verify what’s inside the backup (and whether MOVE is needed)”restore headeronly
from url = 's3://s3.coragem.app/<bucket-name>/SERVER-DB-20250630-124000-utc.bak';
restore filelistonly
from url = 's3://s3.coragem.app/<bucket-name>/SERVER-DB-20250630-124000-utc.bak';Use WITH MOVE when:
- you restore under a different database name
- you restore to a different file location than the original
PhysicalName - the original file paths would conflict with existing files on the target host
Restore (no MOVE)
Section titled “Restore (no MOVE)”declare @bucket_url nvarchar(255) = N's3://s3.coragem.app/<bucket-name>';
if db_id(N'<db_name>') is not null
begin
alter database [<db_name>] set single_user with rollback immediate;
end;
restore database [<db_name>]
from url = @bucket_url + N'/SERVER-DB-20250630-124000-utc.bak'
with replace
, recovery
, stats = 10;
alter database [<db_name>] set multi_user;Restore with MOVE (different database name and/or file location)
Section titled “Restore with MOVE (different database name and/or file location)”if db_id(N'<target_db_name>') is not null
begin
alter database [<target_db_name>] set single_user with rollback immediate;
end;
restore database [<target_db_name>]
from url = 's3://s3.coragem.app/<bucket-name>/SERVER-DB-20250630-124000-utc.bak'
with
move '<logical_data_name>' to '<path_to_data_file>.mdf'
, move '<logical_log_name>' to '<path_to_log_file>.ldf'
, replace
, recovery
, stats = 10;
alter database [<target_db_name>]
set multi_user;Restoring striped (“part X of Y”) backups
Section titled “Restoring striped (“part X of Y”) backups”restore database [<db_name>]
from
url = 's3://s3.coragem.app/<bucket-name>/SERVER-DB-20250630-124000-1-of-3-utc.bak',
url = 's3://s3.coragem.app/<bucket-name>/SERVER-DB-20250630-124000-2-of-3-utc.bak',
url = 's3://s3.coragem.app/<bucket-name>/SERVER-DB-20250630-124000-3-of-3-utc.bak'
with
replace,
recovery,
stats = 10;Failure modes
Section titled “Failure modes”Access is denied/ auth errors: credential missing/wrong for thes3://...URL you used.- Connectivity: SQL host cannot reach the S3 endpoint (DNS/VPN/routing).
- Restore fails with file path errors: run
restore filelistonlyand usewith move. - Striped backups: restore must reference all
URL = ...parts.