Skip to content
Microsoft SQL Server

SQL Server Error 924

Database is already open and can only have one user at a time

Applies to: All supported SQL Server versions (2016 to 2025), Azure SQL Managed Instance
Last technically reviewed 24 October 2026 on SQL Server 2025 (17.0.1145.4)
The full message
Msg 924, Level 14, State 1, Line 1
Database 'AppDb' is already open and can only have one user at a time.
Other forms of this message
Connecting with the database as the initial database (sqlcmd -d, ODBC Driver 18, reproduced on SQL Server 2025)
Sqlcmd: Error: Microsoft ODBC Driver 18 for SQL Server : Login failed for user 'CONTOSO\appuser'..
Sqlcmd: Error: Microsoft ODBC Driver 18 for SQL Server : Cannot open database "AppDb" requested by the login. The login failed..
Error number
924
Severity
14 (user-correctable error)
State
1
Product
Microsoft SQL Server Database Engine
Versions
All supported SQL Server versions (2016 to 2025), Azure SQL Managed Instance
Last reviewed
24 October 2026

What it means

Error 924 means the database is in SINGLE_USER mode and its one allowed connection is already taken by another session, so yours cannot enter it.

SINGLE_USER mode allows exactly one session in the database. It is normally set for maintenance (ALTER DATABASE ... SET SINGLE_USER), and whichever session uses the database first after that holds the slot. Every other attempt, a USE statement, a three-part name or a query from Object Explorer, fails with 924 at severity 14. A new connection that names the database as its initial database fails at login (4060).

The holder is often not the person who set the mode: an application that reconnects automatically, a SQL Server Agent job, a monitoring tool or an SSMS Object Explorer node can grab the slot within seconds, which is why the DBA who ran SET SINGLE_USER suddenly cannot get back in. Find that session first.

Common causes

  • Someone set the database to SINGLE_USER for maintenance (for example a restore, DBCC or a collation change) and another session took the only connection.
  • An application with a connection pool or retry logic reconnected as soon as SINGLE_USER was set.
  • A SQL Server Agent job, backup tool or monitoring agent connects to the database on a schedule.
  • The database was left in SINGLE_USER after maintenance finished, and the session that set it is still open in another query window.

Diagnose it

Read-only These queries only read metadata and dynamic management views. They do not change data, permissions or configuration, so they are safe to run first.

Is the database in SINGLE_USER mode?

SELECT name, user_access_desc, state_desc
FROM sys.databases
WHERE name = N'AppDb';
What to look for

SINGLE_USER confirms the cause. RESTRICTED_USER admits only members of db_owner, dbcreator and sysadmin, which gives different errors.

Who holds the one connection?

SELECT session_id, login_name, host_name, program_name, status, login_time, last_request_end_time
FROM sys.dm_exec_sessions
WHERE database_id = DB_ID(N'AppDb');
What to look for

The session using the database, with the program and host. If it is your own other query window, close it or switch it to master.

Sessions that hold a lock on the database

SELECT request_session_id, request_mode, request_status
FROM sys.dm_tran_locks
WHERE resource_type = 'DATABASE'
  AND resource_database_id = DB_ID(N'AppDb');
What to look for

Also catches a session whose current database is elsewhere but which is running a query in this database.

How to fix it

Each fix is labelled with what it changes. Try read-only checks and the least invasive fix first, and test changes outside production.

Ask the holder to leave, or use that session

Client or network side

If the session holding the slot is yours (another query window) or a colleague's, do the work there or close it. If it is an application or job, stop it for the maintenance window.

Return the database to MULTI_USER

Changes database state

When maintenance is finished, set the database back to MULTI_USER from master. Without a termination clause the statement waits while another session holds a lock on the database; WITH ROLLBACK IMMEDIATE applies it at once.

Caution: WITH ROLLBACK IMMEDIATE ends the holder's connection to the database and rolls back its open transaction. Make sure that work can be lost or redone.

USE master;
ALTER DATABASE AppDb SET MULTI_USER WITH ROLLBACK IMMEDIATE;

Take the slot reliably for your own maintenance

Changes database state

Set SINGLE_USER and switch into the database in the same batch, so no other connection can get in between, then do the maintenance and return to MULTI_USER.

Caution: SINGLE_USER WITH ROLLBACK IMMEDIATE disconnects everyone else and rolls back their uncommitted work. Stop applications and jobs first, or they will compete for the slot.

USE master;
ALTER DATABASE AppDb SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
USE AppDb;
-- ... maintenance ...
USE master;
ALTER DATABASE AppDb SET MULTI_USER;

Examples

A second session tries to use a SINGLE_USER database

Two sessions at once. Session 1 sets SINGLE_USER from inside the database and so keeps the only slot; session 2 is refused.

-- Session 1 (in AppDb):
ALTER DATABASE AppDb SET SINGLE_USER;

-- Session 2, while session 1 is still connected:
USE AppDb;
Result
Msg 924, Level 14, State 1, Line 1
Database 'AppDb' is already open and can only have one user at a time.

Reproduced on SQL Server 2025 (17.0.1145.4), 23 October 2026.

How to prevent it

Before setting SINGLE_USER, stop the applications, jobs and tools that use the database, and run the maintenance from one script that sets the mode, enters the database, does the work and sets MULTI_USER again.

For maintenance that only needs to keep ordinary users out, RESTRICTED_USER is often enough and still lets administrators in with more than one connection.

Common questions

I set SINGLE_USER myself; why am I locked out?

Setting the mode does not reserve the slot for you. Whichever session enters the database first takes it, often Object Explorer, an Agent job or an application that reconnects. Find it in sys.dm_exec_sessions.

How do I get a database out of SINGLE_USER mode?

From master, run ALTER DATABASE ... SET MULTI_USER. While another session holds a lock on the database the change waits; WITH ROLLBACK IMMEDIATE rolls back the work of that session and applies the change at once.

Learn more on CodeWithSQL

Official documentation

Last technically reviewed 24 October 2026; examples and diagnostics run on SQL Server 2025 (17.0.1145.4). Message text checked against the engine's sys.messages catalogue.

Still stuck on a SQL Server error?

Browse the full SQL Server error library, or get hands-on help from an experienced SQL professional.