数据库
首页 > 数据库> > sql-server – 如何在Linux上登录专用管理控制台(DAC)?

sql-server – 如何在Linux上登录专用管理控制台(DAC)?

作者:互联网

记录有sqlcmd,

Login-Related Options

-A
Logs in to SQL Server with a Dedicated Administrator Connection (DAC). This kind of connection is used to troubleshoot a server. This will only work with server computers that support DAC. If DAC is not available, sqlcmd generates an error message and then exits. For more information about DAC, see Diagnostic Connection for Database Administrators. The -A option is not supported with the -G option. When connecting to SQL Database using -A, you must be a SQL server administrator. The DAC is not availble for an Azure Active Directory adminstrator.

解决方法:

客户端

Microsoft有两个Linux客户端可以连接到SQL Server的专用管理员连接(DAC),

> mssql-cli. Versions newer than 0.90具有-A选项以连接到专用管理员连接(DAC). (QUOTED_IDENTIFIERS默认情况下处于启用状态).

mssql-cli -S localhost -U sa -A

> sqlcmd.这是mssql-tools包附带的旧客户端.永远不应该使用它.如果你坚持使用它,你将不得不习惯GO.不要总是使用-I和sqlcmd打开QUOTED_IDENTIFIERS.不知道微软为什么选择了sqlcmd的admin:前缀.在大多数其他客户端上,他们使用-A标志.

sqlcmd -I -S admin:localhost -U sa

服务器设置

如果从外部localhost连接,则可能必须先启用远程DAC.要做到这一点,只需运行

sp_configure 'remote admin connections', 1 
GO
RECONFIGURE
GO

标签:sql-server,linux,sqlcmd,dac
来源: https://codeday.me/bug/20190806/1601820.html