Oracle Uninstall Using a DS Job
I was given the task to cleanly uninstall Oracle remotely. The issue with older versions of Oracle is the new Oracle installer UI doesn't work with it - at least that's what I've found in our environment. So I scripted a DS job in stages to do this.
I’ve constructed this in 8 parts to allow the various parts to continue even if one fails.
The three registry entries are deleted first in no particular order and allowed to continue even if they fail as they will only fail if the key is not there.
The three keys deleted are:
REG DELETE HKLM\software\oracle /f REG DELETE HKLM\system\currentcontrolset\services\oracledefault_homeclientcache80 /f REG DELETE HKLM\system\currentcontrolset\services\OracleClientCache80 /f
The “REG DELETE” tells the registry to delete the following key and the /f switch forces the deletion.
Next I delete the shortcuts on the programs menu using this vbscript:
' Delete shortcuts
' vbscript
' This is needed for all file manipulation
Dim filesys
Set filesys = CreateObject("Scripting.FileSystemObject")
' This is needed for accessing special folders
Set WshShell = WScript.CreateObject("WScript.Shell")
' Deleting Folders
' If filesys.FolderExists(wshShell.SpecialFolders("AllUsersStartMenu")&"\Programs\Oracle*") Then
filesys.DeleteFolder(wshShell.SpecialFolders("AllUsersStartMenu")&"\Programs\Oracle*")
' End If
To delete the oracle folders the core40.dll process has to be stopped. To do this remotely I’ve used a simple batch script
for /f "tokens=2" %%a in ('tasklist ^| find /i "core40.dll"') do taskkill /pid %%a
This uses tasklist to look up the PID of core40.dll and then kill it.
The system must now be rebooted so a reboot task is added in.
On reboot the job continues and can now remove the two Oracle folders listed:
- C:\orant
- C:\program files\oracle
Using the two following vbscripts
' Delete c:\orant
' vbscript
dim filesys
Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FolderExists("c:\orant\") Then
filesys.DeleteFolder "c:\orant"
End If
' Delete c:\Program files\oracle
' vbscript
dim filesys
Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FolderExists("c:\Program files\oracle\") Then
filesys.DeleteFolder "c:\Program files\oracle"
End If
The last run script task then on "continue" is set to "run a job" the new Oracle installation job.
Here is the layout in DS:
I'm sure there are other ways of doing this using VB as one script with error checking etc and welcome any comments/criticism with my methods. HTH C


Nice
Wow I was just looking into how to do this. What version of Oracle client is it removing? Looks kinda like 8 is that right?
Shouldn't be too hard to modify it to work with 9.
- Matt
Version
hi works with 6 and 8 I haven't tried it with 9 but i guess checking the reg keys and install paths would be all you need to alter to use this
C
Hojiblanca
Would you like to reply?
Login or Register to post your comment.