Unable to access an instance of SQL Server 2008 R2 remotely

六眼飞鱼酱① 提交于 2019-11-27 07:57:16

问题


A very mysterious problem coming up :P

I have a server configured with a static IP. I have installed SQL Server 2008 R2 with additional instance (ITAPP). Now When I use the IP to access the SQL Server following things happens:

Client Machine:

sqlcmd -S XXX.XXX.XXX.XXX -U sa -P mypass

Connected Successfully....

But when I use:

sqlcmd -S XXX.XXX.XXX.XXX\ITAPP -U sa -P mypass

HResult 0xFFFFFFFF, Level 16, State 1 SQL Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].

Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establishing a connection to the server.

When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections..

Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.

Even on the same machine (where the SQL Server is installed) using SQL Server Management Studio. I have put off my firewall on both machines, even allow all the protocols for ITAPP (Shared Memory, Named Pipes, TCP/IP), also set Allow Remote connection to true.

One thing more when I use 127.0.0.1\SQLITRAX to connect on server machine it connects Immediately.

Please help me out from this mess :)


回答1:


maybe it's because it's a named instance on a remote server.
Named instance don't use the SQL Server standard Tcp-port 1433, only the default (unnamed) instance use the 1433 port.
Any other "named" instance simply listen on another port.
So you should check in the SQL-Server configurator, on which TCP port is listening, and then tell the client to connect to this port.
Say that your named instance is listening to 12345 port, then the client should connect using the following command

sqlcmd -S XXX.XXX.XXX.XXX,12345 -U sa -P mypass

when you specify the TCP port, then you don't need the name of the instance.
In my understanding the name of the instance is a way for SQL Server services to find the TCP port that this named instance is listening on.
But for this to work your client need to be able to access those other services that resolve the instance name of SQL Server (maybe it's the Sql server Agent / SQL Server browser, but I'm not sure)

Update
Here is a screenshot that show where to set the TPC port for a SQL Server named instance.

so, on which TCP port is your named instance of SQL Server listening?




回答2:


The SQL Server Browser service needs to be accessible to be able to connect to named instances.

See this article for more info on what it does and which ports to open on your firewall

This technet article provides a handy script to open up all required ports



来源:https://stackoverflow.com/questions/9478957/unable-to-access-an-instance-of-sql-server-2008-r2-remotely

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!