38

I have to connect Oracle 11g DB from .NET code. For that purpose I installed ODP.NET bur after reading some forum posts I recognized that I need Oracle Client installation too.

Is that true? I see that the Oracle Client has a size of ca. 2GB!!! Do I really need to install such a huge client only to be able to connect Oracle DBs?

llasarov
  • 2,064
  • 5
  • 27
  • 40
  • this could help: http://stackoverflow.com/questions/1160218/is-odp-net-required-for-oracle-11g-client anyway you say you read some forum posts, can you link them here so that people can check? – Davide Piras Oct 19 '11 at 10:30

7 Answers7

38

Alex Keh from Oracle in aug 2013 says:

Managed ODP.NET is released. It is currently part of the Oracle DB 12c client. To use managed ODP.NET, you have to download and install the DB client. From there, you can extract just the managed ODP.NET assembly and setup files. These files are less than 10 MB and can be deployed to any target machines.

Currently, we are packaging a stand alone managed ODP.NET release and ODAC 12 release that will be much smaller. This will be released on OTN shortly.

If you can wait a couple of days, ODAC 12c will be out on OTN and you can download that version. That will be our latest and greatest managed ODP.NET version

====

We do not plan to put managed ODP.NET on NuGet. We believe that the managed ODP.NET download with ODAC will provide the same benefits of NuGet in terms of assembly isolation and download size.

There's a thread discussing whether Oracle should provide managed ODP.NET NuGet support. Once you use ODAC 12c, I would like to know your thoughts on whether NuGet support is still necessary. https://forums.oracle.com/thread/2559445

Nuget managed ODP.NET:

PM> Install-Package Oracle.ManagedDataAccess

So what is the problem anyway?
Basically up until now, ODP.NET was a .NET layer that talks to the Oracle client .dll files, a small fact that had many implications:

  • Large installation footprint (several hundreds of Mb)
  • Tough deployment to remote machines - needs to install ODP.NET on client machine or deploy large files
  • Challenging when working with several versions, 32bit/64bit os and applications

So what is it?

The managed driver is basically a single .dll file with a .Net native implementation of ODP.NET.
That means no Oracle Client is needed, and now native code is behind the scenes. XCopy installation can be done easily.

Major benefits:

  • Small footprint
  • Compiled as any cpu so it can work on 32bit/64bit OS and application smoothly. Easy to manage multiple versions on the same machine
  • Can be deployed as a simple reference in the application bin directory.

So what's the catch?

  • Not all features are supported (although most of them are... ) you can find out more on the documentation
  • Namespace is changed from Oracle.DataAccess.Client to Oracle.ManagedDataAccess.Client
  • Performance differences are still not clear. (The old) Native code always perform very efficiently, but on the other hand 100% managed code has it's performance benefits.

Please note that the Native-Code ODP.NET is still very much available. The managed version (at least for now) comes in addition to the native one.

References: http://oracleatdotnet.blogspot.com.es/2013/07/odpnet-managed-driver-beta-2.html

Differences between the ODP.NET Managed Driver and Unmanaged Driver http://docs.oracle.com/html/E41125_02/intro004.htm

Features of Oracle Data Provider for .NET http://docs.oracle.com/database/121/ODPNT/features.htm#ODPNT0007

Eirik H
  • 654
  • 2
  • 8
  • 30
Kiquenet
  • 14,494
  • 35
  • 148
  • 243
  • 1
    By the way, the client is no longer beta... Download both 32-bit and 64-bit here : http://www.oracle.com/technetwork/database/windows/downloads/index-090165.html ODP.NET_Managed121012.zip – MensSana Feb 28 '14 at 16:36
  • So let me make this clear. The managed version allows you to reference the assembly in your app and allow you to NOT have the client machine download anything where as the un-managed version does? Right? Also here's a link saying what classes and methods are not supported in the managed version you may want to include in your answer: http://docs.oracle.com/html/E41125_02/intro004.htm) – Luminous Dec 12 '14 at 19:12
  • 4
    @Luminous: Right. With "Managed ODP.NET", you have a single 6MB dll, called `Oracle.ManagedDataAccess.dll`, that allows you to connect to an Oracle database without any other software installed. In fact, you don't even need to "install" Managed ODP.NET, you just need the dll, and you can safely deploy it to servers with no software installed. – Jay Sullivan Jan 15 '15 at 14:49
  • 3
    Remark: Oracle removed the odp.net.managed nuget as of october 2015. Use the official nuget [Oracle.ManagedDataAccess](https://www.nuget.org/packages/Oracle.ManagedDataAccess/) instead. Also check [this post](http://stackoverflow.com/questions/33013689/why-has-the-odp-net-managed-package-on-nuget-dissapeared/). – ThomasDC Oct 08 '15 at 17:34
  • Managed driver does not work with Oracle 11 and lower when running under FIPS mode, sadly. – jpmc26 Sep 13 '16 at 00:20
12

you can get managed ODP.NET using NuGet too https://www.nuget.org/packages/odp.net.managed/

PM> Install-Package odp.net.managed 

Watch the quick start video on using ODP.NET Managed Driver! (copied from http://www.oracle.com/technetwork/topics/dotnet/whatsnew/index.html)

http://www.youtube.com/watch?feature=player_embedded&v=I1q50HnUh_w


Update:

NuGet for Official Oracle ODP.NET, Managed Driver https://www.nuget.org/packages/Oracle.ManagedDataAccess/

Or Package Manager Console

PM> Install-Package Oracle.ManagedDataAccess
Riju
  • 566
  • 7
  • 19
  • Alex Keh says: If you can wait a couple of days, ODAC 12c will be out on OTN and you can download that version. That will be our latest and greatest managed ODP.NET version. – Kiquenet Aug 13 '13 at 07:44
  • Alex Keh says: "We do not plan to put managed ODP.NET on NuGet. We believe that the managed ODP.NET download with ODAC will provide the same benefits of NuGet in terms of assembly isolation and download size. There's a thread discussing whether Oracle should provide managed ODP.NET NuGet support. Once you use ODAC 12c, I would like to know your thoughts on whether NuGet support is still necessary. https://forums.oracle.com/thread/2559445" – Kiquenet Aug 14 '13 at 08:49
11

The ODP.NET does require native OCI DLLs (~130 MB).

Probably the easiest way to get all the necessary files is to download the "Oracle Data Access Components with XCopy deployment" from oracle.com.

For your reference, the following DLLs are used by ODP.NET at run-time:

oci.dll
Oracle.DataAccess.dll (the managed ODP.NET assembly itself)
orannzsbb11.dll
oraociei11.dll
OraOps11w.dll

BTW, you'll need to be careful whether you are using 32-bit or 64-bit native Oracle DLLs - you must match them with the "bitness" of your managed code. This is especially tricky if you are building for "Any CPU" so the bitness is not fixed.

Branko Dimitrijevic
  • 50,809
  • 10
  • 93
  • 167
  • 1
    This is the best answer to the "real" question, which is "how can I get Oracle connectvitiy in .Net without bloatware". Just FYI I've installed _just_ this version into SSIS Azure runtime and can run Oracle SSIS packages. – Nick.Mc Jul 25 '18 at 03:32
  • When I trace an ODP.NET application with [Process Monitor](https://learn.microsoft.com/en-us/sysinternals/downloads/procmon) then it loads 39 different DLL's from Oracle bin folder (not just these four you listed) - I don't think it is a smart way to copy the DLL's manually. Better install the InstantClient or the ODP.NET Managed driver. – Wernfried Domscheit Jan 03 '19 at 10:30
  • @WernfriedDomscheit Managed ODP.NET is definitely a better option, but this answer was written before its time. As to these "extra" DLLs you noticed - again it's possible something changed in the meantime, or that you are just seeing "unnecessary" localization DLLs. Whatever it is, the answer describes a solution that was tested and worked quite well in practice, _at that time_. – Branko Dimitrijevic Jan 03 '19 at 15:04
8

The latest ODAC releases ship with Oracle instant client so you don't need to install the full client.

(32 bit release)

(64 bit release)

jgauffin
  • 99,844
  • 45
  • 235
  • 372
vc 74
  • 37,131
  • 7
  • 73
  • 89
5

I am leaving this answer because with the release ODP.net managed driver, old answers are a bit obsolete now.

ODP.net managed driver is released now.

Currently available version ODAC 12cR2 is backwards compatible with Oracle 10gR2 or later. See the System Requirements section of ODAC 12cR2 Installation Instructions. ODAC 12cR2 requires/supports .Net frameworks from version 4 to 4.5.1.

Previous version ODAC 12cR1 too is backwards compatible with Oracle 10gR2 or later according to it's installation instructions.

sampathsris
  • 21,564
  • 12
  • 71
  • 98
2

Use the managed oracle-client which is available now. A managaged AnyCPU 6MB dll.

Grastveit
  • 15,770
  • 3
  • 27
  • 36
1

It worked for me (PC without Oracle Client):

Edited:

Although this solution worked well; Today, I think the best approach is to use the Oracle Managed Data Access drivers. Is it better when we need to avoid issues between desktop and server environments when one of them is not using the same (32-bit or 64-bits) architecture;

Thanks to Iron Automation:

Link: http://www.iron-automation.com/2018/02/connecting-to-oracle-database-without-installing-oracle-client/

The solution below will apply both to 11g and 12c databases.

Follow the steps:

  • Step 1

    We will need a set of dlls provided by Oracle to use in our project. So at this first step, download Oracle Data Access Components (ODAC) for your version of Windows. As of the posting date of this article, the valid download URL is: http://www.oracle.com/technetwork/topics/dotnet/downloads/odacdeploy-4242173.html

    Note: ODAC 32 bit version works both for 32bit and 64bit. And I had several problems when using 64bit version. So I can suggests directly downloading the 32bit version.

    Open the downloaded zip file and get the dlls below together. I listed the dlls with the folder where you will find them. We will later copy them into our debug folder.

    \instantclient_12_2\ 
        oci.dll  
        orannzsbb12.dll  
        oraocci12.dll  
        oraocci12d.dll  
        oraociei12.dll  
        oraons.dll  

    \oramts\bin\  
        oramts.dll  
        oramts12.dll  
        oramtsus.dll  

    \odp.net4\odp.net\bin\4\  
        Oracle.DataAccess.dll  

    \odp.net4\bin\  
        OraOps12.dll  
  • Step 2

    Use Visual Studio to create a console application and copy the dlls listed in Step 1 into the same folder as your project executable, the Debug folder. Add a reference to “Oracle.DataAccess.dll” by browsing to your Debug folder where you have just copied this dll into.

It worked for me (PC with Oracle Client Installed):

    ------------------------------- ------------------- ----------- ----------------- --------------------------- ----------------------- 
    Name                            Date modify         Size        Version           Folder                      Type                  
    ------------------------------- ------------------- ----------- ----------------- --------------------------- ----------------------- 
    Oracle.DataAccess.dll           24/05/2017 16:46    2.100 KB    4.122.1.0         
  • Browse to odp.net4 folder (With bulk insert support)

  • Copy this files to ouptut bin folder:

    ------------------------------- ------------------- ----------- ----------------- --------------------------- ----------------------- 
    Name                            Date modify         Size        Version           Folder                      Type                  
    ------------------------------- ------------------- ----------- ----------------- --------------------------- ----------------------- 
    oci.dll                         13/02/2017 23:31    1.270 KB    12.2.0.0          InstantClient_12_2          Extensão de aplicativo    
    ociw32.dll                      13/02/2017 22:20      346 KB    11.1.0.1          InstantClient_12_2          Extensão de aplicativo    
    orannzsbb12.dll                 05/12/2016 18:38    4.329 KB    12.2.0.1          InstantClient_12_2          Extensão de aplicativo    
    oraocci12.dll                   13/02/2017 21:29    1.006 KB    12.2.0.1          InstantClient_12_2          Extensão de aplicativo    
    OraOps12.dll                    24/05/2017 16:45      433 KB    2.122.1.0         InstantClient_12_2          Extensão de aplicativo    

  • OBS: In my case it´s not necessary:
    ------------------------------- ------------------- ----------- ----------------- --------------------------- ----------------------- 
    Name                            Date modify         Size        Version           Folder                      Type                  
    ------------------------------- ------------------- ----------- ----------------- --------------------------- ----------------------- 
    Oracle.ManagedDataAccess.dll    24/05/2017 16:07    4.763 KB    4.122.1.0         
nandox
  • 81
  • 5