Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
AGENDA
Who to ask?
Q&A panel
Oracle Data Provider for .NET (ODP) Installation and Deployment Considerations
Greg Darling - Principal Support Analyst, Oracle Jenny Jackson - Senior Principal Support Analyst, Oracle
AGENDA
Oracle Data Provider for .NET (ODP) Installation and Deployment Considerations
Greg Darling - Principal Support Analyst , Oracle Jenny Jackson - Senior Principal Support Analyst, Oracle
Program Agenda
ODP Installation
Oracle.DataAccess.dll
ODP.NET pieces:
Oracle.DataAccess.dll
IS the ODP.NET provider Strongly Named Managed code OraOpsX.dll OCI.dll Oracle Client
OraOpsX(w).dll
Contains the unmanaged Oracle Call Interface (OCI) implementation code used by ODP X is the major version w is for .net 2 and higher. Example: oraops11w.dll
OCI.dll
Loaded by OraOps, entry point to OCI calls
Oracle Client
Full client Instant Client
Both ODAC and Full Client include ODP.NET ODAC bundle includes Instant Client distribution
OCI.dll will load oraociei11.dll
New features are introduced in ODAC bundle first, and then rolled into later versions of full client.
File Locations
Oracle.DataAccess.dll
%ORACLE_HOME%\ODP.NET\bin\<framework_version>
OraOpsX(w).dll
%ORACLE_HOME%\bin
OraProvCfg is used by the Oracle Universal Installer (OUI) to add/remove things from that GAC
Complete usage for OraProvCfg can be found by executing OraProvCfg at a command prompt with no arguments. OraProvCfg is .NET version specific, and found in the same location as Oracle.DataAccess.dll Example usage in the following note on My Oracle Support
HOWTO: Example use of OraProvCfg.exe to add/remove Oracle assemblies from the Global Assembly Cache (Doc ID 1169890.1)
Registry setup
Policy Files
Consists of dll and a .config file
Example: Policy.2.112.Oracle.DataAccess.dll
Used to globally forward re-direct applications looking for lower versions of ODP.NET Located at
%Oracle_home%\odp.net\PublisherPolicy\<framework_version>
DBProviderFactories entry is overwritten with most recently installed version. Policy files may be overwritten. TNSNames.ora needs to be created, or TNS_ADMIN set. ODP.NET Registry entries get added, not overwritten.
Demo
Runtime Considerations
A mismatch between ODP and OraOpsXw.dll and/or client dlls will result in System.TypeInitializationException: The provider is not compatible with the version of Oracle client
By default, a .NET app will only run with the version it is compiled with unless a) Binding Redirect is used or b) Publisher Policy files are found.
Failure to find the referenced assembly results in
System.IO.FileNotFoundException: Could not load file or assembly 'Oracle.DataAccess, Version=X.X.X, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.
ODP.NET installation DOES include Policy files by default, which globally affect the machine. These can be removed from the GAC, or overridden in app/web.config.
In a nutshell, at runtime the .NET CLR 1. Checks for binding redirects to determine what version to load
CLR checks for redirect 1. App/web.config first, which overrides 2. Publisher Policy files If no redirects are found, the version used is the version referenced at compile time.
<?xml version="1.0" encoding="utf-8" ?> <configuration> <runtime> <assemblyBinding xmlns= > <dependentAssembly> <assemblyIdentity name="Oracle.DataAccess publicKeyToken=" /> <bindingRedirect oldVersion="2.111.7.0" newVersion="2.112.1.0" /> <publisherPolicy apply="no" /> </dependentAssembly> </assemblyBinding> </runtime> <configuration>
App.config / web.config
Application configuration file, auto loaded by CLR
File Names Myapp.exe.config will automatically be loaded by the CLR when Myapp.exe is loaded. Web app automatically loads web.config
In addition to controlling ODP version loaded (via redirect) , app/web.config can be used to pass parameters to ODP when it is desired to set them at the app level rather than globally.
Tracing, Performance counters, DLLPath, other options. Requires section name="oracle.dataaccess.client in <configSections>, which gets installed by default in machine.config
Multiple Oracle Home/Side by Side Considerations - Multiple versions for use by multiple apps
In order to use Multiple versions of ODP side by side in multiple applications
Only a single version lower than 10.2.0.2.20 can be used, because it needs to have the dependencies directory (ie, %OH%\bin) first in the PATH environment variable. Policy files may need to be removed or overridden DLLPath needs to be set correctly so that ODP loads the proper dependencies. By default, each ODP version has its own registry hive and is set correctly during the installation. If you can get the proper ODP loaded, the rest of the client dependencies should fall into place.
Demo
Deployment Strategies
ODAC (Oracle Data Access Components) is a download bundle containing Windows client drivers (ODP.NET, OLEDB, ODBC, etc) and Instant Client Oracle client software. with the exception of Oracle Developer Tools for Visual Studio, ODAC is available as an OUI or xcopy bundle
The same products come as part of the full Oracle client installation as well.
with the exception of Oracle Developer Tools for Visual Studio,
Deployment Options
OUI Interactive Install ODAC IC or Full Client Xcopy Install ODAC IC Simple Unzip Approach/Redistributing Minimal set of Binaries
Xcopy Install
Streamlined deployment bundle based on xcopy strategy Copies all required dependencies Setups the registry Registers the oracle.dataaccess assembly in the GAC Modifies the machine.config for use with factory classes Pros Simple xcopy install via the command line or integration into custom install scripts. Control over installation with command line options Less problematic
Defaults
Prior to VS2010, all VS versions defaulted to ANYCPU As of VS2010, default is now x86. Command line compile still defaults to ANYCPU though.
System.TypeInitializationException
System.TypeInitializationException: The provider is not compatible with the version of Oracle client Use Microsoft Utilities such as Process Explorer/Monitor to verify what version of Oracle.DataAccess.dll and OraOpsxxw.dll are being loaded into the process space Verify version of oraocieiXX.dll for IC deployment/unzip Verify version of oraclientXX.dll for full client
System.IO.FileNotFoundException
System.IO.FileNotFoundException: System.IO.FileNotFoundException: Could not load file or assembly 'Oracle.DataAccess, Version=X.X.X, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified. Verify the version of the ODP assembly your application was compiled with and also the bitness of your application/assembly
Oracle Developer Tools for Visual Studio 32-bit Plugin for Visual Studio
Allows connectivity from Server Explorer There is no 64-bit Developer Tools because there is no 64bit release of the Visual Studio IDE . If developing on x64 and need ODT, then you will need to install the 32-bit ODT and ODP.NET into a unique home and the 64-bit ODP.NET and dependencies into another Separate Install Bundles
Who to ask?
Q&A panel
THANK YOU