sqlcmd
is documented to have,
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.
Best Answer
Clients
There are two Linux clients from Microsoft that can connect to SQL Server's Dedicated Administrator Connection (DAC),
mssql-cli
. Versions newer than 0.90 have the-A
option to connect to the Dedicated Administrator Connection (DAC). (QUOTED_IDENTIFIERS
is on by default).sqlcmd
. This is the older client that ships with themssql-tools
package. It should never be used. If you insist on using it, you'll have to get accustomed toGO
. Don't foget to always use-I
withsqlcmd
to turn onQUOTED_IDENTIFIERS
. No idea why Microsoft chose theadmin:
prefix forsqlcmd
. On most other clients, they use-A
flag.Server Settings
If connecting from outside
localhost
you may have to enable remote DAC first. To do that simply run