使用实体框架 (EF) 时如何查找通过 ODAC 发送到 Oracle 数据库的查询

发布于 2024-12-15 22:04:50 字数 517 浏览 2 评论 0原文

我正在将 Oracle ODAC 用于 EntityFramework。我正在尝试使用实体框架开发示例 silverlight 应用程序。我已经添加了我的域服务,通过它我可以发布我的实体。我是 UI 的代码隐藏文件。我编写了以下代码。

var threemonthsold = DateTime.Now.AddMonths(-3);
var query = serverContext.GetSR_MERGED_DATAQuery().Where(t => t.SR_DATE_RECD > threemonthsold);

var regionLoadOp = serverContext.Load(query);
dataGrid.ItemsSource = regionLoadOp.Entities; 

我想知道什么查询已发送到 oracle。由于操作超时,应用程序崩溃。看起来查询需要很长时间。如果我能找到查询,我可以直接在 Oracle 上运行它并找出它需要多长时间。

非常感谢任何帮助。

谢谢

I am using Oracle ODAC for EntityFramework. I am trying to develop a sample silverlight application using entityframework. I have add my domainservice through which I am publishing my entities. I am UI's code behind file. I have written the following code.

var threemonthsold = DateTime.Now.AddMonths(-3);
var query = serverContext.GetSR_MERGED_DATAQuery().Where(t => t.SR_DATE_RECD > threemonthsold);

var regionLoadOp = serverContext.Load(query);
dataGrid.ItemsSource = regionLoadOp.Entities; 

I want to find out what query has been sent to oracle. As the operation is getting timedout the application is crashing. Looks like the query is taking long time. If I can find out the query I can run it directly on oracle and find out how long it is taking there.

Any help much appreciated.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

安人多梦 2024-12-22 22:04:50

如果您通过网络发送查询,Wireshark 是查看实际传输的数据包的好方法。如果您在数据包过滤器(不是捕获过滤器,而是主页上的过滤器,并且在无效/有效输入时变成红色/绿色)中输入 TNS,您可以看到 Oracle 数据包。

使用 <code>tns</code> 过滤器和 Find Packet 在 中搜索字符串 'select' 时在wireshark 中找到的 oracle 数据包的屏幕截图数据包的字节。

似乎没有没有维护的数据包解析器来显示数据包的不同部分数据包,但您可以查看数据字节并查看显示 SQL 语句的 ASCII 文本。 (您还会看到一堆会话打开/关闭垃圾。)

If you're sending queries across the network, Wireshark is a great way to view the actual packets being transferred. If you type TNS in for the packet filter (not the capture filter, but the one that's on the main page and turns red/green on invalid/valid input), you can see Oracle packets.

Screenshot of oracle packet in wireshark found using <code>tns</code> filter and Find Packet searching for the string 'select' in the packet's bytes.

It seems that there is no maintained packet dissector to show the different parts of the packet, but you can look at the data bytes and see ASCII text showing the SQL statements. (You'll also see a bunch of session open/close junk.)

年少掌心 2024-12-22 22:04:50

以下论坛中找到了此问题的答案。

cshay Dec 3, 2011 9:58 AM (in response to 900653)
You can turn on ODP.NET tracing. See the ODP.NET doc for more details:

1) Close VS
2) In windows registry, change registry value 
    \\HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\ODP.NET\4..........\TraceLevel
    to 1
3) Relaunch VS
4) Reproduce the problem
5) Close VS2010
6) Look for the odpnet trace file in the root of C I believe.
7) Undo the registry value (set it back to 0) so you don't impact performance

Found the answer for this question in the following forum.:

cshay Dec 3, 2011 9:58 AM (in response to 900653)
You can turn on ODP.NET tracing. See the ODP.NET doc for more details:

1) Close VS
2) In windows registry, change registry value 
    \\HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\ODP.NET\4..........\TraceLevel
    to 1
3) Relaunch VS
4) Reproduce the problem
5) Close VS2010
6) Look for the odpnet trace file in the root of C I believe.
7) Undo the registry value (set it back to 0) so you don't impact performance
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文