Exclusive access could not be obtained because the database is in use.
Posted on 2006-06-06
[SQLSTATE 01000] (Message 3014) Exclusive access could not be obtained because the database is in use. [SQLSTATE 42000] (Error 3101) RESTORE DATABASE is terminating abnormally. [SQLSTATE 42000] (Error 3013). The step failed.
How can I fix this.
During restore process I would like the restore SQL script to have complete access but after the restore script is ran it should be no more exclusive use.
I have restore script in my schedulled task, which runs nightly. Most of the time there are no users but if there are, I want them not to have access and restore process should have access.
Please help me with TSQL.