Thursday, May 27, 2010

How to completely remove SQL 2005 for DPM reinstall.

This is specifically for Windows Server 2008 Enterprise 64bit with Microsoft Data Protection Manager 2007 and SQL 2005 SP2 but I see no reason why it wouldn’t work on any version of Windows Server, with or without DPM and for probably any service pack level of SQL 2005.  This will remove all databases and config and put you back to ground zero.  Be sure to have backups if necessary first.

Ever try to uninstall Microsoft Data Protection Manager with SQL 2005 on the same machine and then reinstall it?  It doesn’t work very well mostly because SQL Reporting Services doesn’t completely uninstall.  The reinstallation of DPM won’t get past the prerequisite check.  Even though you may have uninstalled SQL from Add/Remove Programs, not everything is gone.  References to the MS$DPM2007$ database are still present, mostly in the registry.

After countless hours of research and trying all kinds of methods I finally found a way to do it.  I took pieces from several different forums and guides and came up with a solution.

I was trying to pull the old database back in but it was too corrupt and would crash the system each time.  So I got plenty of practice with this complete uninstall method and it worked every time.  The official instructions from Microsoft to uninstall SQL 2005 Manually (http://technet.microsoft.com/en-us/library/bb418915.aspx) is difficult to follow and the way I describe is easier and more complete.  This method worked for me because I wanted to go back to zero to start again.  If you are not trying to do the same, I suggest you find another way.  Follow these directions at your own risk.

Step 1. Backup what you want to keep first.  Then stop all SQL component and DPM services in services.msc.

Step 2. Uninstall from Add/Remove Programs.  DPM always uninstalled fairly well from Add/Remove programs.  SQL usually uninstalled but not close to completely.  If one of the SQL components won't uninstall, don't worry we will remove it all through the registry.  Restart after this step.

Step 3. Delete the DPM and SQL folders from wherever you installed them to.  Usually at:
C:\Program Files\Microsoft DPM
C:\Program Files\Microsoft SQL Server
C:\Program Files (x86)\Microsoft SQL Server

Step 4. Open IIS Manager and under the Default Web Site, remove both Reports and ReportServer directories.  Then go up to Application Pools and remove the ReportServer app pool.

Step 5. ****Warning: editing the registry is dangerous****  Some of this taken from Gilham Consulting wesite (http://www.gilham.org/Blog/Lists/Posts/Post.aspx?List=aab85845-88d2-4091-8088-a6bbce0a4304&ID=190).  
Time to open Regedit.exe and delete some keys.  Remove the following keys if they are still present:
HKLM\SYSTEM\CurrentControlSet\Services\MSSQLInstanceName$
HKLM\SYSTEM\CurrentControlSet\Services\MSRS 2005 Web Service
HKLM\SYSTEM\CurrentControlSet\Services\MSRS 2005 Windows Service
HKLM\SYSTEM\CurrentControlSet\Services\ReportServerInstanceName$
HKLM\SYSTEM\CurrentControlSet\Services\SQLAgent$InstanceName$
HKLM\SYSTEM\CurrentControlSet\Services\SQLBrowser
HKLM\SYSTEM\CurrentControlSet\Services\SQLWriter
HKLM\SOFTWARE\Microsoft\Microsoft SQL Native Client
HKLM\SOFTWARE\Microsoft\Microsoft SQL Server
HKLM\SOFTWARE\Microsoft\Microsoft SQL Server 2005 Redist
HKLM\SOFTWARE\Microsoft\MSSQLServer
HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Native Client
HKLM\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server
HKLM\SOFTWARE\Wow6432Node\Microsoft\MSSQLServer


Step 6. Do a search in regedit for the InstanceName$ of your SQL instance if you know what it is.  If this is a Microsoft DPM server, your instance name will be MS$DPM2007$.  If you find one and it is a value, not a key, press ctrl+tab to move to the key and then delete the whole key.  If they are under LEGACY keys you won't be able to delete them and they are fine.  There may be 4 or 5.  Close out of regedit.


Step 7. Download and install Little Registry Cleaner (http://sourceforge.net/projects/littlecleaner/).  Open this little app and let it scan the registry.  It will find several leftovers.  You can look through and select or de-select the ones you want.  These are broken links that it finds and it should be safe to remove them all.  Press the Fix button to have them removed.  Restart the server.


Step 8. Your server is now free of SQL and you can begin installing again.  DPM will make it past the pre-reqs for SQL now and as long as there aren't other issues not covered by this post, you should be able to reinstall DPM now.


Reference links:
http://www.gilham.org/Blog/Lists/Posts/Post.aspx?List=aab85845-88d2-4091-8088-a6bbce0a4304&ID=190
http://support.microsoft.com/kb/909967



    No comments:

    Post a Comment