Renaming SQL Server to match your new computer name

Renaming SQL Server to match your new computer name

Renaming SQL Server to match your new computer name

IMPORTANT: 

**Please note this is not something covered under the Software Connection support plan. This is an external SQL server support issue that you may need to contact an outside PC technician to help you resolve. Our recommendation is to never change your host computers name after you have installed an SQL server instance as renaming the computer when running an SQL instance will always cause connections to the database to fail as they are all looking for the old name. If you require our support for an issue caused by renaming a host computer, we will advise you to name the computer back to the name it was previously and reboot to solve the issue. Again, the below is if you must keep the new name and want to attempt renaming the SQL server name on your own or with an outside PC technician’s help. 


 

From Microsoft: 

 

When you change the name of the computer that is running SQL Server, the new name is recognized during SQL Server startup. You do not have to run Setup again to reset the computer name. Instead, use the following steps to update system metadata that is stored in sys.servers and reported by the system function @@SERVERNAME. Update system metadata to reflect computer name changes for remote connections and applications that use @@SERVERNAME, or that query the server name from sys.servers.

The following steps cannot be used to rename an instance of SQL Server. They can be used only to rename the part of the instance name that corresponds to the computer name. For example, you can change a computer named MB1 that hosts an instance of SQL Server named Instance1 to another name, such as MB2. However, the instance part of the name, Instance1, will remain unchanged. In this example, the \\ComputerName\InstanceName would be changed from \\MB1\Instance1 to \\MB2\Instance1.



You can connect to SQL Server by using the new computer name after you have restarted SQL Server. To ensure that @@SERVERNAME returns the updated name of the local server instance, you should manually run the following procedure that applies to your scenario. The procedure you use depends on whether you are updating a computer that hosts a default or named instance of SQL Server.

Rename a computer that hosts a stand-alone instance of SQL Server

  • For a renamed computer that hosts a default instance of SQL Server, like MSSQLSERVER run the following procedures:

EXEC sp_dropserver '<old_name>';  GO   EXEC sp_addserver '<new_name>', local;  GO  

Restart the instance of SQL Server.
 

  • For a renamed computer that hosts a named instance of SQL Server, like KC's WKENNEL, run the following procedures:

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

Restart the instance of SQL Server.

After the Renaming Operation

After a computer has been renamed, any connections that used the old computer name must connect by using the new name.

Verify renaming operation

  • Select information from either @@SERVERNAME or sys.servers. The @@SERVERNAME function will return the new name, and the sys.servers table will show the new name. The following example shows the use of @@SERVERNAME.

SELECT @@SERVERNAME AS 'Server Name';  

Additional considerations

Remote Logins - If the computer has any remote logins, running sp_dropserver might generate an error similar to the following:

Server: Msg 15190, Level 16, State 1, Procedure sp_dropserver, Line 44 There are still remote logins for the server 'SERVER1'.

To resolve the error, you must drop remote logins for this server.

Drop remote logins

  • For a default instance, run the following procedure:

EXEC sp_dropremotelogin old_name;   GO  

  • For a named instance, run the following procedure:

EXEC sp_dropremotelogin old_name\instancename;  GO

    • Related Articles

    • Installing Kennel Connection 7 & SQL Server

      Installing Kennel Connection 7 & SQL Server Welcome to the installation guide for Kennel Connection 7.  Kennel Connection 7 is compatible with Windows 7 or higher operating systems.  Windows 10 is recommended.  Important:  If you are installing ...
    • SQL Server 2014 Express Setup Guide

      SQL Server 2014 Express Setup Guide SQL Server 2014 Express is a free download, available from Microsoft. This article will guide you through the process of acquiring, installing and configuring SQL Server 2014 Express so that you can use it with ...
    • Installing KC7 with an already existing version of SQL

      Installing Kennel Connection 7 with an existing version of SQL Server Welcome to the installation guide for Kennel Connection 7.  Follow the instructions below to get KC7 installed on your machine. Important:  If you are installing KC7 on your ...
    • Restoring the Kennel Connection 7 database using Microsoft SQL Management Studio

      Restoring the Kennel Connection 7 database using Microsoft SQL Management Studio If you have been advised to use SQL Management Studio to restore your KC7 backup, there is a good chance it is because there are Windows or SQL Server permissions ...
    • Adding SQL Server Exceptions to Windows Firewall

      Adding SQL Server Exceptions to Windows Firewall Adding SQL Server exceptions to Windows Firewall In order to allow workstations to connect to SQL Server on your main/server computer, Windows Firewall exceptions will need to be added.  Complete the ...
    After-Hours Emergency Support
    For use ONLY outside of business hours. (Mon-Fri, 8am to 7pm ET). 

    To avoid any delay, be sure to search this knowledgebase for your issue prior to submitting a ticket. Most answers can be found here.

    If you're issue does NOT consist of one of the following, please email support@kennelconnection.com with your issue to create a ticket and someone will get back to you on the next business day. 

    - Kennel Connection Desktop - Will not open on any machine including server. 
    - KC-Cloud - Cannot login/spinning and you've verified you have Internet.
    - KC Online Reservations - Clients are getting an error upon login or cannot book ANY reservations.
    - Hello-Groom - Cannot login/spinning and you've verified you have Internet.
    - Credit Card Processing - Cannot take payments at all from any method.
    - PawLoyalty - Cannot login/spinning or extreme latency and you've verified you have Internet.

    *Utilizing the emergency support for non-emergencies will not receive a call back.
    *Users without a valid subscription will not receive a call back and will need to speak with a sales representative on the next business day.