If you get any of the errors listed below, follow the solution to fix the problem
Errors:
system.data.sqlclient.sqlerror:exclusive access could not be obtained because database is in use
Restore failed because “database is in use”
The tail of the log for the database has not been backed up
Solution:
ALTER DATABASE mydatabase
SET SINGLE_USER WITH ROLLBACK IMMEDIATE
Go
RESTORE DATABASE mydatabase
FROM DISK = ‘folder path’
WITH REPLACE
Go
ALTER DATABASE mydatabase
SET MULTI_USER with ROLLBACK IMMEDIATE
Go
Advertisements