I get the following message when I want to create a new publication or Subscription.
"Sql Server replication requires the actual server name to make a connection to the server. Connections through a server alias, IP address or any other alternate name are not supported. specify the actual server name"
Does anyone know what should I do?
Pre-requisitesAt least one database should have an article and must possess Primary Key; a basic rule that every article should have a Primary Key is considered as best candidate for Transactional SQL Replication. The primary key is used to maintain uniqueness of records.
SQL Server replication is a technology for copying and distributing data and database objects from one database to another and then synchronizing between databases to maintain consistency and integrity of the data. In most cases, replication is a process of reproducing the data at the desired targets.
Handling BULK INSERT, or UPDATE, or DELETE efficiently can help resolve the Replication issues. Pro Tip: To INSERT huge data into a Replicated table in Publisher database, use the IMPORT/EXPORT wizard in SSMS, as it will insert records in batches of 10000 or based upon the record size faster calculated by SQL Server.
Using SQL Server Management Studio (SSMS)On the Publication Databases page of the Publisher Properties - <Publisher> dialog box, select the Transactional and/or Merge check box for each database you want to replicate. Select Transactional to enable the database for snapshot replication. Select OK.
I found the solution in the following link http://www.cryer.co.uk/brian/sqlserver/replication_requires_actual_server_name.htm
thankful to Brian Cryer for his useful site
Quoting from the link to avoid link rot:
Cause:
This error has been observed on a server that had been renamed after the original installation of SQL Server, and where the SQL Server configuration function @@SERVERNAME
still returned the original name of the server. This can be confirmed by:
select @@SERVERNAME
go
This should return the name of the server. If it does not then follow the procedure below to correct it.
Remedy:
To resolve the problem the server name needs to be updated. Use the following:
sp_addserver 'real-server-name', LOCAL
if this gives an error complaining that the name already exists then use the following sequence:
sp_dropserver 'real-server-name'
go
sp_addserver 'real-server-name', LOCAL
go
If instead the error reported is 'There is already a local server.' then use the following sequence:
sp_dropserver old-server-name
go
sp_addserver real-server-name, LOCAL
go
Where the "old-server-name" is the name contained in the body of the original error.
Stop and restart SQL Server.
There is another solution to this problem, which does not require **sp_dropserver**
, **sp_addserver**
or server restarting.
Steps:
Test. Run Management Studio on the same machine and try to connect to the server (specify alias as server name).
(Optional) Repeat 2 - 7 for all client machines where Management Studio will be used for replication setup.
That's all!
Short answer: check if you're connecting with the wrong network alias through SSMS
For example, your server might accessible as both:
When a replication publication/subscription is created it gets associated with the name used to connect to the server at the time, if you connect using the different alias or fully qualified name it gives you the error stated on the question.
Details: I just ran into this, the answers about changing the @@servername helped me understand the issue, but I didn't have to do that.
Consider this:
The sql server box was setup as {my_system_name}.local.domain
In our network we have a network alias such that {my_system_alias} allows us to reach the server and avoiding having to enter the fully qualified domain name (FQDN).
Sql Server was installed and also a local replication publication was set up while being connected using the {my_system_alias} name.
I then connected to the server using SSMS specifying the FQDN, if I right click on properties for this existing Replication -> Local Publication I get the error: "Sql Server replication requires the actual server name".
All I had to do: reconnect to the server in SSMS using the alias (or the other way around) and it will allow me to see the Replication Publication details.
PS: Phill's comment in another answer is also an alternative, making a hosts file entry that matches the name you need to use for the connection.
You need to change the server name in there like a machine name.
@@servername
sp_dropserver 'old_name'
sp_addserver 'new_name', 'local'
Sharing my fix, after trying EVERYTHING else I could find to resolve this issue. I was attempting to setup replication on SQL Server 2017 using SSMS 18.2 (the latest version at the time of this post). When I setup the distributor, everything went OK, but then when I went into distributor properties and checked the box to 'Create Queue Reader Agent', I would get the famous "SQL Server replication requires the actual server name to make a connection to the server. Specify the actual server name, ''. (Replication.Utilities)" issue.
After many days, I tried a different version of SSMS. Installing SSMS 17.9.1 and re-attempting everything worked properly. Hopefully this helps someone else.
A different solution is to use the additional parameters el SQL Server management Studio to connect to that database.
To do so, when connecting, the server name will be the one that you get by consulting via @@servername (or the one that the error message prompts you), and then select the "Options >>" button
Then, in the Additional Connection Parameters tab, you can add the current name of the database
Regards,
If you're working on a hosted environment where the server names are weird strings that may actually be being shared with other servers... e.g. WIN-II7VS-100. The solution I've found thanks to @ZachSmith is to edit the hosts file on the server you want to connect from and set it to the static IP of the SQL server you wish to connect to.
if this problem on replication machine must run below code on replication machine 1- first find real name server
select @@SERVERNAME
go
2- drop real server name with code below
sp_dropserver 'real-server-name'
go
3-add real server name with code below
sp_addserver 'real-server-name', LOCAL
go
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With