Results 1 to 12 of 12

Thread: sqlcmd command not found server ?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    517

    sqlcmd command not found server ?

    in LAN I have installed 2 to 3 sql severs but when using sqlcmd -L command I only see 1 server at the location using this command, why does sqlcmd -L command not see other sql sever servers in the network LAN ?

  2. #2
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

    Re: sqlcmd command not found server ?

    Try allowing inbound traffic (UDP and TCP) on C:\Program Files (x86)\Microsoft SQL Server\90\Shared\sqlbrowser.exe in firewall if not already enabled.

    SQL Server instance discovery happens with UDP broadcasts so you get responses from sqlbrowser.exe announcing all instances on a particular machine from machines in local subnet only.

    cheers,
    </wqw>

  3. #3
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,418

    Re: sqlcmd command not found server ?

    From: https://docs.microsoft.com/en-us/sql...l-server-ver15

    -L[c]
    Lists the locally configured server computers, and the names of the server computers that are broadcasting on the network. This parameter cannot be used in combination with other parameters. The maximum number of server computers that can be listed is 3000. If the server list is truncated because of the size of the buffer a warning message is displayed.

    Note

    Because of the nature of broadcasting on networks, sqlcmd may not receive a timely response from all servers. Therefore, the list of servers returned may vary for each invocation of this option.


    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    517

    Re: sqlcmd command not found server ?

    i have read your posts i have tried again and again the command D:\>sqlcmd -L this command does not find sql server in my LAN

  5. #5
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,458

    Re: sqlcmd command not found server ?

    Quote Originally Posted by dong View Post
    i have read your posts i have tried again and again the command D:\>sqlcmd -L this command does not find sql server in my LAN
    Are all the servers on the same network segment? Do any have firewalls that might block traffic? What versions of SQL are you running?

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    517

    Re: sqlcmd command not found server ?

    Quote Originally Posted by PlausiblyDamp View Post
    Are all the servers on the same network segment? Do any have firewalls that might block traffic? What versions of SQL are you running?
    I work as a LAN Lab and install sql server for several machines, right at the machine where sql server is installed I use the command: sqlcmd -L to check if the server is found but this command can't find, this computer i am using sql server 2008 pro and win10 21H1, you see attached image file

    Name:  sql err.jpg
Views: 219
Size:  22.1 KB

    Also this command sqlcmd -L I went to see sql server again, this computer i am using win7 ultimate, do you know why this error ?

    Name:  sql err2.jpg
Views: 259
Size:  19.4 KB
    Last edited by dong; May 11th, 2022 at 09:00 PM.

  7. #7
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,418

    Re: sqlcmd command not found server ?

    The upper is executed in a cmd-window for standard-user,
    the lower has admin-rights?
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    517

    Re: sqlcmd command not found server ?

    Quote Originally Posted by Zvoni View Post
    The upper is executed in a cmd-window for standard-user,
    the lower has admin-rights?
    I execute the cmd window with administrator rights, it gives the above results, is this error due to win10 21H1 ?

  9. #9
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,418

    Re: sqlcmd command not found server ?

    Quote Originally Posted by dong View Post
    I execute the cmd window with administrator rights
    No, you don't (or at least only in the lower screenshot)
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    517

    Re: sqlcmd command not found server ?

    Quote Originally Posted by Zvoni View Post
    No, you don't (or at least only in the lower screenshot)
    What do you think I should do ?

  11. #11
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,418

    Re: sqlcmd command not found server ?

    Quote Originally Posted by dong View Post
    What do you think I should do ?

    On your Win10-Machine, open a CMD with Admin-Rights, and try sqlcmd -L again
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  12. #12
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    5,120

    Re: sqlcmd command not found server ?

    Quote Originally Posted by Zvoni View Post
    On your Win10-Machine, open a CMD with Admin-Rights, and try sqlcmd -L again
    This is not so simple to solve. Apparently there is something wrong with sqlcmd (probably a bug) which is exhibited sporadically. I'm currently unable to make it work on my machine for the life of me, here it is

    Code:
    c:>sqlcmd -L
    
    c:>OSQL.EXE -L
    
    Servers:
        #####
        #####
        #####WIN11
        #####PC
        #####C
        #####ILD
        #####02
        #####V
        #####M
        #####S
        ...
    Enumerating instance using ODBC works (using legacy osql.exe utility) and this method we use in our apps so never experienced the sqlcmd bug (probably .Net providers related).

    This could be an issue with Active Directory registration gone wrong of our local SQL instances too.

    Edit: On second thought SSMS lists instances just fine so it must be an sqlcmd bug as SSMS is a .Net app too unless SSMS falls back to ODBC when .Net enumeration fails or something similar.

    cheers,
    </wqw>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width