sql server change name

Good Day.

I have a problem upgrading a McAfee ePolicy Orchestrator which uses SQL Server 2008 R2 SP2. McAfee logs indicate that server names from SQL server and from McAfee installer does not match.

It seems that the reason is that machine name was changed after SQL Server was installed.

MSDN instructions for sql server name changing give next commands to solve this problem:

SELECT @@SERVERNAME AS 'Server Name';

sp_dropserver <old_name\instancename>;
GO
sp_addserver <new_name\instancename>, local;
GO

But it didn't work for me, because "SELECT @@SERVERNAME AS 'Server Name'" shows correct (actual) name of sql server. So sp_dropserver says that there is now such instance.

In the same time if I use this commands:

select serverproperty('MachineName')

select serverproperty('ServerName')

I get old (not actual) name.

epo-server is an actual computer name

WIN-VUN5TSKAHG1 is an old name.

May 19th, 2015 5:20am

Basically you cannot rename a named instance of SQL Server.

This has been covered by the previous topic https://social.msdn.microsoft.com/Forums/sqlserver/en-US/63027ca5-b08d-45ee-8896-933dc16e12ef/renaming-a-sql-2008-r2-server?forum=sqlsetupandupgrade.

Essentially for any named instance on the Server you will need to uninstall then reinstall these instances.

Free Windows Admin Tool Kit Click here and download it now
May 19th, 2015 5:25am

after rename ,have restart sql instance ?

http://sqldbpool.com/2008/09/03/how-to-change-sql-server-instance-name/


May 19th, 2015 5:28am

Hello ! Can you try this and post back your results to check if this works for you:

exec sp_dropserver 'WIN-VUN5TSKAHG1\EPOSERVER'
GO
exec sp_addserver 'WIN-VUN5TSKAHG1\EPOSERVER', local
GO
SELECT @@servername, SERVERPROPERTY('ServerName')

Free Windows Admin Tool Kit Click here and download it now
May 19th, 2015 5:28am

https://msdn.microsoft.com/en-us/library/ms143799.aspx?f=255&MSPPError=-2147217396
May 19th, 2015 5:54am

You can not rename instance without uninstalling and re-installing SQL Server. The steps you did and mentioned by other people in this post are for renaming your computer that is running SQL Server database engine.

I don't know why people has answered it in-correctly(may be by quickly searching on Google); but this information is incorrect, you can not rename an instance in SQL Server (there is no such command), you can only rename the server. 

Tony C-UK is right !!!


But you can create another instance -> Move your database etc... - > delete old instance.


 
Free Windows Admin Tool Kit Click here and download it now
May 19th, 2015 6:02am

You can not rename instance without uninstalling and re-installing SQL Server. The steps you did and mentioned by other people in this post are for renaming your computer that is running SQL Server database engine.

I don't know why people has answered it in-correctly(may be by quickly searching on Google); but this information is incorrect, you can not rename an instance in SQL Server (there is no such command), you can only rename the server. 

Tony C-UK is right !!!


But you can create another instance -> Move your database etc... - > delete old instance.


May 19th, 2015 6:29am

Hi, Manu Kapoor.

You understood right - I changed machine name, not instance name.

Old machine name - WIN-VUN5TSKAHG1.

Actual machine name - EPO-SERVER.

Instance name remain unchanged - epo-server.

I use exactly the same MSDN article that you noted - https://msdn.microsoft.com/en-us/library/ms143799.aspx?f=255&MSPPError=-2147217396.

And this command

SELECT @@servername, SERVERPROPERTY('ServerName')

returns

epo-server\eposerver, WIN-VUN5TSKAHG1\eposerver


If I try this command

exec sp_dropserver 'WIN-VUN5TSKAHG1\EPOSERVER'
GO

it returns error - "The server 'WIN-VUN5TSKAHG1\EPOSERVER' does not exist"

Also this is what shows me server properties dialog.



  • Edited by S_Kamil 19 hours 27 minutes ago
Free Windows Admin Tool Kit Click here and download it now
May 19th, 2015 8:22am

Hello Again

Please refer to my post at the top of this topic; you cannot rename a Server for a named instance as the configuration will not detect the change in the Server name.  You will need to uninstall the instance and then reinstall it.

May 19th, 2015 8:29am

Ok, there is a misunderstanding or may be I am thinking like that. Let me try that again,

The process which you have mentioned is changing server(Computer) name.  If you have a default instance on the server that is referenced by the hostname you can rename the "instance" in that manne

There is no way, and I repeat, there is no way to rename instance without uninstall and re-install SQL Server. 


Free Windows Admin Tool Kit Click here and download it now
May 19th, 2015 10:17am

Hi S_Kamil,

What is the output of executing SP_HELPSERVER in SQL Server?

As described in this article, although the @@SERVERNAME function and the SERVERNAME property of SERVERPROPERTY function may return strings with similar formats, the information can be different. The SERVERNAME property automatically reports changes in the network name of the computer.

In contrast, @@SERVERNAME does not report such changes. @@SERVERNAME reports changes made to the local server name using the sp_addserver or sp_dropserver stored procedure.

Thanks,
Lydia Zhang

If you have any feedback on our support, please click here.

May 19th, 2015 11:31pm

I'll try to reinstall SQL Server, but it seems to me that it will not help, because I have one more SQL instance on this server which was installed after machine name changing and it has the same problem - it shows wrong (old) machine name.

Free Windows Admin Tool Kit Click here and download it now
May 20th, 2015 3:01am

check  summary.txt file, located in the following folder and find error .

C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\LOG\

May 20th, 2015 3:23am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics