Skip to content
Microsoft SQL Server

SQL Server Error 17809

Could not connect because the maximum number of user connections has been reached

Severity 20 Logins & Permissions
Applies to: All supported SQL Server versions (2016 to 2025); Azure SQL Database limits sessions per service tier and reports it differently
Last technically reviewed 24 October 2026 on SQL Server 2025 (17.0.1145.4)
The full message
Could not connect because the maximum number of '200' user connections has already been reached. The system administrator can use sp_configure to increase the maximum value. The connection has been closed.
Other forms of this message
Catalogue template (sys.messages); %ld is the limit in force, %.*ls is extra text appended by the engine
Could not connect because the maximum number of '%ld' user connections has already been reached. The system administrator can use sp_configure to increase the maximum value. The connection has been closed.%.*ls
Error number
17809
Severity
20 (fatal: the connection ends; may indicate a serious problem)
State
Not documented by Microsoft (not reproduced here)
Product
Microsoft SQL Server Database Engine
Versions
All supported SQL Server versions (2016 to 2025); Azure SQL Database limits sessions per service tier and reports it differently
Last reviewed
24 October 2026

What it means

Error 17809 means SQL Server refused a new connection because the instance already holds as many user connections as it allows, so the login never started.

Every connection to the instance uses a user connection slot. The user connections option sets how many may exist at once; its default, 0, means the maximum of 32,767. When the limit is reached, the next connection attempt is closed before login completes and SQL Server writes 17809 to the error log. The number in quotes is the limit that was in force, which is the quickest clue: a small number such as 200 means someone set user connections deliberately, while a number near 32,767 means something really did open that many connections.

Severity 20 here describes the failed connection, not damage to a database: existing sessions keep working and nothing is corrupted. In practice the cause is almost always on the client side (an application that opens connections and never closes them, or a pool configured far larger than needed), so the diagnostics look at who holds the connections before anything is changed on the server.

Common causes

  • A connection leak: application code opens connections and does not close or dispose of them, so the pool keeps growing or sessions pile up while they sleep.
  • Many application servers or processes, each with its own connection pool (SqlClient defaults to a Max Pool Size of 100 per connection string), together exceeding the limit.
  • The user connections option set to a low, non-zero value years ago and forgotten.
  • Connection strings that differ slightly per request (user name, application name, database), which creates a separate pool for each variant instead of sharing one.
  • A burst of new connections after a failover, restart or deployment, often amplified by aggressive client retry logic.

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.

What limit is configured, and what is in force?

SELECT name, value, value_in_use
FROM sys.configurations
WHERE name = N'user connections';

SELECT @@MAX_CONNECTIONS AS max_connections;
What to look for

value_in_use = 0 and 32767 mean the default (no practical limit). A non-zero value is a deliberate cap. If value differs from value_in_use, a change was made that waits for a restart.

Which applications and hosts hold the connections?

SELECT TOP (20) s.host_name, s.program_name, s.login_name,
       COUNT(*) AS sessions,
       SUM(CASE WHEN s.status = N'sleeping' THEN 1 ELSE 0 END) AS sleeping,
       MIN(s.last_request_end_time) AS oldest_last_request
FROM sys.dm_exec_sessions AS s
WHERE s.is_user_process = 1
GROUP BY s.host_name, s.program_name, s.login_name
ORDER BY sessions DESC;
What to look for

One application or host with hundreds or thousands of sessions, most of them sleeping, is the usual sign of a connection leak or an oversized pool. Compare the count with what that application should need.

Where do the connections come from on the network?

SELECT c.client_net_address, c.net_transport, COUNT(*) AS connections
FROM sys.dm_exec_connections AS c
GROUP BY c.client_net_address, c.net_transport
ORDER BY connections DESC;
What to look for

The client addresses with the most connections. This helps when host_name is blank or misleading, since the client chooses that value.

Which sessions have been idle for a long time?

SELECT s.session_id, s.host_name, s.program_name, s.login_name,
       s.last_request_end_time, s.open_transaction_count
FROM sys.dm_exec_sessions AS s
WHERE s.is_user_process = 1
  AND s.status = N'sleeping'
  AND s.last_request_end_time < DATEADD(MINUTE, -30, SYSDATETIME())
ORDER BY s.last_request_end_time;
What to look for

Sessions that have done nothing for a long time are leaked or idle pooled connections. Any with open_transaction_count above 0 also hold locks and need attention first.

Is the dedicated admin connection available for emergencies?

SELECT name, state_desc
FROM sys.endpoints
WHERE name = N'Dedicated Admin Connection';

SELECT name, value_in_use
FROM sys.configurations
WHERE name = N'remote admin connections';
What to look for

The endpoint is normally STARTED. With remote admin connections = 0 (the default) the DAC only accepts connections from the server itself, so know in advance whether you can log on locally.

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.

Fix connection leaks and pool sizes in the application

Client or network side

Open a connection as late as possible and close it as early as possible, always in a using block (or try/finally), so it returns to the pool. Keep connection strings identical so that requests share one pool, and set Max Pool Size to what the application really needs rather than raising it to hide a leak. Review retry logic so that a failure does not multiply connection attempts.

// C#: the connection goes back to the pool even if the query throws
using (var cn = new SqlConnection(connectionString))
using (var cmd = new SqlCommand("SELECT COUNT(*) FROM dbo.Orders", cn))
{
    cn.Open();
    var count = (int)cmd.ExecuteScalar();
}

In an emergency, use the dedicated admin connection

Changes database state

When no normal connection is possible, a member of sysadmin can connect through the dedicated admin connection (sqlcmd -S admin:ServerName -E, or ADMIN:ServerName in the SSMS query connection dialog). Use it only to run the diagnostics above and, if the business agrees, to end sessions of the leaking application so others can log in again. Only one DAC session can exist at a time; keep the work short.

Caution: KILL rolls back any open transaction of that session and the application sees a broken connection. End only sessions you have identified as idle or leaked, and fix the application, or the slots fill up again.

-- Over the DAC, after confirming the session belongs to the leaking application
KILL 87;

Review the user connections setting, with caution

Changes configuration

If diagnostic 1 shows a deliberate low cap that no longer suits the workload, an administrator can raise it or return it to 0 (the default, 32,767). Microsoft recommends leaving it at the default in most cases, and the change only takes effect after the service restarts. Do not raise the limit to accommodate a leak: each connection has memory overhead whether it is used or not.

Caution: sp_configure changes the whole instance and this option needs a SQL Server restart, which disconnects every user. Agree a maintenance window and record the old value first.

EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'user connections', 0;   -- 0 = default (32,767)
RECONFIGURE;
-- takes effect after the next service restart

Examples

A new connection is refused when the limit is reached

Shown as documented by Microsoft; not reproduced here, because it needs the instance-wide connection limit to be reached. The message text is from sys.messages on SQL Server 2025 with an example limit of 200; the state written to the error log was not observed, so no header is shown.

-- Any new connection, for example
sqlcmd -S ServerName -E -Q "SELECT 1"
Result
Could not connect because the maximum number of '200' user connections has already been reached. The system administrator can use sp_configure to increase the maximum value. The connection has been closed.

How to prevent it

Treat connections as short-lived resources in application code, keep pools sized from measurements, and monitor the number of user sessions per application over time so that slow growth from a leak shows up long before the limit.

Leave user connections at its default unless you have a measured reason, document any cap you set, and test once that administrators can reach the instance through the dedicated admin connection before they need it.

Common questions

Should I just increase user connections?

Only if a deliberate low cap is the problem. If the count is high because an application leaks connections, a higher limit only delays the next outage and costs memory.

Can I still connect as an administrator?

Usually yes, through the dedicated admin connection, which SQL Server keeps for this kind of situation. By default it works only from the server itself unless remote admin connections is enabled.

Why are most of the sessions sleeping?

Sleeping sessions are connections that are open but idle, which is what pooled or leaked connections look like. A few are normal; thousands from one application are not.

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.