When we restore or delete the Windows Server 2008 R2 database, we often encounter errors such as not being able to obtain exclusive access to the database because the database is in use. This is very troublesome. Today, I will teach you an ultimate solution.
Just create a new query and execute the following code inside:
Copy the codeThe code is as follows:
ALTER DATABASE Your database name SET OFFLINE WITH ROLLBACK IMMEDIATE
ALTER DATABASE Your database name SET OnLINE