ASP - How to locate the ORACLE_HOME key in registry

Asked By Abhishek Tiwari on 15-Dec-06 06:12 AM
I am facing a problem locating the ORACLE_HOME key inregistry.

I has a client installed with me and "HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\VOBHOME2.0" used to fetch me the ORACLE_HOME key value.

But after I installed complete database, the above registry entry is gone. I get something like KEY_OraDb10g_home1

This looks a case of hit and try which I cant afford.
I need this to locate the listener.ora, init.ora and sqlnet.ora for some manipulation

can anyone help me with this in VBscript?


locate the ORACLE_HOME key in registry - K Pravin Kumar Reddy replied to Abhishek Tiwari on 15-Dec-06 06:18 AM

under HKLM\Software\Oracle you will find several keys (registry folders) e.g.
ALL_HOMES - some info about homes
HOME<0-nn> - pre 10.x Home settings, not sure which products uses this or KEY_ structure
KEY_<home name> - 10.x homes

The string ORACLE_HOME defines the path for the related Oracle Home


I need to do this programmatically - Abhishek Tiwari replied to K Pravin Kumar Reddy on 15-Dec-06 06:31 AM

Hi Kevin,
Thanks for the prompt reply.
I have seen the directory structure and that is what has confused me. Finding so many keys, How do I know which ones to look into. And I need to do this in code ,which would take only fully qualified entries. So taking care of everything I would be hardcoding much of the stuff, and still would not sure if I would really find things there. May be someone uses a Oracle Home which nowhere matches the OraDb10g_home<0-n> format or simply HOME<n> format.

may be MYORA1 etc...

Do you have any idea how Oracle does it? or can you suggest alternative way without going through the pains of registry?

try this vbscript - sundar k replied to Abhishek Tiwari on 15-Dec-06 07:25 AM

strHost = "."

Const HKLM = &H80000002

'connect to current machine registry

Set objReg = GetObject("winmgmts://" & strHost & "/root/default:StdRegProv")

'check the registry for this particular path
'and return the values to an array - arrsubkeys

objReg.EnumKey HKLM, strRoot, arrSubKeys
'Enumerate the array and display the Name
For Each strSubk In arrSubKeys
    intRet = objReg.GetStringValue(HKLM, strRoot & strSubK, _
        "KEY_OraDb10g_home1", strValue)
    If (strValue <> "") And (intRet = 0) Then
 'strvalue wil be the value your ORACLE_home
        Debug.Print strValue
    End If

it wont work for all versions - Abhishek Tiwari replied to sundar k on 15-Dec-06 08:11 AM
hi venkatesh,
while this will work for Oracle 10g, it wont work for 8i and 9i, and not even for 10g if the user has changed the default home name. something like myOraHome1

I just experimented with another workaround, no finished yet but hope it might work. Its like reading the registry for
This gives location of oracle installation. Something like "C:\Program Files\Oracle\Inventory" In this directory there is a subdirectory ContentsXML,
with a file inventory.xml. The file contains the home name and db locations on physical drive, which can be used to locate the listener.ora and other files.

what do you think about this? any alternate suggestions?

I do agree with Inventory.xml! - sundar k replied to Abhishek Tiwari on 16-Dec-06 08:42 AM

Information Taken from C:\Program Files\Oracle\Inventory\ContentsXML\inventory.xml

Name Location
OraDb10g_home1 c:\oracle\ora10g