Multiple Oracle homes on Windows, which one is used?

When having multiple Oracle homes on Windows, how is decided which Oracle home (in the registry) is used by an Oracle binary? Which NLS_LANG or TNS_ADMIN setting from the registry is used?

The answer is binary, path, oracle.key, registry… and which for Windows.

When you invoke a binary or in this case an Oracle binary or when a SQL*Net client .dll is being searched, Windows will search it’s environment path. I use ‘which for Windows’ from GNU32 to see the full path for this (http://gnuwin32.sourceforge.net/packages/which.htm).

For instance, if C:\SQLPLUS.EXE is invoked, Oracle will search it’s path (try ‘c:\which sqlplus.exe’). This could return something like ‘c:\oracle\product\10.2.0\db_1\bin\sqlplus.EXE’.

Now look for the file oracke.key in this directory (‘c:\oracle\product\10.2.0\db_1\bin\oracle.key’). The information inside this file is normal text: SOFTWARE\ORACLE\KEY_OraDb10g_home1

Now open the registry and add ‘HKEY_LOCAL_MACHINE\’ to this string, and you will find the right HOME: [HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraDb10g_home1].

This is the Oracle home used!

Tagged , , , , . Bookmark the permalink.

Comments are closed.