Database restoration error
While Restoring a SQL Backup from SQL Server Management Studio sometime we get an error as shown below –
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\SQL\Databases\\TestDB_2012_10.mdf’. (Microsoft.SqlServer.Smo)
Cause of Error
we typed the name incorrectly during the file name creation in Restore Operation.
Check out the file name in Option tab of Restore Database window.
You would have put two \\ instead of one while specifying the path where file should get created.
Below is the image of what i did –