80

How to uninstall or completely remove Oracle 11g (client)?

Running deinstall.bat doesn't work.

Edit: Further discussion related to why this question was closed and deleted: Why was this question related to uninstalling the Oracle Database Client deleted?

Amira Bedhiafi
  • 8,088
  • 6
  • 24
  • 60
Yves
  • 12,059
  • 15
  • 53
  • 57

4 Answers4

142

Assuming a Windows installation, do please refer to this:

http://www.oracle-base.com/articles/misc/ManualOracleUninstall.php

  • Uninstall all Oracle components using the Oracle Universal Installer (OUI).
  • Run regedit.exe and delete the HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE key. This contains registry entires for all Oracle products.
  • Delete any references to Oracle services left behind in the following part of the registry: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Ora* It should be pretty obvious which ones relate to Oracle.
  • Reboot your machine.
  • Delete the "C:\Oracle" directory, or whatever directory is your ORACLE_BASE.
  • Delete the "C:\Program Files\Oracle" directory.
  • Empty the contents of your "C:\temp" directory.
  • Empty your recycle bin.

Calling additional attention to some great comments that were left here:

  • Be careful when following anything listed here (above or below), as doing so may remove or damage any other Oracle-installed products.
  • For 64-bit Windows (x64), you need also to delete the HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ORACLE key from the registry.
  • Clean-up by removing any related shortcuts that were installed to the Start Menu.
  • Clean-up environment variables:
    • Consider removing %ORACLE_HOME%.
    • Remove any paths no longer needed from %PATH%.

This set of instructions happens to match an almost identical process that I had reverse-engineered myself over the years after a few messed-up Oracle installs, and has almost always met the need.

Note that even if the OUI is no longer available or doesn't work, simply following the remaining steps should still be sufficient.

(Revision #7 reverted as to not misquote the original source, and to not remove credit to the other comments that contributed to the answer. Further edits are appreciated (and then please remove this comment), if a way can be found to maintain these considerations.)

Community
  • 1
  • 1
ziesemer
  • 27,712
  • 8
  • 86
  • 94
11

There are some more actions you should consider:

  • Remove Registry Entries for MS Distributed Transaction Coordinator (MSDTC)

Note: on the Internet I found this step only at a single (private) page. I don't know if it is required/working or if it breaks anything on your PC.

  • Open Regedit

  • Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\MSDTC\MTxOCI

  • Add an x before each string for OracleOciLib, OracleSqlLib, and OracleXaLib

  • Navigate to HKEY_LOCAL_MACHINE\Software\Wow6432Node\Microsoft\MSDTC\MTxOCI

  • Add an x before each string for OracleOciLib, OracleSqlLib, and OracleXaLib

    Otherwise these files, if they exist, will still be in use next time you reboot, and unable to be deleted.

  • Remove environment variable ORACLE_HOME, ORACLE_BASE, TNS_ADMIN, NLS_LANG if exist

Check also Oracle doc to find all Oracle related environment variables, however apart from variables listed above they are very rarely used on Windows Client: Oracle Environment Variables

  • Unregister oci.dll

    • Open a command line window (Start Menu -> Run... -> cmd)

    • Enter regsvr32 /u oci.dll, resp. %windir%\SysWOW64\regsvr32 /u oci.dll

    • In some cases the file %ORACLE_HOME%\bin\oci.dll is locked and you cannot delete it. In such case rename the file (e.g. to oci.dll.x) and reboot the PC, afterwards you can delete it.

  • Remove Oracle .NET assemblies from Global Assembly Cache (GAC). You do this typically with the gacutil utility, if available on your system. Would be like this:

      gacutil /u Policy.10.1.Oracle.DataAccess
      gacutil /u Policy.10.2.Oracle.DataAccess
      gacutil /u Policy.1.102.Oracle.DataAccess
      gacutil /u Policy.1.111.Oracle.DataAccess
    
      gacutil /u Policy.2.102.Oracle.DataAccess
      gacutil /u Policy.2.111.Oracle.DataAccess
      gacutil /u Policy.2.112.Oracle.DataAccess
      gacutil /u Policy.2.121.Oracle.DataAccess
      gacutil /u Policy.2.122.Oracle.DataAccess
    
      gacutil /u Policy.4.112.Oracle.DataAccess
      gacutil /u Policy.4.121.Oracle.DataAccess
      gacutil /u Policy.4.122.Oracle.DataAccess
    
      gacutil /u Oracle.DataAccess
      gacutil /u Oracle.DataAccess.resources
    
      gacutil /u Policy.4.121.Oracle.ManagedDataAccess
      gacutil /u Policy.4.122.Oracle.ManagedDataAccess
      gacutil /u Oracle.ManagedDataAccess
      gacutil /u Oracle.ManagedDataAccess.resources
      gacutil /u Oracle.ManagedDataAccessDTC
      gacutil /u Oracle.ManagedDataAccessIOP
      gacutil /u Oracle.ManagedDataAccess.EntityFramework
    
    • Entry System.Data.OracleClient should not be removed, this one is installed by Microsoft - not an Oracle component!
  • Instead of gacutil /u ... you can also use OraProvCfg /action:ungac /providerpath:... if OraProvCfg is still available on your system. You may find it at %ORACLE_HOME%\odp.net\managed\x64\OraProvCfg.exe.

  • With a text editor, open XML Config file %SYSTEMROOT%\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config and delete branch <oracle.manageddataaccess.client>, if existing.

  • Do the same with:

         %SYSTEMROOT%\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config
         %SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319\Config\machine.config
         %SYSTEMROOT%\Microsoft.NET\Framework64\v4.0.30319\Config\web.config
         %SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319\Config\web.config
    

    Instead of editing the XML Config file manually you can also run (if OraProvCfg.exe is still available on your system):

     %ORACLE_HOME%\odp.net\managed\x64\OraProvCfg.exe /action:unconfig /product:odpm /frameworkversion:v4.0.30319 
     %ORACLE_HOME%\odp.net\managed\x86\OraProvCfg.exe /action:unconfig /product:odpm /frameworkversion:v4.0.30319
     %ORACLE_HOME%\odp.net\managed\x64\OraProvCfg.exe /action:unconfig /product:odp /frameworkversion:v4.0.30319 
     %ORACLE_HOME%\odp.net\managed\x86\OraProvCfg.exe /action:unconfig /product:odp /frameworkversion:v4.0.30319
    
  • Check following Registry Keys and delete them if existing

      HKLM\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\ODP.Net
      HKLM\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\ODP.Net
      HKLM\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.ManagedDataAccess
      HKLM\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.ManagedDataAccess.EntityFramework6
      HKLM\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\odp.net.managed
      HKLM\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.DataAccess.EntityFramework6\
    
      HKLM\SOFTWARE\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\ODP.Net
      HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\ODP.Net
      HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.ManagedDataAccess
      HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.ManagedDataAccess.EntityFramework6
      HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\odp.net.managed
      HKLM\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.DataAccess.EntityFramework6\
    
      HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Application\Oracle Data Provider for .NET, Managed Driver
      HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Application\Oracle Data Provider for .NET, Unmanaged Driver
      HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Application\Oracle Provider for OLE DB
    
  • Delete the Inventory folder, typically C:\Program Files\Oracle\Inventory and C:\Program Files (x86)\Oracle\Inventory

  • Delete temp folders %TEMP%\deinstall\, %TEMP%\OraInstall\, %TEMP%\OraInstall\ and %TEMP%\oraremservicev2 (e.g %TEMP%\CVU_11.1.0.2.0_domscheit) if existing.

  • Delete service OracleRemExecServiceV2 and Oracle%ORA_HOME_NAME%MTSRecoveryService

    sc stop OracleRemExecServiceV2
    sc delete OracleRemExecServiceV2
    rmdir %TEMP%\oraremservicev2 /S /Q
    
    sc stop Oracle%ORA_HOME_NAME%MTSRecoveryService
    sc delete Oracle%ORA_HOME_NAME%MTSRecoveryService
    
Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
  • To remove items from the GAC, you might need to use gacutil.exe which comes with visual Studio. 'gacutil /u Oracle.DataAccess' for example. – scott-pascoe Apr 04 '17 at 18:06
  • If you couldn't find GAC , follow [this](https://blogs.msdn.microsoft.com/mortens/2010/11/09/access-denied-trying-to-uninstall-assemblies-from-gac/) – Gokul Apr 14 '17 at 12:56
  • Also delete oracle* and policy*Oracle* folders from "C:\Windows\Microsoft.NET\assembly\GAC_32" and "C:\Windows\Microsoft.NET\assembly\GAC_64". – Gokul Apr 14 '17 at 12:59
  • Also delete OraInstall* folders from "C:\Users\\AppData\Local\Temp" – Gokul Apr 14 '17 at 13:43
  • @Gokul, better write: delete from folder `%TEMP%` which can point to different folder. – Wernfried Domscheit Apr 14 '17 at 15:58
  • I don't think you should delete anything directly from GAC assembly folders. Use gacutil tool for this. – Wernfried Domscheit Jul 23 '17 at 11:53
7

Do everything suggested by ziesemer.

You may also want to remove from the registry:

HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\<any Ora* drivers> keys     

HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers<any Ora* driver> values

So they no longer appear in the "ODBC Drivers that are installed on your system" in ODBC Data Source Administrator

ranni rabadi
  • 194
  • 2
  • 9
  • Don't forget the 32 bit entry on a 64 bit Windows: `HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI\...` – Wernfried Domscheit Oct 14 '15 at 07:20
  • 4
    Be careful with `HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI\Microsoft ODBC for Oracle`. This driver is provided by Microsoft, i.e. part of your Windows installation. When you remove it you will not get it back when you make a new Oracle Client installation. – Wernfried Domscheit Dec 23 '15 at 07:32
2

Do everything suggested by ziesemer.

You may also want to :

  • Stop the Oracle-related services (before deleting them from the registry).
  • In the registry, look not only for entries named "Oracle" but also e.g. for "ODP".