简体   繁体   English

分离数据库后,SQL Server 2014 无法登录

[英]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.我正在使用 Windows 服务器,但在登录 SQL Server 2014 时遇到问题。

A few days ago I changed default user from master database to new one.几天前,我将默认用户从 master 数据库更改为新用户。 But today I opened SQL Server Management Studio.但是今天我打开了 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.之后,我从 SQL Server Management Studio 断开连接,然后再次连接。

Check: Windows authentication检查:Windows 身份验证

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 (提供程序:共享内存提供程序,错误:0 - 管道的另一端没有进程。)(.Net SqlClient 数据提供程序)错误: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.用户 A 登录失败。原因:服务器处于单用户模式。 Only one administrator can connect at this time (Microsoft SQL Server, Error: 18461)此时只有一名管理员可以连接(Microsoft SQL Server,错误: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.解决此问题的一种方法是在最小配置模式下启动 SQL 实例。

NET START MSSQLSERVER /f

Once you connect to the instance from same cmd window, then change the Max memory setting :从同一个 cmd 窗口连接到实例后,然后更改最大内存设置:

 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:更多关于 sqlcmd 在这里:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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