Thursday, October 1, 2015

SQL Server 2012: Execution Error: Restore of database failed

Problem

From within SQL Server Management Studio (SSMS), you attempt to restore a SharePoint Server 2013 database, but then experience this error message:
TITLE: Microsoft SQL Server Management Studio ------------------------------
 Restore of database 'YOURDATABASE' failed. (Microsoft.SqlServer.Management.RelationalEngineTasks) ------------------------------
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 'D:\Program Files\Microsoft SQL Server\MSSQL11.CSSP\MSSQL\DATA\YOURDATABASE.mdf'. (Microsoft.SqlServer.SmoExtended) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=11.0.5058.0+((SQL11_PCU_Main).140514-1820+)&LinkId=20476
 This solution is simple.

Solution

  1. In SSMS, launch the Restore Database dialog, 
  2. Select Files, and then enable Relocate all files to folder.
    .
  3. Click OK.

References

1 comment:

sohan sunny said...

thanks a lot for saving my time