3

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.

3

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).

    mssql-cli -S localhost -U sa -A
    
  • sqlcmd. This is the older client that ships with the mssql-tools package. It should never be used. If you insist on using it, you'll have to get accustomed to GO. Don't foget to always use -I with sqlcmd to turn on QUOTED_IDENTIFIERS. No idea why Microsoft chose the admin: prefix for sqlcmd. On most other clients, they use -A flag.

    sqlcmd -I -S admin:localhost -U sa
    

Server Settings

If connecting from outside localhost you may have to enable remote DAC first. To do that simply run

sp_configure 'remote admin connections', 1 
GO
RECONFIGURE
GO
  • 2
    The admin: prefix exists in both places...it is a way of connecting without specifying the port #....I linked the DAC documentation in my answer to the "how to edit system catalogs" question...it talks about admin: and ServerName,1434. Also, I believe -A is only for SQLCMD, whereas the other two methods work in SSMS, SqlClient / .NET, etc... – Solomon Rutzky Dec 12 '17 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.