简体   繁体   中英

SQL Server 2014 can't login after detach database

I'm using using Windows server and I'm having trouble logging in to SQL Server 2014.

A few days ago I changed default user from master database to new one. But today I opened SQL Server Management Studio.

I detach that database by right-clicking on it. After that, I disconnect from SQL Server Management Studio and then connect again.

Check: Windows authentication

Click OK

I get an error:

A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) (.Net SqlClient Data Provider) error:233

When I try more to fixed it, now I get this 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)

What causes this error and how do I login again and attach my database? Can I login to master database?

One way to solve this is by starting SQL instance in minimum config mode.

NET START MSSQLSERVER /f

Once you connect to the instance from same cmd window, then change the Max memory setting :

 SQLCMD -S <ServerName>\<InstanceName> -E

A prompt occurs:

1> 

Type the following:

sp_configure 'show advanced options', 1;  
GO  
RECONFIGURE;  
GO  
sp_configure 'max server memory', 4096;  
GO  
RECONFIGURE;  
GO  

Restart the instance from Configuration Manager.

More on sqlcmd here:

https://docs.microsoft.com/mt-mt/sql/ssms/scripting/sqlcmd-use-the-utility?view=sql-server-2017

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM