I am trying to configure the distribution of SQL Server (2016). This is an Azure SQL VM. However, when doing so I get the following error:
TITLE: Configure Distribution Wizard
------------------------------
SQL Server is unable to connect to server 'COMPANY-SQL'.
SQL Server replication requires the actual server name to make a connection to the server. Specify the actual server name, ''. (Replication.Utilities)
(note it is not actually COMPANY-SQL but a similar naming format). I have tried, as suggested in many posts to sp_dropserver and sp_addserver. This successfully creates ##SERVERNAME set to company-sql-2 which is the name of both my Azure resource (not sure where COMPANY-SQL originates). I'm lost as to how to connect here despite already being connected to the database & why the error says the actual server name is simply ''.
SQL Server is unable to connect to server 'COMPANY-SQL'.
SQL Server replication requires the actual server name to make a connection to the server. Specify the actual server name, ''. (Replication.Utilities)
SERVERPROPERTY: The Windows server and instance name, which together make up the specific server instance, are provided by the ServerName attribute.
##SERVERNAME: The name of the local server as it is set up right now is provided by ##SERVERNAME.
Run the following commands together and you will get two different names.
SELECT SERVERPROPERTY(N'servername')
SELECT ##SERVERNAME
then change the server name by dropping the name got by ##SERVERNAME command with sp_dropserver procedure and set name got by SERVERPROPERTY command with sp_addserver procedure then Restart the SQL Server Service.
Related
Installed SSMS 2017 version. When I launch it first time, it asks for server name to connect to. I installed SQL server 2014 already. But I don't know the name of the server. I tried giving server name as "local". But it wouldn't accept. It says "Cannot connect to to local" Error: 53
Since I installed SQL server on my local machine, "local" should be acceptable name as a server to connect to from SSMS.
server name?
.
localhost
127.0.0.1
Any of these will connect to sql server running on your local machine.
If you installed sql as a named instance, then .\myinstance, localhost\myinstance, etc
You can use (.), or local or localhost.
If you used named instance, follow the next:-
Use Browse for more, for getting the accurate server name as next screen shots;-
and under Database Engine, you will get the accurate server name
If you have Db connection you can use this command
select ##servername + '\' + ##servicename
you can also check SQL Server Configuration Manager.
In Configuration Manager you need to find SQL Server Service. When you Double click the SQL Service and navigate through Service Tab, you need to see SQL Server Name
It should be localhost, just setup my SQL server last month and had to find this information aswell.
You need connect using . only.
connect Local instance using .
I use SQL Server Management Studio. I want to connect the local server. But, I am missing the local server name.
I entered local, localhost and ., but it couldn't connect.
How can I get the local server name in SQL Server Management Studio?
Please let me know which path you can check.
A network related or installer-related error occurred while establishing a connection to SQL Server. The server can not be found or inaccessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.
Other way to find is , drop down the server name box, at the end there is an option called . click it and there database engine , expand the database engine and u ll find the list of sql servers in your pc/network. Click the required one and u ll get servername .
Just write SELECT ##servername and run in your SQL Server Management Studio.
It will return the name of the current servername you are connected with.
The alias (local) (yes, including the parentheses) should allow you to connect to your local instance, but please supply the actual error that's occurring, in case the hostname isn't the actual problem.
From your question I assume that you're logged on to the machine that is running SQL Server. If so you can open SQL Server Configuration Manager to confirm the name of your SQL Instance. SQL Server Configuration Manager shows all of the SQL Services Running. Look for the one called SQL Server (instanceName) and note the instance name. You can then access the server from SQL Server Management Studio using either (local)\instanceName, .\instanceName, or servername\instanceName.
I am facing server name problem in SQL Server 2012. When I click on configure distribution I get an error:
Unable to connect to server. Specify the actual server name.
I changed my server name and restarted the services but unable to connect through new server name.
Basically, I am doing this on local domain based server.
Kindly suggest a suitable solutions.
After you rename a SQL Server machine, you will also need to rename the SQL Server instance itself using:
sp_dropserver <old_name>;
GO
sp_addserver <new_name>, local;
GO
For more information, see Microsoft's article called Rename a Computer that Hosts a Stand-Alone Instance of SQL Server.
I think what your probably finding is that changing the Windows server hostname doesn't actually change the original SQL Server instance name which still gets used for certain services. Run the following on the DB engine:
SELECT ##SERVERNAME
You'll probably find a different value to what your expecting from the OS.
There isn't really a solution to this that I'm aware of without re-installing SQL Server on the newly named box.
Also be careful with names that exceed to the 15 character NetBIOS limit.
I already have SQL Server Pro 2008. I just installed SQL Server 2008 R2 with instance name sqlserverr2.
Now, I want to change the name of the service also. I could change name of the server.
select ##SERVICENAME, ##SERVERNAME
It outputs -
SQLEXPRESSR2, HOME\SQLEXPRESS
Means service name is not changed. Only servername changed. Even I cannot use .\sqlexpress to connect from Management Studio.
Be very, very careful here!
You are asking to change the name of the Server Service that is controlled by the Service Applet in Windows - Correct?
This would have to be done on a Registry Hack/Tweak.. Problem is that you my have downstream issues if you change it..
Any of the commands preceed with ## are internal to SQL Server.
You can control many of the Windows Service Options here - http://ss64.com/nt/sc.html
Please be careful..
HTH,
Kent
Assumption here is that you migrated or you used an image and renamed the image to the server. Your DNS name is now different than it was when you first installed SQL Server - Example, you rename your server in the Active Directory. You get a error for your server name in a job somewhere. Error might be server_name is invalid.
-- Query to check login
SELECT ##SERVICENAME, ##SERVERNAME
sp_dropserver '<oldservername>'
GO
sp_addserver '<newservername>', local;
GO
--RESTART THE SERVER
--check again
To change an instance name, just add a slash and the instance name to the above.
Don't forget to restart the sql server service.
SELECT ##SERVERNAME
After I renamed my PC, I couldn't create new paublications, for database replication in SQL Server 2005.
I receive un error "SQL Server replication requires the actual server name to make connection to the server."
When I returned my old PC name, the problem solved. How could I make use of replication after renaming the PC?
The SQL Service itself still thinks it has the old server name, and since it has the habit of referring to itself in the third person, this causes problems when the underlying server name has changed. You need to take the following steps to correct it:
Run "Select ##ServerName" to verify the servername - it should be the old name.
sp_dropserver ‘OLDSERVERNAME’
sp_addserver ‘NEWSERVERNAME’, local
Restart both the SQL Service and the Agent Service
Run step 1 again to confirm that the server name is now correct