简体   繁体   中英

SQL Server 2012 not able to connect to named instance remotely with ssms

I'm running SQL Server 2012 on a Microsoft Windows Server 2012 R2. I am running a named instance called PP . The server authentication is set to "SQL Server and Windows Authentication mode".

When I am logged into the server via Remote Desktop I can log in to the named instance via SSMS just fine using a using a SQL Server username and password. When I try to log into the named instance remotely using the same username and password I get an error as described in this screenshot (my reputation isn't high enough to paste the screenshot directly in my post, please follow the link):

错误消息的屏幕截图

Here are the things I have checked so far:

  1. I can ping the IP Address of the remote server from my local computer and get successful responses.
  2. I have configured the instance of SQL Server to accept remote connections as described in this article .
  3. In SQL Server Configuration Manager on the remote server under the protocols for my named instance I have enabled "Shared Memory", "Named Pipes" and "TCP/IP".
  4. Under "TCP/IP" properties on the remote server in SQL Server Configuration Manager in the "IP Addresses" tab under the "IP2" section I have set the "TCP Dynamic Ports" value to blank. I have tried setting the "TCP Port" value to 1433 and then to 1434 (the difference between a regular instance and a named instance) and going through the rest of the steps below as shown in the screenshot here (these are the values specified in the article I linked to above)
  5. Windows firewall is not running on the remote server, and from what I can see there is not another firewall running on the remote server either.
  6. The SQL Server Browser service on the remote server has been stopped and restarted.
  7. After I have made all of these changes and verified all of these settings the SQL Server service for the named instance on the remote server has been stopped and restarted.

After all of this I am still getting my original error when I try to connect to the named instance of SQL Server on my remote server from my local computer via SSMS. I've been searching high and low and cannot find any additional troubleshooting steps to diagnose this problem. Will someone please point me in the direction of the next steps I should take to fix this? Thanks in advance.

I logged off and then came back the next day to implement the suggestions in @Andrey Nikolov 's answer and for some reason I am able to connect remotely to the named instance now. The settings that ended up working for the "IP2" section of the "TCP/IP" configuration for the named instance are the "TCP Dynamic Ports" value is set to blank and the "TCP port" is set to 1433. I didn't make any other changes. The rest of the configuration is as I noted in my OP. I have sysadmin access to this server but I'm not the actual administrator so I guess it's possible that the actual administrator might have changed something else between when I logged off and then logged back on but I don't know what that might be. Thanks to @Andrey Nikolov for your input.

EDIT: This issue came back in full force a few days later for no reason that I could determine. After a long search I found a very informative MS Doc that goes through the whole troubleshooting process for this in depth, hope this helps someone else confronted with this. Here's the link:

https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/troubleshoot-connecting-to-the-sql-server-database-engine?view=sql-server-2017

It says it's for SQL Server 2017 but I was able to follow it to fix my SQL Server 2012 issue. For my situation it turns out that because I had 2 separate instances of MS SQL on my server the initial instance was using all of the default settings as described elsewhere and my instance I was trying to connect to was using a completely different port. Using this Doc I was able to find out what port my instance is using and specify that in the "Server name" box of SSMS when I tried to connect. Now it works like a charm.

I think your named instance TCP/IP isn't configured properly. In case you connect locally it does not connect using TCP/IP, but using shared memory. You set your instance to listen on port 1434, but this port is used by SQL Browser service and most likely the SQL Server engine service can't open the port (you can confirm that by finding the error in the logs). To make it work you should set IP2 -> TCP Dynamic Ports to be 0 and clear IP2 -> TCP Port. Configured like this, your named instance will use dynamic ports. If you want to configure it to use specific port, replace 1434 in IP2 -> TCP Port with available port number.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM