How to clean up a SQL 2005 instance name left behind by a previous uninstall


I have heard from a few customers who have tried to uninstall and re-install SQL 2005 and have run into errors with both the uninstall and the re-install.  I have already described the most common uninstall error and a suggested workaround in this previous blog post (an error reading property “Installids” from the cache and/or an error writing property “flagCommit” to the cache).


I wanted to address one of the most common SQL Express install errors I have seen – a duplicate instance name error that causes SQL setup to fail and rollback.  It is pretty easy to tell if you are running into this error if you launch SQL setup directly and step through the SQL setup UI.  However, if you are installing SQL Express as a part of Visual Studio 2005, setup runs in silent mode and you will only see a generic error bubbled up from Visual Studio setup indicating that SQL Express failed to install.


VS 2005 configures SQL Express with an instance name of SQLEXPRESS when it runs SQL setup in silent mode.  If you previously had SQL Express installed and try to uninstall it but something goes wrong with uninstall, you may end up with an orphaned instance name on your system, and then re-installing SQL Express can fail.  In this case, the verbose setup log file for SQL Express will show an error that looks like the following:



MSI (s) (AC!38) [00:01:41:056]: Product: Microsoft SQL Server 2005 Express Edition — Error 28086. An instance with the same name is already installed on this computer. To proceed with SQL Server Setup, provide a unique instance name.


Error 28086. An instance with the same name is already installed on this computer. To proceed with SQL Server Setup, provide a unique instance name.


If you are running into an error installing SQL Express as a part of Visual Studio 2005 setup, you can check in the SQL Express log files (located at %ProgramFiles%\Microsoft SQL Server\90\Setup Bootstrap\LOG).  If you are receiving an error about the instance name not being unique, you can manually clean off the orphaned instance name by doing the following:



  1. Click on the Start menu, choose Run and type regedit

  2. Go to HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server

  3. Remove SQLEXPRESS from the REG_MULTI_SZ value named InstalledInstances

  4. Delete the subhive named MSSQL.1

  5. Delete the subhive named SQLEXPRESS

  6. Go to HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server\Instance Names\SQL

  7. Delete the value named SQLEXPRESS

  8. Delete the folder %ProgramFiles%\Microsoft SQL Server\MSSQL.1

Note – the above steps apply to the instance name that is created when SQL Express is installed as a part of Visual Studio 2005.  The actual instance name on your system may vary if you have had any other beta version of SQL 2005 (such as the developer edition).  Please make sure to adjust the steps accordingly based on what instance name information is in your registry and file system.


<update date=”7/24/2009″> Updated this post to not be beta-specific.  The same type of error can occur if you uninstall and re-install the final release of SQL Express or SQL Express service packs. </update>


 

Comments (35)

  1. i have installed the german sql 2000

    sql 2005 named instance (us) and sql express us

    Now i unistalled sql2005 completley to install sql epxress german edition

    i get the above error

    i cleaned the registry and the mssql.1 directory

    any idea?

  2. alp says:

    My initial install had gone well with the final vs express release… but later something messed up my installation and i tried to uninstall and reinstall about ten times vs c++ express and sql express server… in different combinations as a whole or only sql server… i tried to follow the instructions on your blog… all went futile…. giving up for now… and hoping that you are planning to address this sql install-uninstall problem in near future …

    PS. what the heavens is remained behind when i uninstall it??? it is not beta… or is it? under the disguise of final release…

  3. astebner says:

    Hi Alp – I’m sorry that you’ve run into this issue. Just to confirm, you have been trying to reinstall the final release of SQL 2005 Express and it is failing? If that is correct, can you please zip and send the log files located at %ProgramFiles%Microsoft SQL Server90Setup BootstrapLogFiles to aaronste@microsoft.com so I can try to take a look?

  4. martin@kulov.net says:

    Thanks,

    Martin Kulov

  5. I need to provide a silent Installation of SQL Express 2005, wherein the user doesn’t have to click on the next button as in that of a normal installation by giving the required info and iam using Install Sheild 11.5. Can anyone suggest an idea like how to do a Silent Installation.

  6. lenny says:

    while I found that Add /remove control panel,there are no list of sql ,but

    start edit we can see that there are

    left item. why ?

  7. astebner says:

    Hi Lenny – It is possible that the start menu items for SQL were left behind after one of the uninstalls.  The most reliable way to determine whether or not you have any SQL components left on your system is to use the steps listed at http://blogs.msdn.com/astebner/archive/2005/10/30/487096.aspx to see if you have any SQL products installed.  If there are not any SQL components listed in the MsiInv output, then that means the start menu items are just leftover from the previous install but your system does not actually have SQL registered as being installed and you should be safe to install the final release.

  8. Where to get Visual Studio 2005 and the .NET Framework 2.0 Where to download the .NET Framework 2.0 redistributable

  9. plutch says:

    It worked for me, but i was a little desperate and erased de whole sql server key on Local machine. It solved a Business Contact Manager Installation too!

  10. Steve says:

    Thanks, have spent many hours trying to figure this out

  11. Jonah says:

    worked great! thanks

  12. Duarte says:

    I have the same problem but with SQL 2008. I installed it last year and then uninstalled it the same year. This year im trying to install it again and it says i already have an instance in use.

  13. astebner says:

    Hi Duarte – I don't have any specific experience working with SQL Server 2008 issues like this, but I think that steps similar to the ones in this blog post will work for SQL Server 2008 as well.  If you don't have any luck with that, then I'd suggest posting a question on the SQL Server setup forum at social.msdn.microsoft.com/…/threads to see if someone there can provide some additional suggestions for you to try.

  14. Lee Ollett says:

    Thanks! Fixed having an old Sophos AV sql instance left in registry!

  15. Larry Allen says:

    I wanted to thank you for this information. It was helpful to me and allowed me to move on with my project. Thanks

    Larry A

  16. Pandya Binal says:

    Thank you for giving such awonderful help!!will try this

  17. Roland says:

    Thank you

  18. Idris Nagri says:

    Hi First of all thanks for sharing this information it indeed worked superbly…

    Now when i start my management studio( SQL SERVER 2005 developers edition) I dont get my Service name for Database Engine …Please can you help me out from where can i get this instance name…

    thanks..

  19. astebner says:

    Hi Idris Nagri – This type of question is outside of my areas of expertise.  I'd suggest posting a question on one of the SQL Server forums at social.msdn.microsoft.com/…/sqlserver.

  20. Alistair Ramsay says:

    There are different registry keys to delete for Win7 64bit operating system. I searched for MSSQLServer in the registry and found the references to mssql.1 and mymovies instance.

  21. astebner says:

    Hi Alistair Ramsay – Thank you for pointing this out.  On 64-bit versions of Windows, the registry keys will be located at HKEY_LOCAL_MACHINESoftwareWow6432NodeMicrosoftMicrosoft SQL Server.

  22. AsMoth says:

    Bro Please Help Me To Remove A Server Name in my SQL 2005 Please ? sorry for my wrong grammar :))

  23. astebner says:

    Hi AsMoth – I'd suggest posting a question in the SQL Server setup forum for this issue.  You can find that forum at social.msdn.microsoft.com/…/threads.

  24. hunter3740 says:

    Thanks Alistair Ramsay: found it under KEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftMicrosoft SQL ServerInstance NamesSQL; removed (my two) listed on right and install then didn't ask to use a different instance name (as I wanted to use the default, but uninstall didn't quite remove).

  25. hunter3740 says:

    Also had to remove two keys "MSSQL.1" and "MSSQL.2" under KEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftMicrosoft SQL Server

  26. Raja Sekhar says:

    Worked…Thank you !!!

  27. Ganesh Kandu says:

    easy to delete thanx

  28. prem says:

    thanxxx……sooo much

  29. David says:

    I have spent 2 weeks to delete the instance.

    Finally I saw this thread.

    It works perfectly.

    Thank you so much.

  30. Bhupinder Dhani says:

    Thank u so Much…….

  31. Stellis says:

    Wow, almost 10 years later and the advice is still solid. I had uninstalled SQL Express but those few items were still hiding in the registry preventing a new install. Huge thanks!

  32. sujit says:

    thank u ……

  33. chaithra says:

    thank u so much