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.'
phaniverma.dba
Valued Member
Points: 74
More actions
April 5, 2011 at 3:08 pm
#1307737
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'