Restore DB fails

I created two named instances on my machine
SYED
DEVDB

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: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.0.2531.0+((Katmai_PCU_Main).090329-1045+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Restore+Server&LinkId=20476------------------------------ADDITIONAL 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: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.0.2531.0+((Katmai_PCU_Main).090329-1045+)&LinkId=20476------------------------------BUTTONS:OK------------------------------ - 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 ..so 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
error1.PNG
LVL 1
misermiceAsked:
Who is Participating?
 
cyberkiwiCommented:
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!
0
 
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.
0
 
misermiceAuthor Commented:
Awesome
That was my exact problem
0
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.