or “so you think you’ve got problems!”
We’re currently updating our server infrastructure at National Rural. As an interim measure I’ve got to run an instance of SQL-Server 2005 and SQL-Server 2008 on the same box. Both instances are consumed by web apps and the box has a firewall installed. I need to connect to both instances via SQL-Server management studio but ran into some pretty bizarre gotchas which I’m going to list here for future reference.
Summary
For those that need the quick fix, here’s how I got it running
- Run each SQL-Server instance on its own TCP port.
- Ensure the required ports are configured for TCP connections on the firewall.
- Open port 1433 for UPD connections.
- Ensure the firewall ports are configured to operate using the narrowest scope possible to fulfil your needs.
To configure a SQL Server instance to run on a specific port, open the SQL Server configuration manager, ideally on the local machine that the server instance is running on.
- Select SQL Server Network Configuration.
- Select Protocols for the named instance of the server you wish to configure.
- Double click TCP/IP and select Enabled.
- Set “Listen All” to yes in the Protocol tab.
- On each IP Addresses listing, ensure all IP Entries have empty values for the TCP Dynamic Ports and TCP Port values
- In the “IPAll” section, ensure TCP Dynamic ports is empty (NOT 0!) and the TCP Port value is set to the port number you wish the server instance to listen on.
- Select “Apply” and restart the SQL Server instance in question.
Common Pitfalls and Gotchas
There are a number of connectivity issues you can run into if you’re SQL-Server version is express and developer edition as by default, they are configured out of the box to not accept Remote Server connections, and there are plenty of articles to get round this issue like this one here.
The issues listed below and error messages occur when the server is already configured to allow remote connection but you are still running into issues. If like me, you had a default instance of SQL server running, whatever version, it would have grabbed TCP port 1433 to listen on and all is well with the world. Allowing the firewall to allow TCP Connections for this port number is all you need to do to connect remotely using SQL-Server management studio. I had a 2005 instance running as the default instance on my dev box but then needed to install an instance of 2008 to run side-by-side with it. This instance I named SVR2008 (They don’t pay me for originality!). I could connect to it locally via SQL Server Management Studio and all was well with the world. The problems arose when trying to connect remotely…
Figure 1 above shows my two instances of SQL-Server on the same machine when connected to locally in SQL-Server management studio. Note that the default instance is version 9.0 – a SQL-Server 2005 instance.
When I try to connect remotely to this box now from another machine using SQL-Server management studio, I can see the default instance but not the named instance. This is because, initially, the named instance of SQL-Server will be configured to run on a dynamic port - basically when the SQL-Server instance starts, it grabs a dynamically allocated TCP port to listen on and this port will be different every time the server instance restarts. If that is the case, the firewall will block the connection and SQL-Server management Studio will display the following error.
Cannot connect to servername\instancename. ------------------------------ ADDITIONAL INFORMATION: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.) (Microsoft SQL Server, Error: 10060) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=10060&LinkId=20476
Cannot connect to servername\instancename. ------------------------------ ADDITIONAL INFORMATION: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=-1&LinkId=20476
Like wise if you get this message:
Cannot connect to server\instance ------------------------------ ADDITIONAL INFORMATION: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.) (Microsoft SQL Server, Error: 10060) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=10060&LinkId=20476
Figure 2. Note the version number of the default instance. We’re actually looking at the same db instance in both connections. That’s because the SVR2008 instance is running on port 1433. In this scenario, we can’t actually connect to the actual default instance in this way.
Thank you, it helped me.
ReplyDeleteNice post
ReplyDelete