He backup set holds a backup of a database other than the existing - what should I do?

637    Asked by alexDuncan in SQL Server , Asked on Oct 4, 2022

I'm trying to restore my production .bak file to a new local instance using the belowscript but I still get this error:


The backup set holds a backup of a database other than the existing MyDatabase database.


I'm using SQL Server 2019.


USE [master]
RESTORE DATABASE [MyDatabase]
  FROM DISK = 'C:MyDatabase.bak'
  WITH 
  MOVE 'MyDatabase' TO 'C:MyDatabase.mdf',
  MOVE 'MyDatabase_log' TO 'C:MyDatabase_log.ldf',
  REPLACE
GO


Answered by Amanda Hawes

Your Answer

Interviews

Parent Categories