HiveBrain v1.2.0
Get Started
← Back to all entries
debugsqlMinor

Replication error after server name change

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
aftererrorreplicationnameserverchange

Problem

I have changed the computer name of the server where SQL Server 2008 R2 is installed.

  • Old name was WIN-OUJEKRMGXXX



  • New server name is KASURDYYY



When I try to configure replication, the following error occurs:


SQL Server Replication requires actual server name to make a connection to the server ... Specify the actual server name, WIN-OUJEKRMGXXX

I updated the server name in SQL Server in order to try to resolve the issue. I ran the following queries:

execute sp_dropserver 'WIN-OUJEKRMGXXX';
execute sp_addserver 'KASURDYYY', 'local';


...but the same error still occurs. I checked the server name :

select @@SERVERNAME -- returns WIN-OUJEKRMGXXX
select SERVERPROPERTY('SERVERNAME') -- returns KASURDYYY

Solution

sp_dropserver 'real-server-name' was giving an error about remote logins:


There are still remote logins or linked logins for the server ...

Therefore, I executed the following query:

execute sp_dropremotelogin old_physical_server_name;


...but this gave the following error because of replication:


There is no remote user '(null)' mapped to local user '(null)' from the remote server ...

Then I executed:

execute sp_removedbreplication 'database-name-on-which-publication-exist';
execute sp_dropdistributiondb 'distribution-database-name';


...still the same error. Finally I tried:

execute sp_dropdistributor @no_checks = 1, @ignore_distributor = 1;
execute sp_dropserver 'real-server-name';
execute sp_addserver 'nwe-server', 'local';


This resolved the issue.

Code Snippets

execute sp_dropremotelogin old_physical_server_name;
execute sp_removedbreplication 'database-name-on-which-publication-exist';
execute sp_dropdistributiondb 'distribution-database-name';
execute sp_dropdistributor @no_checks = 1, @ignore_distributor = 1;
execute sp_dropserver 'real-server-name';
execute sp_addserver 'nwe-server', 'local';

Context

StackExchange Database Administrators Q#90884, answer score: 3

Revisions (0)

No revisions yet.