How to rename a SQL Server 2008 instance?

Solution 1:

I don't think it is possible to rename without installing.

There are traces left to the name in a few internal databases such as replication and you may find errors later on.

If you can, unless you have more than one instance, you are best off reinstalling and then importing all your databases again.

Solution 2:

I know that this script is ubiquitous across the ‘net, but whenever I google for it I come up with elaborate stored proc’s that are overkill for my needs – so here are the commands necessary to rename a SQL Server instance, for posterity:

  • Get the current name of the SQL Server instance for later comparison.
    SELECT @@servername
  • Remove server from the list of known remote and linked servers on the local instance of SQL Server.
    EXEC master.dbo.sp_dropserver ‘[SERVER NAME]‘
  • Define the name of the local instance of SQL Server.
    EXEC master.dbo.sp_addserver ‘[NEW SERVER NAME]‘, ‘local’
  • Get the new name of the SQL Server instance for comparison. SELECT @@servername

And a few notes relating to their usage:
sp_dropserver:

  1. This stored procedure can remove both remote and linked servers;
  2. Using the droplogins parameter indicates that related remote and linked server logins for [SERVER NAME] must also be removed.

sp_addserver:

  1. To define a linked server, use sp_addlinkedserver (as this functionality will be depreciated in version above SQL Server 2005);
  2. sp_addserver cannot be used inside a user-defined transaction.

I would also recommend the following when renaming a SQL Server:
If you are performing this task as part of a machine rename, rename the machine first then rename the SQL Server. Once you have renamed the SQL Server, do a full restart of SQLServer, including any dependent service.

I got this information from the link below:

https://web.archive.org/web/20141116031942/http://modhul.com/2008/01/15/renaming-a-sql-server-instance/