How do I specify which Oracle client install to use? - oracle

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

Related

Connect to Oracle database Using ssis

I am all new with SSIS ( datatools 2010 ),I had installed oracle 11g enterprise edition , I want to use oracle as source ,i used OLE DB source "Microsoft OLE DB Provider For oracle" but when i test connection I get this
enter image description here
please can someone tell me what i should do .
Thank you in advance .
You need to make sure that you have the correct version of drivers installed on a server where the SSIS package will be deployed to and executed (https://learn.microsoft.com/en-us/sql/integration-services/data-flow/oracle-connector?view=sql-server-ver15#version-support) and that the bit-count is correct (not corresponding to the Windows one, but rather to the DataTools one). In case you have 32-bit and 64-bit drivers already installed, you would also need to make sure that the Data Source component in the package is picking the correct one (it will go for the first one listed in the environment variables).

Configuration of oracle 11g remote database with PL/SQL Developer 14

I need some assistance in configuring my oracle 11g database with the PL/SQL developer 14. I have installed and configured 11g client for my windows PC but the database is not show in the DBs list on PL/SQL 14 as:
But I got connected when I use PL/SQL Developer 7 as:
Actually, I want to use some advance features and plugins of PL/SQL Developer 14 which are not available in 7.
I don't use PL/SQL Developer.
However, any tool I know looks for available databases in TNSNAMES.ORA file. It looks as if version 7 "knows" its location, while version 14 doesn't.
If it (PL/SQL Developer) behaves like other Oracle-related software, then I'd suggest you to do this:
create a directory (folder), e.g. c:\oralib
put TNSNAMES.ORA file in there
create environment variable named TNS_ADMIN (uppercase!)
what does it do? It tells Oracle software where to search for TNSNAMES.ORA. Probably every Oracle software uses its own "copy" of TNSNAMES.ORA so - every time you have to work with a new database, you have to add its alias into ALL of those files (which is tedious). But, if you keep a single copy in a directory and let TNS_ADMIN point to it, you have only one TNSNAMES.ORA to maintain
set its value to path that leads to that directory: c:\oralib
restart PL/SQL Developer
hopefully, you'll see your databases
The problem has been solved. Actually, the issue was that the PL/SQL was 64 bit and the client was 32 bit that's why I had to download and install a 64 bit client which I installed and set the path to it's oci.dll file and that's solved my problem. One more thing I need to mention is that I have also created an environment variable for TNS_ADMIN and set the path to the folder which contains tnsnames.ora file.
Other answers are also appreciated.

Installing multiple oracle homes on the same machine

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.

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.

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