I backup a database using SQL Server Management Studio v17.9.1 and then I try to restore the backup but it fails with the following message.

Thank you very much for helping.

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\MSSQL14.SQLEXPRESS\MSSQL\DATA\DbName.mdf'. (Microsoft.SqlServer.SmoExtended)

  • Have you used a utility to determine what other process is using the file? – Christopher Hostage Aug 27 at 21:11
  • Nothing is using the backup file DbName.bak. I don't think the problem is about that. Thanks. – GAksut Aug 28 at 10:11
  • Are you trying to restore the database to the same server where the original database is still online or to a new server? Are you restoring using the restore wizard or a restore script? – Ronaldo Aug 28 at 12:28
  • Same server. I am just doing a backup and then I am trying to restore it for testing to see if it works. Thanks – GAksut Aug 28 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.