Sql-server – SQL server moved, now can’t use as linked server

linked-serversql server

So I have a SQL server database that was controlled by an outside vendor. It is hosted remotely. Then he needed to move the server to a new host. Now, I'm able to connect to the server manually from SSMS and I can add it as a linked server, but I can't USE it as a linked server, or even browse the servers catalogs.

My instance is 2000, and I assume the remote server is 2008 or 2008 R2.

When I try to use the server (try to update a stored proc that points to the linked server) I get the following error:

Trying to browse the linked server's catalogs from SSMS throws this:

Failed to retrieve data for this request.
(Microsoft.SqlServer.Management.Sdk.Sfc)

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or
access denied. (Microsoft SQL Server, Error: 17)

A friend suggested I run Exec sys.sp_change_users_login 'Report', but it turns up no orphaned records, and anyway, I can login using the credentials, so that doesn't look like the problem.

EDIT: Can't connect at all with IP, but hostname connects then gives above error. HUH?

Best Answer

I'm assuming that you are using a "sql server login" for the vendor's server, and you are using that when creating the linked server.

When you use a linked server, a query running on your server connects to the vendor's server. If a firewall blocks your local server from connecting to the vendor's server, your connection attempt will fail.

If connecting directly from your workstation to the vendor's server you go through a different firewall or no firewall, then the connection may succeed.

This scenario matches the behavior you describe. My usual tests would be: 1. Can I ping from my server to the vendor's server? Both by IP and by hostname? ping usually gets through firewalls. 2. Can I connect using SSMS from my server (using an RDP session) to the vendor's server? Both by IP and by hostname?

If you can ping OK but not connect with SSMS, this usually indicates that the ports for SQL Server probably need to be opened on the firewall.

In short, check all of the firewalls involved. That would include any software firewall on your server or on the vendor's server, or any hardware firewall between them.

In these situations, ping and traceroute are your friends. Ping and traceroute may help you locate the IP of the router that doesn't send your packets on to the vendor's server.