Search code examples
sql-serverdatabaseamazon-web-servicesamazon-rdssqlcmd

AWS RDS SQL Server RESTORE ISSUE


I created SQL Server res instance on AWS. I want to restore the database from a .bak file. I performed below steps in order to restore:

sqlcmd -S XXX.rds.amazonaws.com -U root -P XXXX

USE master
go

create database xyzzy

RESTORE DATABASE xyzzy 
FROM DISK = N'C:\Users\Administrator\Downloads\FMAT_CPS_backup_2017_09_29_040005_9422965.bak'
go

but I got this error

Msg 3110, Level 14, State 1, Server EC2AMAZ-BUJEKP3, Line 1
User does not have permission to RESTORE database 'catalyst'.

Msg 3013, Level 16, State 1, Server EC2AMAZ-BUJEKP3, Line 1
RESTORE DATABASE is terminating abnormally.

When I tried this command

C:\Users\Administrator>sqlcmd -e -S xxxxrds.amazonaws.com -U root -P xxxx -i "C:\Users\Administrator\Downloads\FMAT_CPS_backup_2017_09_29_040005_9422965.bak"

I got another error:

Sqlcmd: Error: Syntax error at line 224 near command 'S' in file 'C:\Users\Administrator\Downloads\FMAT_CPS_backup_2017_09_29_040005_9422965.bak'.

The .bak file is of 25GB size, I'm not able to open it.

How to resolve these errors?


Solution

  • You might have in-sufficient Permission do you proper IAM Credentials.

    Alternatively

    You can upload the file to S3 and Restore to RDS