Installing multiple oracle homes on the same machine - oracle

I have Oracle 11g installed on my system and want to install 12c now. Read articles ( Oracle docs and general) which suggest that i can do so in different homes.
But when I try to install 12c (12.2.0.1 release 2) , it does not allow me to do so as it says "oracle _home (in environment variables) already defined and does not match the path specified (during installation)".
Am I supposed to specify the paths manually (or change it in the env variables) and if so then how do i accommodate different paths for two Oracle_homes for both versions in the environment variables.
A search on this portal gives results that does not answer my query.
How do I get around the installation?

You should not install more than one (i.e. one each for 32bit and 64bit) Oracle Client on one machine, I could also not imagine any reason for it.
Anyway, if you like to install more than one Oracle Client delete Environment Variable ORACLE_HOME and ORACLE_BASE from your computer, if existing. Then modify PATH Environment Variable and remove all directories of your first Oracle installation from PATH.
After that it should be no problem to install another Oracle Client. You must install it into a different directory, otherwise you mess up the installation and I assume afterwards none of them will work properly.
In order to use one or the other you have to set ORACLE_HOME and PATH Environment Variable accordingly, you cannot use them together! According Managing Oracle Home Directories you should have a "Home Selector" tool but I never used this.
Note, some components (e.g. "Oracle Provider for OLE DB") you can install only once (i.e. one each for 32bit and 64bit). This limitation is caused by Windows COM. Other drivers for example "Oracle Data Provider for .NET" may also fail due to version mismatch and/or policy settings in GAC.

Related

Addressing ORACLE_HOME values diversity

I have checked my ORACLE_HOME in 3 different ways in my windows 32-bits PC in this order:
1.- In cmd, if I type echo %ORACLE_HOME% the result is just:%ORACLE_HOME%, so no current path. Why?
2.- In regedit, under Computer\HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraClient11g_home1, the stored value is C:\oracle\product\11.2.0\client_1
3.- Finally, in the variable Path in Environment variables these are the oracle-related ones values (I disguise the others by using asterisks) in the same order they appear:
C:\ProgramData\Oracle\Java\javapath;C:\oracle_python\instantclient_11_2;C:\oracle\32bit\product\11.2.0\client_1\bin;*;*;C:\oracle\product\11.2.0\client_1\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;*;*;*;*;*;*;*;*;C:\Program Files\Java\jdk1.7.0_60\bin
In addition, I operate with Oracle only in two ways basically: I use SQL Developer daily but also I do some scripting in Python by using the cx_Oracle library.
My question is whether I have properly optimized the ORACLE_HOME variable or not, I mean would an expert in Oracle agree with this current scenario?
When you do echo %ORACLE_HOME% then you interrogate the Environment variable ORACLE_HOME. In your case it is not set.
Some tools use (only) the Environment variable for ORACLE_HOME, other use the Registry value. I think most programs use both and give precedence over Environment variable.
I assume for your Oracle Client following folders are relvant:
C:\oracle_python\instantclient_11_2
C:\oracle\32bit\product\11.2.0\client_1\bin
C:\oracle\product\11.2.0\client_1\bin
Looks like you installed Oracle client three times (all into different folder). I do not consider this as an optimized setup. My recommendation is to remove all of them and make one single proper installation.
Check also How to uninstall / completely remove Oracle 11g (client)? in case of problems.

How does System.Data.OracleClient finds installed OracleClient

I wonder how does library System.Data.OracleClient finds installed on machine OracleClient. I've reinstalled the client, but still get error "OracleClient requires Oracle client software", which seem rather suspicious, because client is installed on pc, it has entries in registry and path to oracle client in PATH variable.
This works for me:
Add the environment variable ORACLE_HOME, with the value equal to the base of the install directory (e.g. C:\oracle\product\10.2.0\client_1)
Make sure that %ORACLE_HOME%\bin\ is in the PATH (the setup program should have already put it in there)
Agreed that using ODP.NET is better than deprecated System.Data.OracleClient.

Determing the ORACLE root

I recently installed Oracle Express Edition 10g on my Ubuntu from apt-get. My problem is I dont know exactly in which directory the Oracle resides. I want to set ORACLE_HOME to the path where Oracle has been installed, so that i can create database from terminal. I'd appreciate any help. Thanks
dpkg -L oracle-xe
Will list all the files installed by the oracle-xe package. From that, you should be able to figure out a suitable value for ORACLE_BASE and ORACLE_HOME.
It's possible that the installation has scattered the files around the filesystem, following the usual pattern for Unix applications (eg executables in /usr/bin, libraries in /usr/lib, data in /var/lib/oracle-xe). In that case, there might not be a sensible value for ORACLE_HOME.
According to answers to a very similar question, it seems that the important thing is that ORACLE_HOME points to the location where your static files (code, libraries, and resources) are installed. Something like:
export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
I'm not sure how Oracle then knows where to create the database. Hopefully it doesn't just put it in the ORACLE_HOME, because that's in /usr, which should be read-only.

How do I specify which Oracle client install to use?

I have a server with both 10g and 11g clients installed. How do I setup the connection string to tell my ASP.NET application to use the second client which is 11g (i.e. OraClient11g_home2)?
From documentation:
In ODP.NET 10.2.0.2.20 and higher, ODP.NET can run more than one active Oracle Home concurrently without requiring any special setup by the administrator.
When ODP.NET is installed, the DLL search path will be based on the following order:
directory of the application/executable
directory specified by HKEY_LOCAL_MACHINE\Software\Oracle\ODP.NET\<version>\DllPath
directories specified by the PATH environment variable
Upon an ODP.NET installation, the DllPath registry value of type REG_SZ will be set to the %ORACLE_HOME%\bin directory where the corresponding dependent DLLs are installed.
Make sure you are using ODP.NET as a provider and set your ORACLE_HOME environment variable.
I fid Oracle Locator Express to be a useful tool. This will let you change your ORACLE_HOME on the fly:
Oracle Locator Express

Why doesn't ODP.NET 11 xcopy deployment work on a machine with Oracle DB 10 installed?

I have an app that uses a local version of ODAC 11 below the directory that the .exe file is in. The idea is that we want our app to use the local ODAC 11 regardless of what else the user has installed on her machine.
Oracle.DataAccess.dll is in the same directory as the .exe.
It works fine when the client machine has no Oracle client installed, but I get an error when starting it on a machine with Oracle Database 10.2.0.something installed:
The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception.
[Stack Trace]
The provider is not compatible with the version of Oracle client
OracleException
at Oracle.DataAccess.Client.OracleInit.Initialize()
at Oracle.DataAccess.Client.OracleConnection..cctor()
I'm guessing that this has something to do with the runtime binding policy, but a search for "Oracle/ODAC/ODP.NET runtime binding policy" on Google has not turned up anything useful.
Does anyone know how to resolve the issue?
If not this specific issue, can someone point me towards an overview of how to do what I want to do: make sure that my application uses the ODAC 11 no matter what?
So as I understand it, the issue was that while Oracle.DataAccess.dll was in the same directory as the app, it could not find its lower-level homies (oci, et al), hence the compatibility error.
Turns out that if you want an application to work with ODAC 11 xcopy deployment regardless of what else the user may have installed on her machine, you need to do 2 things:
Set the PATH environment variable for the process. (I was already doing this.)
Set the ORACLE_HOME environment variable for the process. (I was not doing this.)
Environment.SetEnvironmentVariable("PATH", Environment.CurrentDirectory + "\\oracle\\11.1\\odac;" + Environment.CurrentDirectory + "\\oracle\\11.1\\odac\\bin;", EnvironmentVariableTarget.Process);
Environment.SetEnvironmentVariable("ORACLE_HOME", Environment.CurrentDirectory + "\\oracle\\11.1\\odac", EnvironmentVariableTarget.Process);
EDIT: It's also important to note that Oracle will throw this error not just for environmental issues, but also if one of the files is missing on the target machine. I got this same error on other machines despite the Environment settings because I had Subversion set to ignore directories called "bin", so the OraOps DLL was not being copied to the client.
An article titled "Deploying ODP.NET with Oracle Instant Client" found at http://alderprogs.blogspot.com/2009/04/deploying-odpnet-with-oracle-instant.html gave what was for me about the best explanation of how to deliver a stripped down xcopy type deployment with your application. Only 5 Oracle DLLs required for support.
That said the answers by ObiWanKenobi and Josh Kodroff provides important additional info which matches with my experience.
Add to that: http://www.brothersincode.com/post/Oracle-ODPnet-xcopy-deployment-for-aspnet.aspx
You want to force your ODP.NET drivers to use the copy of oci.dll that is in your local folder, instead of the one already installed.
You can force this by either
setting the PATH variable so the system finds your copy of of oci.dll first (as in the answer by Josh Kodroff)
or
you can use ODP.NET configuration section in app.config (or web.config) to explicitly set the value of "DllPath".
For details, see http://ora-00001.blogspot.com/2010/01/odpnet-minimal-non-intrusive-install.html and http://database.in2p3.fr/doc/oracle/Oracle_Database_11_Release_1_(11.1)_Documentation/win.111/e10927/featConfig.htm
If you're using oracle client 10.2.0.1 or 10.2.0.2, Oracle Note 215255.1 indicates that if you apply patchset 10.2.0.3 it fixes the issue. Get the 10.2.0.3 database patch (852MB) and patch the client home. Yes, it's the full database server patchset, but it applies to the client as well.

Resources