How to Un-Install SQL Server 2005 from Registry

Hi SQL Server Folks,

I had come across situation multiple times when i need to install SQL Server 2008 but before that need to un-install SQL Server 2005. So many times it happens with me that if i am remvoving SQL Server 2005 from Add\Remove programs then it’s failing. In that case you can follow below steps that describes how to uninstall SQL Server 2005 by deleteing resistry keys.

  1.  Taking full Database backups of the System Databases and User Databases i.e. in .BAK format. (Also if we have RS – take backup of the Encryption Key).
  2. Next take Transaction Log backup of the User Databases i.e. in .TRN format.
  3. Take the backup of the registry – Start à Run à Type – regedit à Highlight  – My computer – right click and choose Export and save it in desktop or disk drive.
  4. Take a full backup of Registry key. Details at http://support.microsoft.com/kb/322756
  5. Please make a copy of DATA folder under %ProgramFiles%\Microsoft SQL Server\MSSQL.1\MSSQL\Data into a different drive or location or server.
  6. Script out of the Logins for SQL 2005? We can follow below KB Articles – 918992 or 246133. If you already have the logins script then it’s really good.

 How to transfer the logins and the passwords between instances of SQL Server 2005

http://support.microsoft.com/kb/918992

 How to transfer logins and passwords between instances of SQL Server

http://support.microsoft.com/kb/246133

 Script out all the jobs in MSDB database? I found that you can script out all jobs from Management Studio. If you already have the Job scripts then it’s really good. 

  1. Open the server in the Object Explorer.
  2. Open the “Object Explorer Details” window.
  3. In the “Object Explorer Details” window, drill down to “SQL Server Agent”
  4. Drill down to “Jobs”
  5. Select the jobs you want to script.
  6. Right click and select “Script Job as”, then “Create To”, and select where you want them scripted to.

 Links –   Script out Jobs in SQL Serverhttp://blogs.msdn.com/jenss/archive/2009/01/27/script-out-jobs-in-sql-server.aspx

Job.Script Method – http://technet.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.agent.job.script(SQL.90).aspx

 Just for ready reference:

KB915845 – SQL Server Agent jobs fail when the jobs contain job steps that use tokens after you install SQL Server 2005 Service Pack 1

http://support.microsoft.com/kb/915845

           Steps that we need to perform during Uninstallation of SQL 2005 SP3.

 Use the following KB Article 909967 to uninstall SQL 2005 Manually.

How to uninstall an instance of SQL Server 2005 manually

http://support.microsoft.com/kb/909967

OR  How to: Uninstall an Existing Instance of SQL Server 2005 (Setup)

 http://technet.microsoft.com/en-us/library/ms143412(SQL.90).aspx

 Use ‘Windows Installer Cleanup Utility’ and ensure that there is SQL components on the server. If any just select the component and remove them.

Windows Installer Cleanup Utility

http://support.microsoft.com/kb/290301

 I advice please don’t use this Utility, I created so many problems in your new SQL Server install and more of that it’s not supported by Microsoft now.

The steps that I would manually (For un-installation of uninstall SQL 2005) do during the call would be as shown below.

 Step-1

I perform the steps mentioned in Below is the steps that we need to do before uninstalling SQL 2005 SP3.

 Step-2

Go to Add/Remove Programs – Remove all the components of SQL Server 2005 as shown below.

Microsoft SQL Server 2005

Microsoft SQL Server 2005 Backward Compatibility

Microsoft SQL Server 2005 Best Practices Analyzer

Microsoft SQL Server 2005 Books Online

Microsoft SQL Server Native Client

Microsoft SQL Server 2005 Setup Support Files

Microsoft SQL Server VSS Writer

MSXML 6 Service Pack 2 (KB954459)

SQLXML4

Use ‘Windows Installer Cleanup Utility’ and ensure that there is SQL components on the server. If any just select the component and remove them.

Windows Installer Cleanup Utility

http://support.microsoft.com/kb/290301

 Step-3

Delete  following registry keys (If they exist):

 i) For Default Instance : HKLM\Microsoft\Microsoft SQL Server\

Or,

For Named Instance : HKLM\Microsoft\Microsoft SQL Server\<Instance_Name>

 Step-3

Delete/Rename following Registry keys for the services and also make a note of the service name :

 i) For Integration Services:

 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MsDtsServer –  Please remember Integration Services is a Shared component, so removing this might affect other instances which are in working condition.

 ii) For Other services of Default Instance:

 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SQLSERVERAGENT

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSSQLSERVER

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSSQLFDLauncher

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSSQLServerOLAPService

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ReportServer

 

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet001\Services\SQLSERVERAGENT

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet001\Services\MSSQLSERVER

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet001\Services\MSSQLFDLauncher

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet001\Services\MSSQLServerOLAPService

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet001\Services\ReportServer

 

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet002\Services\SQLSERVERAGENT

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet002\Services\MSSQLSERVER

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet002\Services\MSSQLFDLauncher

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet002\Services\MSSQLServerOLAPService

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet002\Services\ReportServer

 

iii) For Other services of Named Instance:

 

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SQLAgent$<Instance_Name>

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSSQL$<Instance_Name>

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSSQLFDLauncher$<Instance_Name>

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSOLAP$<Instance_Name>

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ReportServer$<Instance_Name>

 

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet001\Services\SQLAgent$<Instance_Name>

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet001\Services\MSSQL$<Instance_Name>

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet001\Services\MSSQLFDLauncher$<Instance_Name>

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet001\Services\MSOLAP$<Instance_Name>

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet001\Services\ReportServer$<Instance_Name>

 

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet002\Services\SQLAgent$<Instance_Name>

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet002\Services\MSSQL$<Instance_Name>

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet002\Services\MSSQLFDLauncher$<Instance_Name>

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet002\Services\MSOLAP$<Instance_Name>

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet002\Services\ReportServer$<Instance_Name>

 

Step-4

Remove the following services from command prompt :

 i) For Integration Services:

 C:\>sc.exe delete MsDtsServer

[SC] DeleteService SUCCESS

 ii) For Other services of Default Instance:

 Microsoft Windows [Version 5.2.3790]

(C) Copyright 1985-2003 Microsoft Corp.

 C:\>sc.exe delete SQLSERVERAGENT

[SC] DeleteService SUCCESS

 C:\>sc.exe delete MSSQLSERVER

[SC] DeleteService SUCCESS

 C:\>sc.exe delete MSSQLFDLauncher

[SC] DeleteService SUCCESS

 C:\>sc.exe delete MSSQLServerOLAPService

[SC] DeleteService SUCCESS

 C:\>sc.exe delete ReportServer

[SC] DeleteService SUCCESS

 Or,

 For Other services of Named Instance:

 Microsoft Windows [Version 5.2.3790]

(C) Copyright 1985-2003 Microsoft Corp.

 C:\>sc.exe delete SQLAgent$<Instance_Name>

[SC] DeleteService SUCCESS

 C:\>sc.exe delete MSSQL$<Instance_Name>

[SC] DeleteService SUCCESS

 C:\>sc.exe delete MSSQLFDLauncher$<Instance_Name>

[SC] DeleteService SUCCESS

 C:\>sc.exe delete MSOLAP$<Instance_Name>

[SC] DeleteService SUCCESS

 C:\>sc.exe delete ReportServer$<Instance_Name>

[SC] DeleteService SUCCESS

 

Step-5

Delete/Rename any folders on the hard drive related to that instance. e.g. If default installation path is chosen for SQL Installation dir and SQL Data dir then you would like to delete the following folders :

 Before doing the Delete please make a copy of DATA folder under %ProgramFiles%\Microsoft SQL Server\MSSQL.1\MSSQL\Data

 For 32-bit SQL on 32-bit machine OR 64-bit SQL on 64-bit machine, delete/rename the following folders :

 For Default Instance:

%ProgramFiles%\Microsoft SQL Server\MSSQL.1

%ProgramFiles%\Microsoft SQL Server\MSAS.x

%ProgramFiles%\Microsoft SQL Server\MSRS.x

 In WOW mode (For 32-bit SQL on 64-bit machine), delete/rename the following folders

 Before doing the Delete please make a copy of DATA folder under %ProgramFiles(x86)% \Microsoft SQL Server\MSSQL.1\MSSQL\Data

 For Default Instance:

%ProgramFiles(x86)% \Microsoft SQL Server\MSSQL.1

%ProgramFiles(x86)% \Microsoft SQL Server\MSAS.x

%ProgramFiles(x86)% \Microsoft SQL Server\MSRS.x

 Step-6

Reboot the Windows Server after above steps.

 Now you should be able to re-install the cleaned up instance.

 How to: Restore a Database Backup (SQL Server Management Studio)

http://msdn.microsoft.com/en-us/library/ms177429(SQL.90).aspx

How to: Restore a Transaction Log Backup (SQL Server Management Studio)

http://msdn.microsoft.com/en-us/library/ms177446(SQL.90).aspx

  • Restore the Logins and Jobs by running the Logins & Jobs scripts.

 

Hope this Post will help some one and will save time for them.

Thanks for reading, Stay glue for more upcoming stuff’s

Advertisements

One Response

  1. Reblogged this on go2analytics and commented:
    Keep this as a local copy reference.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: