Sunday, March 25, 2012

Can not create new replication after changing server name

After i changed my computer's name(eg. the original computer name is 'SERVER-1',I has changed it to 'SERVER-2'),I can not create a new replication in SQL Server 2005.The error message :

New Publication Wizard
SQL Server is unable to connect to server 'SERVER-2'.

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, 'SERVER-1'. (Replication.Utilities)

What's wrong?Tongue Tied
Should I reinstall SQL Server 2005?


Hi, microzt,

It's possible to rename machine name with SQL Server 2005 installed and have SQL Server 2005 works correctly with the new machine name, however, there are some extra steps need to be performed to accomplish this besides simply renamed the machine name in OS and it only works when you don't have replication enabled before the server renaming (i.e. no distributor is setup, no publications etc).

You need to update sys.servers system catalog view with the new machine name after you renamed the OS machine name:

This can also be done if you use dedicated Admin connection (sqlcmd -A) to update sys.servers (sqlserver need to be started in single user mode for the update to work, otherwise, you will hit error that system catalog view can not be updated manually)

C:\>sqlcmd -A
1> update sys.servers set name='SERVER-2'
2> go

(1 rows affected)
Warning: System table ID 43 has been updated directly in database ID 1 and cache coherence may not h
ave been maintained. SQL Server should be restarted.
1> exit

After you successfully updated sys.servers (or sysservers), replication can be enabled correctly on the renamed SQL Server instance.

Hope That helps.

Zhiqiang

|||

The other way of change server name in sys.servers catalog view is to use sp_dropserver and sp_addserver, for example:

sp_dropserver @.server='SERVER-1'
sp_addserver @.server='SERVER-2', @.local='LOCAL'

Then restart SQL Server service and replication should work fine.

|||Thank you for your help!
The replication work fine now.Big Smile

No comments:

Post a Comment