Home Forums SQL Server 2005 Administering Restore Database Failed: 'Exclusive access could not be obtained because the database is in use.' RE: Restore Database Failed: 'Exclusive access could not be obtained because the database is in use.'

  • Hi Sourav Mukherjee,

    You can use the below command.

    ALTER DATABASE [mydb] SET SINGLE_USER WITH ROLLBACK IMMEDIATE

    GO

    RESTORE DATABASE [mydb] FROM DISK='f:\backup\mydb.bak'

    GO