SQL SERVER Dedicated Administrator Connection (DAC) enabled and how to connect.
In the SQL Server 2000 and earlier days it was all too often I found myself resorting to a server reboot to get control of my database server or access to a single database that had an issue.
One of the best additions to the SQL Server feature set was the Dedicated Administrator Connection (DAC). Prior to this being a part of the platform, an overloaded instance might not even allow a DBA to connect and perform any actions.
So lets look at if DAC is enabled and also look at determining who is connecting to your instance with the DAC. In general, the DAC should be left open on your instances and not used. If you have used it in an emergency, it's possible that you might reconnect to that instance as a part of your daily work and use the DAC. If someone else had the need to connect in an emergency, they wouldn't be able to since only one connection is allowed.
How to making the Connection to DAC. By default the DAC is only available from the server itself. If you want to allow this from other machines, you can enable remote administrator connections.
When connecting with the DAC, one can use a couple different methods. Either an SSMS window or SQLCMD.EXE can be used. Typically the SSMS is the easiest and you would prefix the server name with ADMIN:INSTANCE
NOTE: The admin: string is case insensitive. Therefore, ADMIN:, admin:, and AdMiN: are equivalent. Make sure to use all capital letters.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJjE4DOgcygFlqOyrgxf4NiNEiEk7mSAYtz57PhsZ-S4zHpleyG6Nfo0ih3AF910Y8ZDF9j2AGZKSZJ1l3GV8GgspVDar4M6hU2EiLfqgYw4i8cJmrCxbQqpUS-9IVEWBZAGgin0fNVQw/s320/DAC.jpg)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhR3170I_0eAzn9a7si-rqkS4npLgtQr_sq8909d2sGuIyAm1Z4RmXYZohBoj9kFy9h0ELFkuK9d9udStv-NgNWULOT8-WsSc-csiv5i0AET42dVliWtyl9iYpgcaWrrIlIY1fpsc8avvE/s320/Dac_Screen.jpg)
Once you've connected, your connection looks like any other connection with SSMS except you only have a single tab and the Object Explorer is not populated and you will see the ADMIN: prefix in the lower right corner of SSMS
Am I Using the DAC?
If you query the sys.endpoints DMV, you will see an endpoint created for the DAC. The name will be "Dedicated Admin Connection" and you will see which protocol is in use as well as the state. There is an is_admin_endpoint column as well.
SELECT * FROM sys.endpoints
With this information, I can start to determine who is connecting through this endpoint. Since each connection uses an endpoint, I can join to this table to find out which connection is using the DAC. The sys.dm_exec_sessions DMV contains a column, endpoint_id, that is useful to join back to this table.
With this information you can write a query such as this and see how is connected or if a connection is open. If no connection is open the results will be ZERO rows. Remove the WHERE e.is_admin_endpoint = 1 if you want to see all session data
SELECT s.session_id, e.name AS Endpoint, s.login_name, s.nt_domain, s.nt_user_name,
s.login_time, s.host_name, s.program_name
FROM sys.dm_exec_sessions s
INNER JOIN sys.endpoints e ON e.endpoint_id = s.endpoint_id
WHERE e.is_admin_endpoint = 1
If remote Dedicated Administrator Connection (DAC) is not enabled it can be enable through the SSMS GUI or you can execute the below T-SQL to enable remote clients to utilize the Dedicated Administrator Connection. This by default will use port 1434 so ensure that the Firewall has a rule to allow this traffic. Otherwise DAC is available only available if logged into the machine and not remotely.
Use master
GO
/* 0 = Allow Local Connection, 1 = Allow Remote Connections*/
sp_configure 'remote admin connections', 1
GO
RECONFIGURE
GO
One of the best additions to the SQL Server feature set was the Dedicated Administrator Connection (DAC). Prior to this being a part of the platform, an overloaded instance might not even allow a DBA to connect and perform any actions.
So lets look at if DAC is enabled and also look at determining who is connecting to your instance with the DAC. In general, the DAC should be left open on your instances and not used. If you have used it in an emergency, it's possible that you might reconnect to that instance as a part of your daily work and use the DAC. If someone else had the need to connect in an emergency, they wouldn't be able to since only one connection is allowed.
How to making the Connection to DAC. By default the DAC is only available from the server itself. If you want to allow this from other machines, you can enable remote administrator connections.
When connecting with the DAC, one can use a couple different methods. Either an SSMS window or SQLCMD.EXE can be used. Typically the SSMS is the easiest and you would prefix the server name with ADMIN:INSTANCE
NOTE: The admin: string is case insensitive. Therefore, ADMIN:, admin:, and AdMiN: are equivalent. Make sure to use all capital letters.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJjE4DOgcygFlqOyrgxf4NiNEiEk7mSAYtz57PhsZ-S4zHpleyG6Nfo0ih3AF910Y8ZDF9j2AGZKSZJ1l3GV8GgspVDar4M6hU2EiLfqgYw4i8cJmrCxbQqpUS-9IVEWBZAGgin0fNVQw/s320/DAC.jpg)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhR3170I_0eAzn9a7si-rqkS4npLgtQr_sq8909d2sGuIyAm1Z4RmXYZohBoj9kFy9h0ELFkuK9d9udStv-NgNWULOT8-WsSc-csiv5i0AET42dVliWtyl9iYpgcaWrrIlIY1fpsc8avvE/s320/Dac_Screen.jpg)
Once you've connected, your connection looks like any other connection with SSMS except you only have a single tab and the Object Explorer is not populated and you will see the ADMIN: prefix in the lower right corner of SSMS
Am I Using the DAC?
If you query the sys.endpoints DMV, you will see an endpoint created for the DAC. The name will be "Dedicated Admin Connection" and you will see which protocol is in use as well as the state. There is an is_admin_endpoint column as well.
SELECT * FROM sys.endpoints
With this information, I can start to determine who is connecting through this endpoint. Since each connection uses an endpoint, I can join to this table to find out which connection is using the DAC. The sys.dm_exec_sessions DMV contains a column, endpoint_id, that is useful to join back to this table.
With this information you can write a query such as this and see how is connected or if a connection is open. If no connection is open the results will be ZERO rows. Remove the WHERE e.is_admin_endpoint = 1 if you want to see all session data
SELECT s.session_id, e.name AS Endpoint, s.login_name, s.nt_domain, s.nt_user_name,
s.login_time, s.host_name, s.program_name
FROM sys.dm_exec_sessions s
INNER JOIN sys.endpoints e ON e.endpoint_id = s.endpoint_id
WHERE e.is_admin_endpoint = 1
If remote Dedicated Administrator Connection (DAC) is not enabled it can be enable through the SSMS GUI or you can execute the below T-SQL to enable remote clients to utilize the Dedicated Administrator Connection. This by default will use port 1434 so ensure that the Firewall has a rule to allow this traffic. Otherwise DAC is available only available if logged into the machine and not remotely.
Use master
GO
/* 0 = Allow Local Connection, 1 = Allow Remote Connections*/
sp_configure 'remote admin connections', 1
GO
RECONFIGURE
GO
Comments
Post a Comment