How to rename the target sql server instance after migration?



  • I am planning to migrate the sql server 2016 to 2019.

    After migration I want to take down the source server and rename the target server with the name of the source server. Thus applications will not need to change their connection string to be able to access the target sql server.

    Suppose I change the target computer name via windows system settings, then how do I rename the SQL server instance?

    I cannot see rename option when right click on SQL server in management studio. Neither can I do so in the properties.



  • You need to reinstall it. There is no instance rename facility for the Database Engine.

    But if you are using an unnamed instance probably you only want to rename the machine that hosts the instance.

    EXEC sp_dropserver '';  
    GO  
    EXEC sp_addserver '', local;  
    GO  
    

    As an alternative you can play with dns records setting an alias for the new server as the old one.

    https://docs.microsoft.com/en-us/sql/database-engine/install-windows/rename-a-computer-that-hosts-a-stand-alone-instance-of-sql-server?view=sql-server-ver15


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2