Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Other SQL Server Topics (2005)
 Unable to uninstall SQL Server 2005

Author  Topic 

TuinKabouterT
Starting Member

2 Posts

Posted - 2010-07-15 : 05:30:33
Hello,

For a school project to Host SharePoint, I'm building a Hosted Platform with Hosted Messages and Collaboration 4.5.
To build this platform, a cluster server with Microsoft SQL Server (in my case 2005) is needed.
I created the Cluster (on MPSSQL01 & MPSSQL02), after that I installed SQL Server 2005. When the installation of SQL completed, I rebooted the server (necessary). After the reboot, I couldn't open the cluster anymore because the connection to my iSCSI Disks (Y: & Z:) got corrupted. So I recreated the cluster and the iSCSI Disks (this time I named them Q: & R:, used the same physical disk as Y: & Z: but formatted it first), but after this I couldn't connect to my SQL Server anymore. I know (after some research) that it's because the SQL Server was installed on Z: wich is formatted.
Now, I want to uninstall SQL to reinstall it on the new disk, but I got stuck on it because the SQL Setup can't find the data to uninstall. When I run the SQL Setup (via splash.hta or Add/Remove Programs) I get the following error:

Microsoft SQL Server 2005 Setup
There was an unexpected failure during the setup wizard. You may review the setup logs and/or click the help button for more information.

I've already said that it's because the specified data could not be found (because of the formatted and nonexistent drive Z:).

Does anyone know how to solve this problem or how to get rid of everything of SQL installed on my computer?

Thanks in advance,
T.

fayalif
Starting Member

8 Posts

Posted - 2010-07-16 : 07:25:53
May be this will help you out.. Read out till the last line. There you will find how to uninstall SQL Server manually.. If you will unable to download the files from the defined locations, do let me know by an email (fayalif@gmail.com). I will send you the files.

Regards,
fayalif

==============================================================================================

Using MsiInv to gather information about what is installed on a computer:
As I was reading one of the posts on Quan To's new blog, I noticed that someone posted a link to a tool named msiinv.exe on their tools page. This tool (which stands for MSI Inventory) wraps some of the publicly documented MSI APIs to provide information about the state of all Windows Installer products, features and components that Windows Installer thinks are installed on your computer. I say "thinks are installed" because there are some rare cases where the actual installation state of a given product can get out of sync with the information Windows Installer has stored in its internal data structures, which can cause confusion for setup packages.
I use this tool nearly every day as one of the first troubleshooting tools for setup problems because it allows me to get a baseline snapshot of what the current state is for a machine before I start trying to make changes to fix any problems a customer might be having.
Example usage of msiinv.exe
One of the common uses of msiinv.exe is if someone is trying to install one of the recent beta builds of VS 2005 or .NET Framework 2.0 and the setup UI states that you are not allowed to install because a previous beta version of <insert product name here> is on the machine and you must uninstall that first. Sometimes after receiving this error message, a user will look in Add/Remove Programs and the product that setup is complaining about is nowhere to be found, or there is an Add/Remove Programs entry for that product but trying to remove it claims that the product is not on the computer and asks if you would like to remove the entry from the Add/Remove Programs list.
In these cases, you can use the following steps:
1. Download msiinv.zip from the following location:

http://cid-27e6a35d1a492af7.skydrive.live.com/self.aspx/Blog%7C_Tools/msiinv.zip
2. Extract the contents of msiinv.zip to the folder c:\msiinv on your system
3. Click on the Start menu, choose Run, type cmd and click OK
4. Type this command: c:\msiinv\msiinv.exe -p > c:\msiinv\msiinv_output.txt

Note: This command must be run from a cmd prompt or it will not create a log file as expected.
These steps will create a text file named c:\msiinv\msiinv_output.txt with a list of each product that Windows Installer thinks is installed on the system. Then you can open the text file in any text editor and search the list of products for the name of the product that setup told you to uninstall. The output will look something like this (I am using an example from a machine that has .NET Framework 2.0 beta 2 installed):
Microsoft .NET Framework 2.0 Beta 2
Product code: {7A1ADD0C-17F3-47B8-B033-A06E189C835D}
Product state: (5) Installed.
Package code: {856D48D2-6F94-466D-9732-534DB5854FB3}
Version: 2.0.50215
<note: there is more info after this but I am omitting it because it isn't useful to the rest of my example>
Now we have the Windows Installer product code and we can use that to uninstall the product by running msiexec /x <product code> (make sure that you include the curly braces in this command line). If the product is actually installed on your system you will see a progress screen and uninstall will complete, and from there you should be able to re-run VS or .NET Framework setup and successfully install.
If Windows Installer thinks that the product is installed but it really isn't, then running msiexec /x <product code> will give you an error stating that this command is only valid for installed products. If this happens, you will need to perform an extra step to remove the data that causes Windows Installer to think this product is installed. You can download the Windows Installer Cleanup Utility and install and run it on your machine to fix this. In the list of applications that this tool displays, choose the one that matches the product name displayed when you first ran VS or .NET Framework setup and choose to remove it. After this removal completes, you should be able to re-run VS or .NET Framework setup and successfully install.
Advanced usage of msiinv.exe
The msiinv.exe tool has several command line parameters that you can see by running it with the /? switch. A couple of the more interesting options are the following:
• msiinv.exe -v - This option will list all feature GUIDs and component GUIDs for each Windows Installer product that is installed on the machine. This can be useful to see which products share components (which can help track down why running uninstall for one product leaves behind some files and/or registry). If you have a lot of products installed on the machine, running with the verbose switch will take a long time.
• msiinv.exe -x - This option will list Windows Installer components that are installed on the machine that do not have any products that hold reference counts on them anymore. In most cases, this is caused by one or more setup being installed on the machine at some point in the past that violated the MSI component rules. (more info about component rules can be found here and here if you are interested)
<update date="12/1/2008"> Updated the link to msiinv.zip because the old location was no longer available. </update>
<update date="2/12/2009"> Updated command line for running msiinv.exe so it will work on Windows Vista and Windows Server 2008. </update>
<update date="4/1/2009"> Removed broken link to msiinv.exe tool </update>





How to manually uninstall SQL Express if uninstalling from Add/Remove Programs fails:
I have heard from a few customers (inside and outside of Microsoft) who have had problems uninstalling previous beta versions of SQL Express via Add/Remove Programs or via the cleanup tools we have released (located here and here). These customers have seen unexpected errors in the datastore related to the actions named RestoreSetupParams and/or Write_CommitFlag. The exact error message states that setup is unable to write property into the cache: IsClustered and unable to write property into the cache: flagCommit.
I haven't narrowed down the exact sequence, but these uninstall errors are caused by uninstalling beta versions of SQL 2005 and/or VS 2005 in specific orders. The officially recommended uninstall order for these products can be found at this location. However, this order is not enforced via the Add/Remove Programs control panel and it is pretty easy to overlook the readme and uninstall in alphabetical order or some other random order and get into this state.
If you encounter either or both of the above error dialogs, you can use the following steps to resolve the errors:
1. Download and run msiinv.exe using the instructions in this previous blog post
2. Look at the output from msiinv.exe in a text editor such as notepad and locate each of the products that are installed that have SQL 2005 in the name
3. Click on the Start menu, choose Run and type cmd
4. For each of the SQL 2005 product codes found in the msiinv.exe output, run msiexec /x {Product Code} from the cmd prompt - this command will likely generate the same errors shown above but it is good to run it just in case
5. Download the smartmsizap tool
6. For each of the SQL 2005 product codes found in the msiinv.exe output, run smartmsizap.exe /p {Product Code} from the cmd prompt
After running smartmsizap to cleanup each of the SQL 2005 products left behind on your machine, you should be able to successfully install later builds of SQL Express and/or VS 2005.
<update date="11/26/2005"> Added text descriptions of the error messages to make it more likely that this blog post will be found from internet search engines because I have heard from a lot of customers who have run into this error but not found this blog post. Also modified the uninstall instructions to use the smartmsizap tool that I had not yet written at the time that I originally wrote this blog post. </update>
<update date="4/14/2009"> Fixed broken link to the smartmsizap tool and removed broken image links. </update>

==============================================================================================
Go to Top of Page

TuinKabouterT
Starting Member

2 Posts

Posted - 2010-07-16 : 10:01:55
quote:
Originally posted by fayalif

May be this will help you out.. Read out till the last line. There you will find how to uninstall SQL Server manually.. If you will unable to download the files from the defined locations, do let me know by an email (fayalif@gmail.com). I will send you the files.

Regards,
fayalif

==============================================================================================

Using MsiInv to gather information about what is installed on a computer:
As I was reading one of the posts on Quan To's new blog, I noticed that someone posted a link to a tool named msiinv.exe on their tools page. This tool (which stands for MSI Inventory) wraps some of the publicly documented MSI APIs to provide information about the state of all Windows Installer products, features and components that Windows Installer thinks are installed on your computer. I say "thinks are installed" because there are some rare cases where the actual installation state of a given product can get out of sync with the information Windows Installer has stored in its internal data structures, which can cause confusion for setup packages.
I use this tool nearly every day as one of the first troubleshooting tools for setup problems because it allows me to get a baseline snapshot of what the current state is for a machine before I start trying to make changes to fix any problems a customer might be having.
Example usage of msiinv.exe
One of the common uses of msiinv.exe is if someone is trying to install one of the recent beta builds of VS 2005 or .NET Framework 2.0 and the setup UI states that you are not allowed to install because a previous beta version of <insert product name here> is on the machine and you must uninstall that first. Sometimes after receiving this error message, a user will look in Add/Remove Programs and the product that setup is complaining about is nowhere to be found, or there is an Add/Remove Programs entry for that product but trying to remove it claims that the product is not on the computer and asks if you would like to remove the entry from the Add/Remove Programs list.
In these cases, you can use the following steps:
1. Download msiinv.zip from the following location:

http://cid-27e6a35d1a492af7.skydrive.live.com/self.aspx/Blog%7C_Tools/msiinv.zip
2. Extract the contents of msiinv.zip to the folder c:\msiinv on your system
3. Click on the Start menu, choose Run, type cmd and click OK
4. Type this command: c:\msiinv\msiinv.exe -p > c:\msiinv\msiinv_output.txt

Note: This command must be run from a cmd prompt or it will not create a log file as expected.
These steps will create a text file named c:\msiinv\msiinv_output.txt with a list of each product that Windows Installer thinks is installed on the system. Then you can open the text file in any text editor and search the list of products for the name of the product that setup told you to uninstall. The output will look something like this (I am using an example from a machine that has .NET Framework 2.0 beta 2 installed):
Microsoft .NET Framework 2.0 Beta 2
Product code: {7A1ADD0C-17F3-47B8-B033-A06E189C835D}
Product state: (5) Installed.
Package code: {856D48D2-6F94-466D-9732-534DB5854FB3}
Version: 2.0.50215
<note: there is more info after this but I am omitting it because it isn't useful to the rest of my example>
Now we have the Windows Installer product code and we can use that to uninstall the product by running msiexec /x <product code> (make sure that you include the curly braces in this command line). If the product is actually installed on your system you will see a progress screen and uninstall will complete, and from there you should be able to re-run VS or .NET Framework setup and successfully install.
If Windows Installer thinks that the product is installed but it really isn't, then running msiexec /x <product code> will give you an error stating that this command is only valid for installed products. If this happens, you will need to perform an extra step to remove the data that causes Windows Installer to think this product is installed. You can download the Windows Installer Cleanup Utility and install and run it on your machine to fix this. In the list of applications that this tool displays, choose the one that matches the product name displayed when you first ran VS or .NET Framework setup and choose to remove it. After this removal completes, you should be able to re-run VS or .NET Framework setup and successfully install.
Advanced usage of msiinv.exe
The msiinv.exe tool has several command line parameters that you can see by running it with the /? switch. A couple of the more interesting options are the following:
• msiinv.exe -v - This option will list all feature GUIDs and component GUIDs for each Windows Installer product that is installed on the machine. This can be useful to see which products share components (which can help track down why running uninstall for one product leaves behind some files and/or registry). If you have a lot of products installed on the machine, running with the verbose switch will take a long time.
• msiinv.exe -x - This option will list Windows Installer components that are installed on the machine that do not have any products that hold reference counts on them anymore. In most cases, this is caused by one or more setup being installed on the machine at some point in the past that violated the MSI component rules. (more info about component rules can be found here and here if you are interested)
<update date="12/1/2008"> Updated the link to msiinv.zip because the old location was no longer available. </update>
<update date="2/12/2009"> Updated command line for running msiinv.exe so it will work on Windows Vista and Windows Server 2008. </update>
<update date="4/1/2009"> Removed broken link to msiinv.exe tool </update>





How to manually uninstall SQL Express if uninstalling from Add/Remove Programs fails:
I have heard from a few customers (inside and outside of Microsoft) who have had problems uninstalling previous beta versions of SQL Express via Add/Remove Programs or via the cleanup tools we have released (located here and here). These customers have seen unexpected errors in the datastore related to the actions named RestoreSetupParams and/or Write_CommitFlag. The exact error message states that setup is unable to write property into the cache: IsClustered and unable to write property into the cache: flagCommit.
I haven't narrowed down the exact sequence, but these uninstall errors are caused by uninstalling beta versions of SQL 2005 and/or VS 2005 in specific orders. The officially recommended uninstall order for these products can be found at this location. However, this order is not enforced via the Add/Remove Programs control panel and it is pretty easy to overlook the readme and uninstall in alphabetical order or some other random order and get into this state.
If you encounter either or both of the above error dialogs, you can use the following steps to resolve the errors:
1. Download and run msiinv.exe using the instructions in this previous blog post
2. Look at the output from msiinv.exe in a text editor such as notepad and locate each of the products that are installed that have SQL 2005 in the name
3. Click on the Start menu, choose Run and type cmd
4. For each of the SQL 2005 product codes found in the msiinv.exe output, run msiexec /x {Product Code} from the cmd prompt - this command will likely generate the same errors shown above but it is good to run it just in case
5. Download the smartmsizap tool
6. For each of the SQL 2005 product codes found in the msiinv.exe output, run smartmsizap.exe /p {Product Code} from the cmd prompt
After running smartmsizap to cleanup each of the SQL 2005 products left behind on your machine, you should be able to successfully install later builds of SQL Express and/or VS 2005.
<update date="11/26/2005"> Added text descriptions of the error messages to make it more likely that this blog post will be found from internet search engines because I have heard from a lot of customers who have run into this error but not found this blog post. Also modified the uninstall instructions to use the smartmsizap tool that I had not yet written at the time that I originally wrote this blog post. </update>
<update date="4/14/2009"> Fixed broken link to the smartmsizap tool and removed broken image links. </update>

==============================================================================================



Fayalif,

Many thanks for your reply! I really appreciate it :thumb up: !
However, by posting my question, I even forwarded it to a friend of mine which is a more experienced IT'er than me. He gave me some solutions and it was like you suggested too, to remove SQL manully from the server.
I did this by using the following instructions:


Remove the <sql> directory and everything under it
Remove the <sql> dir from the path (use control panel/system for this)
Remove the SQL registry entries

using regedt32/regedit. These are :-

(All versions)

§ HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSSQLServer

§ HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer

(6.0 and above.)

§ HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MSDTC

§ HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SQLExecutive

(7.0 and above)

§ HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SQLServerAgent

§ HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server 7

§ HKEY_LOCAL_MACHINE\Software\Microsoft\MSSQLServ65

If you have lost permission to any of the registry keys then log on as administrator and take ownership of them starting at the highest relevant level. Use regedt32 and check the box to take ownership of all subkeys as well.


Thanks!
T.
Go to Top of Page

fayalif
Starting Member

8 Posts

Posted - 2010-07-17 : 06:46:15
Hi T,

thanks for sharing this.. its really simple indeed.


Regards,
fayalif
Go to Top of Page
   

- Advertisement -