sql-server - SQL Server 2008在单用户模式下不允许连接

标签 sql-server sqlcmd

我不知道 SA 密码,因此我以单用户模式重新启动了 SQL Server 2008 Standard Edition 实例,希望更改 SA 密码。之后我立即尝试连接

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.

我尝试立即更改密码

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.

-m 真的代表零用户模式吗?还是我的服务器出了什么严重问题?

最佳答案

您的连接可能会立即被其他一些服务(例如 SQL Agent、Reporting Services)占用

您可以使用 -m 开关传递可选的附加客户端名称参数。

例如使用

-m"sqlcmd"   

仅允许将自身标识为 sqlcmd 客户端程序的程序获取单个可用连接。 See the docs for more about this.

关于sql-server - SQL Server 2008在单用户模式下不允许连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10741187/

相关文章:

sql-server - 如何在 Ubuntu 上使用 sqlcmd 调用带有 xml 参数的存储过程

sql-server - 如何在 ubuntu 16.04 中为 mssql 实例启用 TCP/IP?

SQL Server查询,对多列进行排序

sql-server - 查看(但不执行)存储过程及其代码需要什么级别的 SQL Server 访问权限?

sql - 将行值转换为 ColumnName

sql-server - 从 Sql Compact sdf 文件创建 Azure Sql 数据库

sql-server - 如何在 SQL 脚本上测试 SQLCMD 而无需执行脚本

sql-server - SQL Server : correct DELETE syntax

error-handling - 从DOS进行错误测试和控制

sql-server - 如何使用 sqlcmd 从 SQL Server 将数据导出为 CSV 格式?