When I try to restore my database with
RESTORE DATABASE MyDatabase
FROM DISK = '\path\to\my\backup.bak'
WITH REPLACE, RECOVERY
It says
Exclusive access could not be obtained because the database is in use.
After some googling I tried this instead:
ALTER DATABASE MyDatabase SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
RESTORE DATABASE MyDatabase
FROM DISK = '\path\to\my\backup.bak'
WITH REPLACE, RECOVERY
GO
However, this seemed to take forever and when I eventually cancelled the command it told me that
Nonqualified transactions are being rolled back. Estimated rollback completion: 0%.
The message repeated multiple times and the progress was always 0%.
I'm not a DBA --sadly my company does not employ any-- and I have no clue where to go from here.