Rename a server running a stand alone SQL instance

I recently migrated a Windows 2008 server running an MSSQL instance from physical hardware to a virtual machine.

Once the system was virtualized, we renamed the server so that it could be tested before shutting down the physical device.

Since this system was designed for SQL testing, we also needed to rename the sql instance on the server. To do this, you need to do the following;

  1. Logon to the server running the SQL instance
  2. Launch the SQL Server Management Studio interface
    • When I did this, I logged in using "SQL Server Authentication" and using the default sa account. You should be able to use any account with sufficient access to the system tables to carry out this procedure.
  3. Select the "New Query" button from the menu ribbon.mangementstudiomenu
  4. In the query window, enter the command "Select @@ServerName" and select the Execute button from the menu ribbon.
    • This command will list the current SQL instance name, the one we want to change. We will run this command again later to ensure it lists the correct name.
  5. Using the same query window, clear any old queries and enter "sp_dropserver <ServerName from step 4>" and select the execute button.
    • Check for any errors in the Messages window, if all is good, then proceed to the next step.
  6. Using the same query window, clear any old queries and enter "sp_addserver <new name>, local" and select the execute button.
    • Check for any errors in the Messages window, if all is good, then proceed to the next step.
  7. Reboot the server, in reality, you can restart just the SQL services, but I prefer to do the full reboot.

That should be all there is to it. Now people can connect to the server properly using the new name.

 

Leave a Reply