Friday, March 9, 2012

Removing Named Instance

We want to rename our instance and I understand there isn't a straightforward way to do so. I'm prepared to run SQLEXPR again to create the new named instance. However, I'm not clear on how to remove the other named instance once the data files have been moved over. I do not want the old service "SQL Server (<old_named_instance>)" to be running. I would also like the files "C:\Program Files\Microsoft SQL Server\MSSQL.1" removed along with the registry entries for this instance.

I tried running SQLEXPR with a /? option but that invoked the installer and did not give me the command line options. Is there a simple way to remove a specific named instance? Thanks.

Go to Add/Remove Programs and look for the entry for Microsoft SQL Server 2005 and click the Remove button. The dialog that opens will show you two lists, the top is list of the installed instances for any instance aware components. (For SQL Express this includes the database engine and reporting services if you installed SSE Advanced) The bottom is any common components that are shared across instances.

You will want to select the named instance for the services you want to remove. Since it sounds like you only have one instance of SQL Express, you'll likely see just the single entrie that reads "SQLEXPRES: Database Engine" in the list. Since you're planning on re-installing another instance, there is no need to remove the shared components unless you really don't want them anymore. Since they are shared, the existing components will continue to work with the new instance you install.

Having selected the items to remove, click Next and walk through the rest of the wizard. Once completed you will have removed the database engine for the named instance SQLEXPRESS. Go ahead and install a fresh copy to your desired instance name and you should be up and running.

For those who care to know, there are some components that are not removed via this uninstall path. They are not removed because they are technically independent programs that we can install automatically, but can't remove automatically without risking breaking things. If you were interested in doing a complete uninstall (which is not the case here) you would need to remove those programs separately from the ARP dialog. These additional components include Management Studio Express and the SQL Server Setup Support Files.

Mike

|||Thanks Mike, this is very helpful. I currently have two named instances and they both appear in the list after clicking Remove, just as you said. Is there any way to peform this function via a command script? We have a Beta version of our product installed in a few remote locations and would prefer having them run a single command file to uninstall the old instance, reinstall the new, etc.|||

The command line interface for the installer (which is also used to remove things) is documented in Books Online. You should check out the REMOVE statement. I also suggest you ask this question in the SQl Setup forum as they may have other/better ideas.

Mike

No comments:

Post a Comment