How to fix “The database is in single-user mode, and a user is currently connected to it.”
Recently, when I running the buildscript for a SharePoint. I get the following error message:
[exec] Remove-SPSite : Cannot open database “WSS_Content_YBBEST_AAA_2013′ requested by the login. The login failed.
[exec] Login failed for user ‘YBBEST\administrator’.
Then I went to the SQL Management studio, the database is in Single user mode, not sure how it ends up in that state. When I try to delete the database then I got the following errors:
Changes to the state or options of database ‘WSS_Content_YBBEST_AAA_2013′ cannot be made at this time. The database is in single-user mode, and a user is currently connected to it.
Guess, how to fix the issue?
Restart your SQL Server to fix the problem.
You can restart SQL Server by right click the server in your Management studio and choose restart.