Oradim not able to delete an Oracle database windows service

As an intermediate step in a database upgrade process, there is one step to delete an Oracle database Windows Service using the following command:
oradim.exe -delete -sid POSDB

But, I received the following error message:
O/S-Error: (OS 1072) The specified service has been marked for deletion.

I tried many things, like:
Closing the Task Manager.
Ensuring event viewer, Microsoft Management Console, Services ,… are closed.
But, I’m still getting the same error.

As a last resort, I restarted the server (to release any hidden locks on this service). Once, restarted, I found that the above service is deleted and disappeared from the Services list.

Another two option that I saw some where on the internet, but I didn’t try myself:
You can manually delete the registry key for your service, located at HKLM\SYSTEM\CurrentControlSet\Services,

after that you won’t see the service in service control manager (need to refresh or reopen to see the change),and you can reinstall the service as usual.

Same as the following solution. The following will work without restarting the machine:
Search the Registry \ HKEY_LOCAL_MACHINE for < Your Service Name > (both keys and values)
Set “Legacy” value to 0

Thanks
Ahmed

Leave a comment