Issue with System.Data.OracleClient and ODP.Net 11g together used in .net 2.0 web site

走远了吗. 提交于 2019-12-29 09:26:07

问题


In our .net framework 2.0 based application we were using System.Data.Oracleclient and now migrating to ODP.Net, the volume of the project is too high, so we cannot do the entire migration on one go, as a result the application is using 2 providers System.Data.Oracleclient & ODP.Net as of now.

Now we are changing our OS, from Windows xp 32bit to Windows 7 64bit. While doing so we observed the following,

1) A query executes in < 1 sec using System.Data.Oracleclient & ODP.Net 10g 64bit (Oracle.DataAccess.dll version 2.102.2.20). and the same query executes in < 1 sec on Oracle SQL Developer v1.5.

2) However the same query is taking 2-3 mins to execute using System.Data.OracleClient with ODP.Net 11g 64bit (Oracle.DataAccess.dll version 2.112.3.0).

we found a remarkable performance degradation in point 2), we have to use System.Data.OracleClient with ODP.Net 11g 64bit (Oracle.DataAccess.dll version 2.112.3.0) on Windows 7 64bit OS, but we cannot live with the performance degradation as mentioned in point 2), and we cannot convert all code which uses System.Data.OracleClient to ODP.Net very quickly.

So can anyone help us, on why do we see such remarkable performance degradation as mentioned in point 2), and what do we do to resolve this problem.

Regards Sanjib Harchowdhury


回答1:


Adding the following to your config will send odp.net tracing info to a log file:

  <oracle.dataaccess.client>
    <settings>
      <add name="TraceFileName" value="c:\temp\odpnet-tests.trc"/>
      <add name="TraceLevel" value="63"/>
    </settings>
  </oracle.dataaccess.client>

This will probably only be helpful if you can find a large gap in time. Chances are rows are actually coming in, just at a slower pace.

Try adding "enlist=false" to your connection string. I don't consider this a solution since it effecitively disables distributed transactions but it should help you isolate the issue. You can get a little bit more information from an oracle forumns post:

From an ODP perspective, all we can really point out is that the behavior occurs when OCI_ATR_EXTERNAL_NAME and OCI_ATR_INTERNAL_NAME are set on the underlying OCI connection (which is what happens when distrib tx support is enabled).

I'd guess what you're not seeing is that the execution plan is actually different (meaning the actual performance hit is actually occuring on the server) between the odp.net call and the sql developer call. Have your dba trace the connection and obtain execution plans from both the odp.net call and the call straight from SQL Developer (or with the enlist=false parameter).

If you confirm different execution plans or if you want to take a preemptive shot in the dark, update the statistics on the related tables. In my case this corrected the issue, indicating that execution plan generation doesn't really follow different rules for the different types of connections but that the cost analysis is just slighly more pesimistic when a distributed transaction might be involved. Query hints to force an execution plan are also an option but only as a last resort.

Finally, it could be a network issue. If your odp.net install is using a fresh oracle home (which I would expect unless you did some post-install configuring) then the tnsnames.ora could be different. Host names might not be fully qualified, creating more delays resolving the server. I'd only expect the first attempt (and not subsequent attempts) to be slow in this case so I don't think it's the issue but I thought it should be mentioned.




回答2:


please refer this link, or just replace ODP.Net 64bit component with ODP.Net 32bit, as we are using asp.net we could easily configure our application to run using the 32bit component in Windows 7 (x64) edition.



来源:https://stackoverflow.com/questions/14709587/issue-with-system-data-oracleclient-and-odp-net-11g-together-used-in-net-2-0-we

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!