Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server 2008 in single-user mode allows no connections

I don't know the SA password so I restarted my SQL Server 2008 Standard Edition instance in Single-user mode with the hope of changing the SA password. Immediately afterwards I tried connecting with

sqlcmd -S serverName\ss2008

Msg 18461, Level 14, State 1, Server serverName\SS2008, Line1 Login failed for user 'serverName\Administrator'. Reason: Server is in single user mode. Only one administrator can connect at this time.

My attempts at changing the password right out yields

C:\Documents and Settings\Administrator>sqlcmd -U sa -z p@ssword Password: Msg 18470, Level 14, State 1, Server serverName, Line 1 Login failed for user 'sa'. Reason: The account is disabled.

Does -m really stand for zero-user mode, or is there something horribly awry with my server?

like image 718
Blanthor Avatar asked May 24 '12 16:05

Blanthor


People also ask

How do I start SQL Server 2008 in single user mode?

Right-click on SQL Server service and click on the Restart to restart the SQL Server instance. SQL Server will start in single user mode. Now connect to SQL Server using SQL Server Management Studio or SQLCMD.

Why SQL Server is not connecting?

The following common scenarios can cause connectivity problems: Incorrect IP address for the Server field. Make sure that the IP address matches the entry in the SQL Server error log file. Incorrect server name in the Server field.

How do I change SQL Server from single user to multi user?

Scroll down to get 'STATE' field. Select Restrict access option from STATE field. Select MULTI_USER from dropdown menu. Click 'OK'.


1 Answers

Your connection may be being taken immediately by some other service (e.g. SQL Agent, Reporting Services)

You can pass an optional additional client name parameter with the -m switch.

e.g. using

-m"sqlcmd"   

Will only permit the single available connection to be taken by a program that identifies itself as the sqlcmd client program. See the docs for more about this.

like image 178
Martin Smith Avatar answered Sep 30 '22 17:09

Martin Smith