Introduction
Per Books Online:
http://msdn.microsoft.com/en-us/library/ms189595.aspx
SQL Server listens for the DAC on TCP port 1434 if available or a TCP port dynamically assigned upon Database Engine startup.
Also, we can go to the following registry to specify the DAC port number manually:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQLServer\SuperSocketNetLib\AdminConnection\Tcp
The error log contains the port number the DAC is listening on. Besides looking at the error log, how to find which port is used by DAC connection and how to tell if the DAC port is manually set by us or assigned automatically by SQL Server?
Solution
The following query can be used to check if there is an existing DAC connection and it also give us the port number used by dedicated admin connection.
SELECT name,local_tcp_port FROM sys.dm_exec_connections ec join sys.endpoints e on (ec.endpoint_id=e.endpoint_id) WHERE e.name='Dedicated Admin Connection'Here is the scenario to test if the DAC port is automatically changed or not.
There are two instances are running on one server. I specified the same DAC port number 5555 for the two SQL Server instances by modifying the registry
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQLServer\SuperSocketNetLib\AdminConnection\Tcp
Opened the DAC connection to instance 1. Executed the above query, it returns the result:
name
local_tcp_port
Dedicated Admin Connection 5555
Then, opened a DAC connection to instance 2. It throw out the following error message:
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : Client unable to establish connection because an error was encountered during handshakes before login.
Common causes include client attempting to connect to an unsupported version of SQL Server, server too busy to accept new connections or a resource limitation (memory or maximum allowed connections) on the server..
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : TCP Provider: An established connection was aborted by the software in your host machine..
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : Client unable to establish connection.
Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : Client unable to establish connection due to prelogin failure.
The above error message was thrown out because the DAC port number 5555 was not available for instance 2 which was occupying by instance 1. After restarting the SQL Server engine service of instance 2, if checking in the registry, you would see a new DAC port
number has been assigned to the second instance.
Then, the DAC connection to instance 2 succeed this time and executed the above query, it returned the same port number which is same as the one in the registry key and the port number was assigned automatically.
DAC port will not change even SQL Server service is restarted only if the TCP port is available.
More Information
http://msdn.microsoft.com/en-us/library/ms189595.aspx
Applies to
SQL Server 2012
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.