Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I created a backup file from one instance and I was going to restore the file in a new Instance, which is SQL server R2. And It didn't work, I got this error.

This is the error I am getting when I try to back up a database:

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.MSSQLSERVER\MSSQL\DATA\dboff.mdf'. (Microsoft.SqlServer.Smo)
share|improve this question
    
You get the error when you perform the backup or when you are restoring? If when restoring, how are you trying to restore it? –  Robert Kaucher Oct 7 '10 at 18:09
2  
Your question doesn't make sense. You start off saying that you already created the backup, but are now trying to restore. Then you say you are trying to backup, then you post an error message about restoring an .mdf. You restore .bak files, not .mdf –  DanBig Oct 7 '10 at 18:11
add comment

1 Answer

Are you getting this while you're backing up the file or while restoring it - as others have said you may need to clarify that. Assuming you mean that you get this error during a restore

If you're running multiple instances of SQL and restoring a backup from one instance into a second instance, then are you editing the path the database is restored to?

Because by default SQL's restore will try to put the database files back where they were on the hard disk, which of course currently contains a file that's still in use by the original instance.

You can check and edit this as part of the properties of the restore in the gui, or just specify the correct restore path in a T-SQL command sequence if you're doing it that way.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.