SQL Server Browser & DAC

  • Nakul Vachhrajani

    SSChampion

    Points: 10151

    Comments posted to this topic are about the item SQL Server Browser & DAC

    Thanks & Regards,
    Nakul Vachhrajani.
    http://nakulvachhrajani.com
    Be courteous. Drive responsibly.

    Follow me on
    Twitter: @sqltwins

  • Koen Verbeeck

    SSC Guru

    Points: 258907

    Nice question.

    The MSDN article Using a Dedicated Administrator Connection says the following:

    SQL Server listens for the DAC on TCP port 1434 if available or a TCP port dynamically assigned upon Database Engine startup.

    and

    The DAC port is assigned dynamically by SQL Server during startup.

    Which makes me assume that the DAC port is another port than the SQL Server port? Or am I reading this wrong?

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Nakul Vachhrajani

    SSChampion

    Points: 10151

    Koen Verbeeck (6/12/2012)


    Nice question.

    The MSDN article Using a Dedicated Administrator Connection says the following:

    SQL Server listens for the DAC on TCP port 1434 if available or a TCP port dynamically assigned upon Database Engine startup.

    and

    The DAC port is assigned dynamically by SQL Server during startup.

    Which makes me assume that the DAC port is another port than the SQL Server port? Or am I reading this wrong?

    You are correct. The DAC port is different than the SQL Server port. (Default values for SQL Server port = 1433, whereas that for the DAC is 1434). However, the SQL Server instance determines the DAC port at startup, and it can be different from 1434 even for a default installation.

    Thanks & Regards,
    Nakul Vachhrajani.
    http://nakulvachhrajani.com
    Be courteous. Drive responsibly.

    Follow me on
    Twitter: @sqltwins

  • Koen Verbeeck

    SSC Guru

    Points: 258907

    So it can be different, but there is no indication that it will be?

    So there is a chance DAC will succeed for the default instance as it tries port 1434 first before consulting the SQL Server Browser?

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Nakul Vachhrajani

    SSChampion

    Points: 10151

    Koen Verbeeck (6/13/2012)


    So it can be different, but there is no indication that it will be?

    So there is a chance DAC will succeed for the default instance as it tries port 1434 first before consulting the SQL Server Browser?

    No, because the SQL Server instance only application that knows what the DAC port is. Because hiding the instance through the browser (or turning the browser off) will result in the client tools not being able to connect to the SQL Server, the DAC port cannot be fetched. Because the DAC port cannot be fetched, it cannot be connected to.

    It's more like a chain reaction. Shutting down the Browser service causes the instance on a non-default port to be non-discoverable and therefore the DAC cannot be used for administrator connections.

    Great line of thought, by the way. In fact, that was what prompted me to write up the QotD in the first place.

    Thanks & Regards,
    Nakul Vachhrajani.
    http://nakulvachhrajani.com
    Be courteous. Drive responsibly.

    Follow me on
    Twitter: @sqltwins

  • heymiky

    SSCarpal Tunnel

    Points: 4795

    Couldn't the administrator initiate the DAC with a specific port number?

    Edit: agree with the earlier comments from Koen good question

  • Koen Verbeeck

    SSC Guru

    Points: 258907

    SQLDBA360 (6/13/2012)


    Couldn't the administrator initiate the DAC with a specific port number?

    Edit: agree with the earlier comments from Koen good question

    Good remark. The admin could have specified the non-default port and the connection would have succeeded. The question doesn't specify an explicit statement, so it's up to us to decide how good the admin is in his job 😀

    If the question stated this as the statement the admin executed, the question would have been 100% correct as no port is specified:

    sqlcmd -S myServer -U sa -P myPassword –A

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • heymiky

    SSCarpal Tunnel

    Points: 4795

    Koen Verbeeck (6/13/2012)


    SQLDBA360 (6/13/2012)


    Couldn't the administrator initiate the DAC with a specific port number?

    Edit: agree with the earlier comments from Koen good question

    Good remark. The admin could have specified the non-default port and the connection would have succeeded. The question doesn't specify an explicit statement, so it's up to us to decide how good the admin is in his job 😀

    If the question stated this as the statement the admin executed, the question would have been 100% correct as no port is specified:

    sqlcmd -S myServer -U sa -P myPassword –A

    Also need to remember by default that you need to use the DAC on the local machine, remote connections are not enabled

  • This was removed by the editor as SPAM

  • ako58

    Hall of Fame

    Points: 3205

    The DAC port is assigned dynamically by SQL Server during startup. When connecting to the default instance, the DAC avoids using a SQL Server Resolution Protocol (SSRP) request to the SQL Server Browser Service when connecting. It first connects over TCP port 1434. If that fails, it makes an SSRP call to get the port. If SQL Server Browser is not listening for SSRP requests, the connection request returns an error. Refer to the error log to find the port number DAC is listening on. If SQL Server is configured to accept remote administration connections, the DAC must be initiated with an explicit port number:

    sqlcmd –Stcp:<server>,<port>

    The SQL Server error log lists the port number for the DAC, which is 1434 by default. If SQL Server is configured to accept local DAC connections only, connect using the loopback adapter using the following command:

    sqlcmd –S127.0.0.1,1434

  • Koen Verbeeck

    SSC Guru

    Points: 258907

    ako58 (6/13/2012)


    The DAC port is assigned dynamically by SQL Server during startup. When connecting to the default instance, the DAC avoids using a SQL Server Resolution Protocol (SSRP) request to the SQL Server Browser Service when connecting. It first connects over TCP port 1434. If that fails, it makes an SSRP call to get the port. If SQL Server Browser is not listening for SSRP requests, the connection request returns an error. Refer to the error log to find the port number DAC is listening on. If SQL Server is configured to accept remote administration connections, the DAC must be initiated with an explicit port number:

    sqlcmd –Stcp:<server>,<port>

    The SQL Server error log lists the port number for the DAC, which is 1434 by default. If SQL Server is configured to accept local DAC connections only, connect using the loopback adapter using the following command:

    sqlcmd –S127.0.0.1,1434

    So your copy pasting skills are still intact. What is the point you are trying to make?

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • adb2303

    SSCertifiable

    Points: 7586

    Koen Verbeeck (6/13/2012)


    ako58 (6/13/2012)


    The DAC port is assigned dynamically by SQL Server during startup. When connecting to the default instance, the DAC avoids using a SQL Server Resolution Protocol (SSRP) request to the SQL Server Browser Service when connecting. It first connects over TCP port 1434. If that fails, it makes an SSRP call to get the port. If SQL Server Browser is not listening for SSRP requests, the connection request returns an error. Refer to the error log to find the port number DAC is listening on. If SQL Server is configured to accept remote administration connections, the DAC must be initiated with an explicit port number:

    sqlcmd –Stcp:<server>,<port>

    The SQL Server error log lists the port number for the DAC, which is 1434 by default. If SQL Server is configured to accept local DAC connections only, connect using the loopback adapter using the following command:

    sqlcmd –S127.0.0.1,1434

    So your copy pasting skills are still intact. What is the point you are trying to make?

    +1

  • TomThomson

    SSC Guru

    Points: 104763

    Fair question, but it was one of those times when I decided I had to guess what the question meant. Obviously if I know what ports the instances use for their DACs I can connect to them using sqlcmd. Equally obviously I can discover the ports by looking at the SQL Server log for each instance, if I have access and know where it is. I'm one of those people who always has access to the SQL Server log directory for ech instance, and who decides where that directory will be.

    But of course that can't be done by a DBA who insists on using SSMS.

    I was feeling contrary this morning, so I picked "can't be done", although I know perfectly well that it can, and got my point.

    Maybe the author of the question thought you had to have Service Broker to connect through DAC, rather than assuming one of those arrogant developer-hating sql-hating know-nothing DBAs? Well, I have Service Broker disabled and have connected using DAC both to default and to non-default instances (just to make sure I could safely disable service broker).

    Tom

  • Koen Verbeeck

    SSC Guru

    Points: 258907

    L' Eomot Inversé (6/13/2012)


    ..., rather than assuming one of those arrogant developer-hating sql-hating know-nothing DBAs?

    Hmmm, do I sense some frustration? 😀

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • TomThomson

    SSC Guru

    Points: 104763

    Koen Verbeeck (6/13/2012)


    ako58 (6/13/2012)


    The DAC port is assigned dynamically by SQL Server during startup. When connecting to the default instance, the DAC avoids using a SQL Server Resolution Protocol (SSRP) request to the SQL Server Browser Service when connecting. It first connects over TCP port 1434. If that fails, it makes an SSRP call to get the port. If SQL Server Browser is not listening for SSRP requests, the connection request returns an error. Refer to the error log to find the port number DAC is listening on. If SQL Server is configured to accept remote administration connections, the DAC must be initiated with an explicit port number:

    sqlcmd –Stcp:<server>,<port>

    The SQL Server error log lists the port number for the DAC, which is 1434 by default. If SQL Server is configured to accept local DAC connections only, connect using the loopback adapter using the following command:

    sqlcmd –S127.0.0.1,1434

    So your copy pasting skills are still intact. What is the point you are trying to make?

    I suspect the point he is attempting to make is that a competent administrator will succede, not fail, because if he knows the port numbers he can connect using sqlcmd. Service Broker is just one option for knowing the port numbers, there are others.

    However, the second half of the passage he quotes is utterly irrelevant since the question specifies that the port concerned is not used by SQL. A port is chosen (and logged) by the default instance as well as by the others. It's very poor practise indeed to qote a large chunk of BoL page with no indication at all that it is a quotation and no indication where the quotation comes from.

    Incidentally, I think the choice of a Service Broker page as the reference for this question is a bad one; when that page says you can't use DAC it actually means that you can't use DAC if you use SB to get the port numbers. A reference to a page about DAC would have been better.

    Tom

Viewing 15 posts - 1 through 15 (of 35 total)

You must be logged in to reply to this topic. Login to reply