SQL Server Error 1488: Database in Single User Mode
In this article
Error 1488 means the database you are trying to open is set to single-user mode and another connection already holds that one slot. To fix it, connect as the sole user, switch the database back to multi-user mode with ALTER DATABASE ... SET MULTI_USER, and clear any leftover connections. You need a login with ALTER permission on the database (db_owner or sysadmin) and, ideally, the ability to restart SQL Server if a stale connection refuses to release the database.
What You'll Need
- SQL Server Management Studio (SSMS) or Azure Data Studio, or the
sqlcmdcommand-line tool. - A login that is a member of the
sysadminfixed server role or hasALTERpermission on the affected database. - The exact database name from the error message (for example,
SalesDB). - Permission to restart the SQL Server service if a connection will not close (Windows service console or
net stop/net start). - Optional: a maintenance window if users are connected, because switching modes disconnects them.
Step-by-Step
- Identify the database and current state. In SSMS, connect to the instance, open a new query window, and run:
SELECT name, user_access_desc FROM sys.databases WHERE name = 'YourDB';
Theuser_access_desccolumn should readSINGLE_USER. If it readsMULTI_USER, the error is coming from a different database or a stale connection; check the exact name in the error text. Menu labels can differ slightly by SSMS version, but the query is the same everywhere. - Find who holds the single-user connection. Run:
EXEC sp_who2;
Look for thedbidmatching your database (useDB_ID('YourDB')to get it) and note theSPID. Alternatively, querysys.dm_exec_sessionsjoined tosys.dm_exec_requestsand filter bydatabase_id. If the SPID belongs to your own SSMS window, that is often the culprit: close the Object Explorer connection to that database before continuing. - Take the single slot deliberately. Open a query window connected to
master(not to the affected database) and run:ALTER DATABASE [YourDB] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
This disconnects other sessions and gives you the one allowed connection. UseWITH ROLLBACK IMMEDIATEonly when you accept that in-flight transactions will roll back; useWITH ROLLBACK AFTER 30 SECONDSif you want to give users a short grace period. If you are already the single user, this step may return an error saying the database is already in single-user mode; that is fine, proceed. - Switch back to multi-user mode. In the same
masterquery window, run:ALTER DATABASE [YourDB] SET MULTI_USER;
You should see “Commands completed successfully.” This is the actual fix for error 1488. - Verify. Re-run the query from step 1.
user_access_descshould now beMULTI_USER. Then reconnect from a second query window and run a simpleSELECTagainst a table to confirm normal access. - If the ALTER fails because another session grabbed the slot first, repeat step 3 and immediately run step 4 in the same batch:
ALTER DATABASE [YourDB] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; ALTER DATABASE [YourDB] SET MULTI_USER;
Running both statements together prevents another connection from taking the slot between them. - If the database is marked RESTORING or RECOVERING, single-user mode may be a side effect of an incomplete restore. In that case, restore the database again from a valid backup, or run
RESTORE DATABASE [YourDB] WITH RECOVERY;if a restore was intentionally left withNORECOVERY. Do not force multi-user mode on a database that is still restoring.
Common Mistakes
- Running the ALTER from the affected database. You cannot change the mode while connected to it as the single user in a way that also frees the slot. Always run the
ALTER DATABASEstatements frommaster. - Leaving Object Explorer connected. SSMS keeps a connection open when you expand a database node. That connection can occupy the single-user slot and cause the same error to reappear immediately after you fix it.
- Using
WITH ROLLBACK IMMEDIATEwithout warning. It terminates other sessions and rolls back their open transactions. On a production system, announce a maintenance window first. - Confusing single-user with restricted-user.
RESTRICTED_USERallows members of db_owner, dbcreator, and sysadmin;SINGLE_USERallows exactly one connection. The fix for error 1488 is specificallySET MULTI_USER. - Forgetting that a database can be set to single-user by an application or script. If the mode keeps reverting, check for maintenance jobs, deployment scripts, or backup software that set it temporarily.
Tips
- Use
ALTER DATABASE [YourDB] SET MULTI_USER WITH ROLLBACK IMMEDIATE;if you need to force the change and accept disconnecting users. - Script the fix so it is repeatable: put the two ALTER statements in one batch and run it from a
masterconnection. - Check
sys.databases.state_descas well asuser_access_desc; a database inRECOVERY_PENDINGorRESTORINGneeds a different remedy than a mode change. - If you use Azure SQL Database, single-user mode is not exposed the same way; error 1488 is primarily an on-premises or SQL Server on a VM scenario. Managed Instance behaves like SQL Server for this setting.
- Keep a login with sysadmin rights available for emergencies; if the only sysadmin login is locked out, you may need to start SQL Server in single-user mode from the command line (
sqlservr.exe -m) and add a login. That is a separate recovery procedure and should be done during downtime.
Troubleshooting
The ALTER returns “database is already in single-user mode” or “cannot set multi-user because another user is connected.” Another session holds the slot. Run sp_who2, find the SPID, and either close that application or use KILL <spid> (only if you are sure it is safe). Then repeat the two-statement batch from step 6.
The database flips back to single-user immediately. Something is setting it. Check SQL Server Agent jobs, application connection strings that include Application Name and set the mode, and any deployment scripts. Also check for triggers or stored procedures that run ALTER DATABASE.
You cannot connect at all because the single slot is taken by an unknown process. Restart the SQL Server service (Windows Services console or net stop MSSQLSERVER then net start MSSQLSERVER; instance names vary). After restart, connect quickly from master and run the multi-user ALTER before other applications reconnect.
The database is in RESTORING state. Do not set multi-user. Complete the restore with WITH RECOVERY or restore from backup. If the restore was interrupted, the database may need to be dropped and restored again; dropping a database deletes its data, so confirm you have a backup first.
You lack permission. Error 1488 can be accompanied by a permissions error if your login is not sysadmin or db_owner. Ask an administrator to run the ALTER, or have them grant you ALTER on the database.
Frequently Asked Questions
What does SQL Server error 1488 actually mean?
It means the database is configured for single-user access and the one allowed connection is already in use, so your connection is rejected.
Will switching to multi-user mode disconnect users?
Yes. Setting MULTI_USER with ROLLBACK IMMEDIATE terminates existing sessions and rolls back their open transactions. Without the rollback clause, the change waits for connections to close.
Can I fix error 1488 without restarting SQL Server?
Usually yes. Run the two ALTER statements from master. A restart is only needed when a stale connection cannot be identified or killed.
Is single-user mode ever intentional?
Yes. It is used for maintenance such as DBCC CHECKDB, some restore operations, and emergency login recovery. If you find it set unexpectedly, look for a script or job that set it.
Does this apply to Azure SQL Database?
Single-user mode is a SQL Server instance setting. Azure SQL Database does not expose it the same way; the error is most common on SQL Server instances and Azure SQL Managed Instance.
What if I am the only user and still get error 1488?
Your own SSMS Object Explorer connection may be holding the slot. Close it, reconnect to master, and run the ALTER statements from there.