Sql – Set database from SINGLE USER mode to MULTI USER

sqlsql server

I need help with setting a database that was restored in SINGLE_USER mode to MULTI_USER. Every time I run

ALTER DATABASE BARDABARD
SET MULTI_USER;
GO

I get this error:

Changes to the state or options of database 'BARDABARD' cannot be made at this time.

The database is in single-user mode, and a user is currently connected to it.

It needs to be in non-SINGLE_USER mode to set it to another mode, but I can’t set the database in any another mode while it is SINGLE_USER mode.

Best Answer

The “user is currently connected to it” might be SQL Server Management Studio window itself. Try selecting the master database and running the ALTER query again.