SQL Server replication requires an actual server name to connect to the servers, please specify the actual server name "go

Source: Internet
Author: User
Tags aliases

? SQL Server replication requires an actual server name to connect to the server, please specify the actual server name ? 2014-06-12 12:01:10

recently in the study advanced replication technology for SQL Server , there is a small problem, that is, when using the local SQL Server to connect to the server's database, when viewing the replication feature of the publisher, the connection is not connected, pop up an error message framework, as follows:

The original in their local instance is all normal operation, the remote server when the problem occurs, and later found on the internet, there are two cases:
One, its own computer name has been modified, resulting in inconsistent with the server.
Second, when connecting the remote server directly with the IP address, if you do not use the alias to connect, the above error box will appear.

In the first case:
Execute the following statement inside SQL Server:

Use master

Go

[email protected]@servername;

Select?serverproperty (' servername ')

Use the above statement to query the name of the server and the name of the actual computer, if the two are inconsistent, you need to modify.
Inconsistent, execute the following statement:

sp_ Dropserver ' old_server_name ' go sp_addserver ' Current_computer_name ', ' local '

When you are finished modifying, restart the SQL Server service.

In the second case:
Add an alias to the remote server and use an alias instead of an IP address to connect to the remote database server. (I'm using SQL SERVER2012 myself)
Open the Configuration Manager for SQL SERVER2012 and navigate to the Aliases service option, as follows:


Right-click---> New alias:

The "Alias" here uses the server name, which is the name queried by the SQL statement above: (select? ). @ @servername;), the IP address is the access address for this server.


Then add the corresponding IP address and alias to the hosts in this machine:
C:\Windows\System32\drivers\etc

Hosts

IP address????? ? Alias

For example:

172.168.1.15?? Sniper

Finish modifying, save.


When you are finished modifying the SQL Server service, restart it.

When connecting again, use "Alias" instead of IP address to connect to the server:


At this point, the problem solved!

(later in some tests, I found that no aliases, as long as the specific name of the server can be connected)

SQL Server replication requires an actual server name to connect to the servers, please specify the actual server name "go

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.