How to change SQL Server Instance Name?

First collect the output of the current instance configuration. You can get the instance name stored in the SQL Server metadata.

Make sure you have backup of all the database if you are changing the production server instance name.

<br />
	sp_helpserver<br />
	select @@servername<br />

You can change the instance name using below query.
Default Instance
<br />
	sp_dropserver 'old_name'<br />
        go<br />
        sp_addserver 'new_name','local'<br />
	go<br />

Named Instance

<br />
	sp_dropserver 'Server Name\old_Instance_name'<br />
        go<br />
        sp_addserver 'ServerName\New Instance Name','local'<br />
	go<br />

Verify sql server instance configuration by running below queries

<br />
	sp_helpserver<br />
	select @@servername<br />

Restart the SQL Server Services.

<br />
	net stop MSSQLServer<br />
	net start MSSQLServer<br />

Renaming instances in the AI era

The procedure above still works — sp_dropserver and sp_addserver haven’t changed. Where this comes up in 2026 is consolidation: before a cloud migration or a container rollout, teams rename and merge instances so connection strings and automation stay sane. Get the naming right once, because every pipeline, agent, and dashboard downstream will hardcode it. If you’re heading down that modernization path, start here: Legacy to Cloud-Native: A Database Modernization Playbook

Comments

54 responses to “How to change SQL Server Instance Name?”

  1. sandeep Avatar
    sandeep

    can we create two instances in sql server standard edition?

    plz explain.

    1. JShah Avatar

      Yes we can create two instances in standard edition

  2. online stock trading advice Avatar

    Hey, I found your blog while searching on Google your post looks very interesting for me. I will add a backlink and bookmark your site. Keep up the good work!

    I’m Out! 🙂

  3. Umesh Avatar
    Umesh

    Hi I have installed SQL server2008 on my machine with instance name “”UmeshSQL2008. but some components did not get installed. So i have reinstalled the the same with another instance name say “abcSQL2008”. Now as I have Windows7 installed on my machine there is some compatibility issue, so i have downloaded the service pack for SQL server2008 and tried to installed. but i a getting following error:
    TITLE: SQL Server Setup failure.
    ——————————

    SQL Server Setup has encountered the following error:

    A failure was detected for a previous installation, patch, or repair for instance ‘UMESHSQL2008’ during configuration for features [SQL_Replication_Core_Inst,SQL_Engine_Core_Inst,MPT_AGENT_CORE_CNI,SQL_FullText_Adv,Analysis_Server_Full,RS_Server_Adv,]. In order to apply this patch package (KB968369), you must resolve any issues with the previous operation that failed. View the summary.txt log to determine why the previous operation failed.

    Error code 0x84B20001

    Please help me out why this is happening. how do i install the service pack for SQL server 2008.

    Thanks

  4. […] You All Very Happy and Prosperous New Year 2011Wishing you all Very happy and prosperous new yearHow to change SQL Server Instance Name?Transactions and Locks in SQL ServerDBA Roles and ResponsibilitiesNetwork Troubleshooting Dos […]

  5. Gbaksh Avatar
    Gbaksh

    thanks a lot for this tip. It helped me a great deal.

  6. chandra Avatar
    chandra

    Hi Jugal,
    Are there any best practices on logshipping articles
    what is the best way to copy the big log files / backup files in logshipping from primary server to secondary server

    1. Jugal Shah Avatar

      Log file shouldn’t be too big, if you have scenario go for compress backup. Again you can change the interval as well.

  7. Charlie Avatar
    Charlie

    I changed the name of the instance and the sp_helpserver shows the new name but the dialog to connect to an instance still shows the old name. How do I get this to reset? I stopped and started the server instance.

    1. Jugal Shah Avatar

      Can you please check the registry as well? Is it a default instance or named instance?

      1. Charlie Avatar
        Charlie

        The registry has several hundred entries that match the instance name. The instance is a named instance. It looks like a lot of work that I do not have time to do. I just changed the name back to the old instance name for now.

  8. binal pandya Avatar
    binal pandya

    I am trying to install sql server 2005 express,
    But the insatallation has been failed with the error message that the instance is already running.
    How can i solve this?
    can u help me?

    1. Jugal Shah Avatar

      Try to install the named instance…

  9. Kamlesh Avatar
    Kamlesh

    Thanks ..
    It really work but you must add 1 step to restart the server

    thanks again …

  10. Jessica Godoy Avatar
    Jessica Godoy

    HI,

    is possible change the user of any instance?

    Thanks in advance.

    Jessica Godoy

    1. Jugal Shah Avatar

      yes you can change the user of any instance. Can you give me more information so I can guide you.

  11. ami Avatar
    ami

    i have database in sqlserver2005 in my pc.so now a days my pc is act as server .bt i want to change server …so what i have to do????n is it affect to my programme???

    1. Jugal Shah Avatar

      I am not getting your question. If you want to move the DB server, you have to change the connection string in your programming language and have to restore the database to new machine.

      Let me know if you need more infromation.

      1. ami Avatar
        ami

        pls give me steps how to restore or copy database to new m/c???

      2. Jugal Shah Avatar

        Hi Ami,
        First you have to take the backup of the database from the source server. You can take the backup using
        Backup database [DBName] to disk = ‘C:\dbName.bak’

        Next step is copy the the file to target server and execute the below command.
        Restore database [DBName] From disk = ‘C:\dbName.bak’

  12. Fernando Avatar
    Fernando

    Hi Jugal,

    I have a scenario in of my production servers to change the default instance in SQL server 2000. Can the same steps be used in SQL 2000 also. If not could you please any suggestions and that would be very helpful.

    Thanks in advance,
    Fernando

    1. Jugal Shah Avatar

      Wait.. Can you tell me what exactly you want to do? You want to change the computer name or instance name?

      Please checkout my article http://www.mssqltips.com/sqlservertip/2525/steps-to-change-the-server-name-for-a-sql-server-machine/ for more information.

      1. Fernando Avatar
        Fernando

        I was in need of changing the instance name. But now i have opted with computer name change (cname). The article was useful and Thanks for the suggestion.

  13. Ashish Avatar
    Ashish

    You can change the instance name by this technique but while connecting to the server, you still need to mention the old name.
    Though its surprising that when you run @@servername, it will give the new changed name. But if you try to connect with this new name, you will get error.

    1. Jugal Shah Avatar

      Hi Ashish, You can checkout my article on MSSQLTips.com http://www.mssqltips.com/sqlservertip/2525/steps-to-change-the-server-name-for-a-sql-server-machine/ for more information.

      You can’t change the instance name alone, you have to change the machine name as well. SQL Server name would be always machine name/mssqlserver for default instance and for named instance machine name\instance name. Let me know if you need more information.

      1. sandeep sonawane Avatar
        sandeep sonawane

        hi Jugal,

        This is the exact issue with me.
        I mine is a named instance of SQL2k8R2 and incorrectly named same as that of the servername. Hence making it “YSIINCONV2\YSIINCONV2” which I want to rename as “YSIINCONV2\SQL2k8R2”.

        So, in this case, why will I change my servername if it is not required? I want to change the instance name only. I have used sp_dropserver and sp_addserver which is showing results properly with sp_helpsever and select @@servername. But I need to connect using the old instance only.

        Please guide about what can be done. I dont want to uninstall and reinstall the instance, but still want to rename it as “YSIINCONV2\SQL2k8R2”

        Thanks a lot in advance.
        –Sandeep.

      2. Jugal Shah Avatar

        Try to create the alias name and connect using that.

  14. nagaraj Avatar
    nagaraj

    how to change servername in 2003? please advise me

    1. Jugal Shah Avatar

      Right My Computer and change the windows server name. and to change the SQL Server name follow the my article how to change the SQL instance name,

  15. DINESH DATTATRAY VISHE Avatar

    net stop MSSQLServer after run following message getting

    System error 5 occures..
    Please help me what do ???

    1. Jugal Shah Avatar

      Check for the permission

  16. kumar Avatar
    kumar

    sir,i was uninstall the sql server 2005 because of some files missing.now i try to install the sql server 2005 again,it’s shows named instance “SQLExpress”,click on next button,it’s not move forward …please give the solution

    1. Jugal Shah Avatar

      It means still instance is present on the server, check registry, services.msc, program files, delete all…

  17. Annis Avatar

    This is very interesting, You are a very skilled blogger.

    I have joined your feed and look forward to seeking more
    of your fantastic post. Also, I’ve shared your site in my social networks!

  18. preethi Avatar

    Hi jugal i have downloaded one project which is in .net and sql server 2005 and trying to execute getting some error like network related or instance-specific error occured while establishing the connection to sql seever.the server not found or not accessible,verify that instance name is correct and that sql is configured to allow remote connections…i have installed sql-2005 n instance name is SQLEXPRESS..PLZ HELP ME

    1. Jugal Shah Avatar

      Check the connection string and make sure you have mentioned the correct SQL Server instance name. You can get the SQL instance name by executing Select @@servername query.

      Next is check protocols as well. Follow my article http://www.mssqltips.com/sqlservertip/2340/resolving-could-not-open-a-connection-to-sql-server-errors/

      1. preethi Avatar

        Got jugal….its executing…thank u very much:-)

  19. […] You can get the instance name stored in the SQL Server metadata. Make sure you have backup of all the database if you are changing the production server instance name. … SQL Server 2008 R2 (180) SQL Server 2011 (Denali) (75) Windows OS (5) – read more […]

  20. MERCY MURITHI Avatar
    MERCY MURITHI

    HI I CHANGED MY NAMED INSTANCE BUT ITS NOT APPEARING

    1. Jugal Shah Avatar

      Named Instance name can’t be changed. For example sqldbpool\inst2 … you can change sqldbpool to dbpool but you can’t change INST2

      1. SRIKANTH Avatar
        SRIKANTH

        hi sir im unable to trace my server name help me pls

      2. Jugal Shah Avatar

        give me more information

  21. dj bucuresti Avatar

    I got tjis website from my pal who informed me concerning this web page and now thiis time
    I am visiting this web sjte and readin very informative articles here.

  22. purnachandra Avatar
    purnachandra

    I am first time installing SQL SERVER, I dont want default instance name(MSSQL SERVER),can we make it as Named Instance.

  23. aziz Avatar
    aziz

    hi how i change id?

  24. Chreddy Avatar
    Chreddy

    If it is a default instance, then how the SQL Server instance name will change? Do we need to change the host name before changing the SQL Server instance name? If not so, then what connection name I can use to connect to SQL Server instance?

  25. Pavan Avatar
    Pavan

    The server ‘repl_distributor’ is already defined as a Distributor. To reconfigure the server as a Distributor, you must first uninstall the exisiting Distributor. Use the stored procedure sp_dropdistributor, or use the Disable Publishing and Distribution Wizard.

  26. Pavan Avatar
    Pavan

    Cannot drop server ‘CALSQL4\TST1’ because it is used as a Subscriber to remote Publisher

  27. Chandu Avatar
    Chandu

    Hey Jugal!!

    I am getting this ERROR”Transaction context in use by another session.” while I am trying to execute the SP’s across the Linked Servers.Please help me on this

    Regards,

    Chandu

  28. Ashok Avatar
    Ashok

    can a named instance listen on default port (1433) ?

    1. Jugal Shah Avatar

      Only if you configure it to listen it on 1433 and no other instance is using 1433

  29. Beth Wiebusch Avatar
    Beth Wiebusch

    Just what I needed. This is an excellent page.

  30. 2010 in review – aiDeeva.com Avatar

    […] How to change SQL Server Instance Name? September 2008 4 comments […]

Thanks for the comment, will get back to you soon… Jugal Shah