You are hereFixing the "SQL Server replication requires the actual server name to make a connection to the server." Error
Fixing the "SQL Server replication requires the actual server name to make a connection to the server." Error
Recently, I ran into a whole set of problems setting up a client's SQL 2005 database mirroring solution. I had successfully setup database mirroring numerous times and I couldn't figure out why I was having such a hard time with this instance. I loaded up the Database Mirroring Monitor, tried selecting my Principal server in the mirroring solution and I received the following error -
I was confident that the name I was entering was in fact the current machine name. I decided to run the following query against the master database on the SQL server in question -
To my surprise the name listed didn't match the computer name of the SQL Server! At this point, I realized that this server had a different computer name when SQL was installed and the server had been renamed since then. Fixing this problem isn't a trivial renaming of the SQL instance unfortunately. To fix this issue you need to run the following stored procedures -
GO
sp_addserver 'current_computer_name', 'local'
At this point, if you re-run the SELECT @@SERVERNAME query, you will get a NULL value for the server name even after a restarting of the SQL Service. Just restart the SQLSERVER service and when you re-run the query the new name will now appear.
Discussed this with regards to replication several months ago. Short answer: this will work in a pinch, but you _will_ see odd stuff occur. Doing the drop/add is not panacea. About to go rebuild a box because they renamed it without telling me.
Just wondering if you knew of a much safer alternative since rebuilding servers isn't going to be a viable solution for many.
Thanks for posting!
Thank you very much.
If i am going to run this procedure,Is there any data lose in my actual server?
Reg
Akst
Since each environment is different, it would be hard for me to say if any data loss would occur and, if so, how much.
However, with my anecdotal evidence, I didn't lose any data at all since no procedure, process or application was actually even using the old database name.
thanks