Once you enabled the DAC for an SQL Server instance, it is pretty easy to connect to the Server via DAC. You just need to mention ADMIN: in front of the server name that your connecting. See below figure:
Note that you can establish a single successful DAC connection to a SQL Server. If you try another DAC connection attempt, you get the following error message;
"A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - The specified network name is no longer available.) (Microsoft SQL Server, Error: 64)"
There is a possibility that you will get the above error when you try to login to a server via DAC to perform some urgent troubleshooting task. That means someone else has already logged into the server using remote DAC and you may immediately do to panic mode. In such cases, it is very important to know who is using DAC connection.
Use the below T-SQL code to get the information of already established DAC connection.
SELECT CASE WHEN ses.session_id= @@SPID THEN 'It''s me! ' ELSE '' END +
COALESCE(ses.login_name, '???') AS WhosGotTheDAC,
ses.session_id,
ses.login_time,
ses.status,
ses.original_login_name
FROM sys.endpoints AS en
JOIN sys.dm_exec_sessions ses
ON en.endpoint_id = ses.endpoint_id
WHERE en.NAME = 'Dedicated Admin Connection'
If your using the server name when connecting, make sure SQL Server Browser service is running. Otherwise you will receive the most common log on error which is "A Network-related or instance-specific error occurred…" which basically says it cannot find the server.
General guideline
It is always a good practice to enable
D
AC in all production servers. This option is extremely useful when you want to troubleshoot server issues.
No comments:
Post a Comment