Restore DB fails

I created two named instances on my machine

Backed up AdventureWorks to C:Backup/bkp1

tried to restore onto DEVDB ????

It fails.. it says

 TITLE: Microsoft SQL Server Management Studio------------------------------Restore failed for Server 'ZAFAR-PC\DEVDB'. (Microsoft.SqlServer.SmoExtended)For help, click: INFORMATION:System.Data.SqlClient.SqlError: The operating system returned the error '32(The process cannot access the file because it is being used by another process.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER2\MSSQL\DATA\AdventureWorks.mdf'. (Microsoft.SqlServer.Smo)For help, click: - did not match any documents.

After several tries I tried the following

1. Disconnected the first Instance completely... NO USE
2. Restarted SSMS............................................. NO USE

just now while I am typing this question in EE i tried again..
very carelessly i gave DB name as 1234

...and it worked..

So When i restore DB on to another Instance do i have to change the DB name ?

My SS Config Manager Screen shot is attached

Please Help
Who is Participating?
You need to go to the next tab in the restore wizard and change the location for the .mdf and .ldf files.
Basically when you backup a file, it remembers where the original .mdf and .ldf files are.
So when you backup from IST1 to IST2, it is still trying to restore the .mdf file from the backup to the old location - therefore clashing the the existing file from the other instance!
Raja Jegan RSQL Server DBA & ArchitectCommented:
>> So When i restore DB on to another Instance do i have to change the DB name ?

Seems like you tried to restore it in the same instance where you took the backup from and hence it would have failed..
Changing DB Name is required if any database is already present with that name.
misermiceAuthor Commented:
That was my exact problem
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.