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)
-
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.
From Robert Moir
0 comments:
Post a Comment