Symptoms
When promoting SQL Server to Publisher, or adding it as a Subscriber to the existing Publisher, the operation fails with the following error: An alias cannot be used for replication. Use the name of the SQL Server instance.
Solution
This error is usually caused by one of the following reasons:
-
Incorrect server name. The computer that is running SQL Server has been renamed, or SQL Server has lost its name.
-
Administration Service identifies SQL Server by alias. An alias was used to specify SQL Server when installing the Administration Service.
Incorrect server name
To isolate and resolve this problem, run the following two queries on the SQL Server instance affected by this issue. Copy these queries “as is,” without making any substitutions for the servername parameter:
-
select @@servername
-
select serverproperty('servername')
If select @@servername returns a non-null value that is different from the value returned by the second query, run the following SQL script:
-
exec sp_dropserver '<oldname>', 'droplogins'
-
exec sp_addserver '<newname>', 'local'
In this script, replace:
-
<oldname> with the value returned by select @@servername
-
<newname> with the value returned by select serverproperty('servername')
If select @@servername returns NULL, run the following SQL script:
-
exec sp_addserver '<newname>', 'local'
In this script, replace <newname> with the value returned by select serverproperty('servername').
For these changes to take effect, you must restart SQL Server. You can restart SQL Server by using SQL Server Configuration Manager:
-
In the Console tree, select SQL Server Services.
-
In the Details pane, right-click the SQL Server instance to restart, and then click Restart.
Administration Service identifies SQL Server by alias
The Administration Service must be configured to identify SQL Server by computer name, rather than using a client alias. Otherwise, when attempting to make SQL Server the Publisher or a Subscriber, you encounter the error “An alias cannot be used for replication. Use the name of the SQL Server instance.”
To avoid this problem, you may need to reinstall the Administration Service. When installing the Administration Service, use the following syntax to identify SQL Server:
-
computername — for the default instance
In this syntax, computername is the (short) NetBIOS name of the computer running SQL Server.
-
computername\instancename — for a named instance
In this syntax:
-
computername is the (short) NetBIOS name of the computer running SQL Server.
-
instancename is the name of a SQL Server named instance.
-