Pages

Wednesday, June 1, 2022

1.Dedicated Administrator Connection (DAC)

 

1.1         DAC

-          Dedicated Administrator Connection (DAC) – ADMIN: keyword prefix with our id.  If you use SQLCMD, you can use the ADMIN: prefix or use the -A switch

o   sys.endpoints  / sys.tcp_endpoints

o   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, I can write a query such as this:

§  One job can monitor daily basis who connected as DAC will be useful

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