I have a database that is called EIT-A02 restore and now I need to restore an additional database called EIT-A01, and when I try to restore it I get an error:

The file 'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\EIT-A02.mdf' cannot be overwritten. It is being used by database 'EIT-A02'.

I tried changing the name of database, changed the location of database on my pc but it didn't work. And it is only with this two databases, I tried restoring some other database called EIT-A05 and it worked without any problems. If anyone knows why this might happen, please help.

  • Did you also check that the "Restore As" filename is correct?
    – Kim
    Apr 22 at 8:09
  • I have been trying to fix this for like half and hour and I say pople saying to change the Restore as propetry, but I don't have that propetry while restoring database.
    – CofiShachou
    Apr 22 at 8:12
  • 1
    Can you show us the actual SQL you are running? Presumbly you are restoring the database with the NAME EIT-A01 but the files are still called EIT-A02.mdf, EIT-A02.ldf, etc.
    – Thom A
    Apr 22 at 8:24
  • Generate the restore command from SSMS and send us back the generated SQL code
    – Mickael
    Apr 22 at 14:17

2 Answers 2


During the restore process, you can use the WITH MOVE option. This allows you to specify new file locations for the restored database. In the RESTORE DATABASE statement with WITH MOVE the WITH MOVE clause acts like a single container for all the subsequent MOVE statements.


FROM DISK = N'<Path_to_backup_file>',
  'EIT_A01.mdf' TO N'<New_location_for_data_file>',
  'EIT_A01_log.ldf' TO N'<New_location_for_log_file>'

Choose the new locations for EIT_A01.mdf and EIT_A01_log.ldf carefully so that they don't overwrite existing files.


When you try to restore the existing file, go to options and click "close existing collection" which is under the server-connections option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.