database restore failing with move
When restoring, you need to be sure to
- pick a new database name that doesn't already exist (unless you want to overwrite that pre-existing database)
- you tick the
Overwrite
option in theOptions
tab page and define valid and new file names for the.mdf
and.ldf
file so that you don't accidentally overwrite another database on your system:
This post has some excellent answers but I don't believe my solution was covered here, or I didn't understand the answer/comment.
However, when I encountered this error I was restoring a database with 2 indexes (Primary and Index). The issue was that when restoring it had created two .ndf files, one for each index, but had named them the same thing.
So essentially I had two "Restore As" files restoring to "D:\MSSQLDATA\DatabaseName.ndf.
To overcome this I had to change one of the file names, so for example I changed
Index | D:\MSSQLDATA\DatabaseName.ndf
Primary | D:\MSSQLDATA\DatabaseName1.ndf
having unique file names fixed this for me.