Jef
Jef

Reputation: 11

How do I swap the instance names in Microsoft SQL server running different versions of SQL?

I have two instances of Microsoft SQL on my PC. Original instance, default instance, is v2014, referenced as 12.0.42370.0 in the SMS screen shot image. For an upgrade to our application, I installed a second instance of SQL, v2019 as MSSQLSERVER01. It shows as 15.0.2000.5 in the SMS screen shot.

Our .net application uses the default instance, ie: . for the connection string. For testing the new application, I changed the connection string to MSSQLSERVER01. Now that our application has been released, I want to remove the older (default) version of SQL, and just keep V2019.

I also want to be able to reference the default connection as ".". How can I swap these 2 instance names, so v2014 can be removed and be able to reference v2019 as the default instance name of .? enter image description here

I reviewed the suggested tips for renaming an instance. In this case, both instances are up and active though.

For the answer suggested below and my follow-up comments, I'm attached more screen shots: enter image description here

enter image description here In SMS the default connection . fails as expected as I've shut down the service and tcipip.

enter image description here The second instance connection succeeds in SMS, still referenced by MSSQLSERVER01.

Upvotes: 0

Views: 844

Answers (1)

David Browne - Microsoft
David Browne - Microsoft

Reputation: 89396

  1. Disable the service for the old instance
  2. Reconfigure the new instance to listen on port 1433 in SQL Server Configuration Manager.

That should redirect most apps using the hostname, '.', or localhost to the new instance.

Then connect to the instance in SSMS and look at the SQL Server Log you should see a message like Server is listening on ['any' <ipv4> 1433] and Server name is <computerName>\<instanceName>:

enter image description here

and running

sqlcmd -S . -q "select @@servername"

should output the named instance name.

Upvotes: 1

Related Questions