SQL Server Error 18461 – Only One Administrator Can Connect at This Time

sql server

I was experimenting the effect of giving SQL Server a small amount of memory I thought it was going to recover.

I configured SQL Server to use 200MB of memory now it does not want to start, I did some searches on the internet and I was advised to start SQL Server in single-user mode. however, I get the error

Login Failed for user A. Reason: Server is in single user mode. Only
one administrator can connect at this time (Microsoft SQL Server,
Error: 18461)

enter image description here

I have stopped the SQL Server Agent.

Best Answer

If you start SQL Server in single user mode only one administrator can connect at the same time.

What's probably happening here is that some service is using a sysadmin login to connect such as Reporting services or SQL Server agent.

When starting SQL Server in single user mode you have the option to specify a client application so only that application can connect.

Have a look at the command line options where it lists:

-m "Client Application Name"

When you use the -m option with SQLCMD or SQL Server Management Studio, you can limit the connections to a specified client application. For example, -m"SQLCMD" limits connections to a single connection and that connection must identify itself as the SQLCMD client program. Use this option when you are starting SQL Server in single-user mode and an unknown client application is taking the only available connection. To connect through the Query Editor in Management Studio, use -m"Microsoft SQL Server Management Studio - Query".

Client Application Name is case sensitive.

If you are able to connect this way, change the maximum server memory to something reasonable. I suppose you will be able to connect because otherwise you would probably receive something as "there is no process on the other end of the pipe" so I would assume your server is running.

If however you can't log in to SQL Server because your memory configuration doesn't allow you, you can start SQL Server in minimal configuration using the -f option.

-f

Starts an instance of SQL Server with minimal configuration. This is useful if the setting of a configuration value (for example, over-committing memory) has prevented the server from starting. Starting SQL Server in minimal configuration mode places SQL Server in single-user mode. For more information, see the description for -m that follows.

For reference: SQL Server can’t start after accidently set the "max server memory" to 0