Same file_guids on the instance

Trying to restore an Amazon Web Services (AWS) RDS instance, I encountered the following error:

Aborted the task because of a task failure or a concurrent RESTORE_DB request.
Task ID x (RESTORE_DB) exception: Database <<NAME_OF_DB>> cannot be restored because there is already an existing database with the same file_guids on the instance.

I read this article and I found the steps to solve the issue.

1 – First I created a new RDS instance, trying to have the same version of the engine, security group (not sure if it matters) and same option group, with SQLSERVER_BACKUP_RESTORE option. The parameters that you need are the database administrator username, password and endpoint.

2 – On the EC2 server, in Microsoft SQL Server Management Studio, I defined the connection to the server using the endpoint, username and password kept from the first step.

3 – After connecting to the server, I opened a Query window and ran:

exec msdb.dbo.rds_restore_database
@restore_db_name='<<NAME_OF_DB>>', 
@s3_arn_to_restore_from='arn:aws:s3:::<<S3 bucket/S3 path>>';

4 – In a separate or same Query window you may try to retrieve the status with the command:

exec msdb.dbo.rds_task_status;

5 – From AWS Console, create a new EC2 Instance with Microsoft SQL included. I choose: Microsoft Windows Server 2012 R2 with SQL Server 2016 Web on a

t2.small
6 – I logged in to the EC2 Instance via Remote Desktop Connection and started Microsoft SQL Management Studio.
7 – I connected to the localhost. Here I encountered some problems like “A network-related or instance-specific error occurred while establishing a connection to SQL Server. “, which I solved from SQL Server Configuration Manager.
8 – Here an empty DB is needed. I right-clicked on Databases in the tree and click on “Create Database”
The error that I got was: “Cannot show requested dialog”
I created the database using the Command:
USE master ; 
GO 
CREATE DATABASE BAS 
ON 
( NAME = Sales_dat, 
FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\bas.mdf', 
SIZE = 10, 
MAXSIZE = 50, 
FILEGROWTH = 5 ) 
LOG ON 
( NAME = Sales_log, 
FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\bas.ldf', 
SIZE = 5MB, 
MAXSIZE = 25MB, 
FILEGROWTH = 5MB ) ; 
GO

9 – So, here I started the “Microsoft SQL Import and Export Wizard (64bit)”
10 – I choose as the source DB the one that exists on RDS, and the target DB the local one just created in step 8.

Unfortunately the import/export did not worked until the end…

 

 

Related Posts