简体   繁体   English

如何在我的多线程EJB2 JBoss应用程序中监视数据库事务?

[英]How Can I Monitor The Database Transactions in my multi-threaded, EJB2 JBoss Application?

I have encountered a reproducible Oracle deadlock within my application. 我在应用程序中遇到了可重现的Oracle死锁。 An initial investigation of the code has not thrown up any obvious cause, so I would like to re-create the situation while logging the SQL being run and most importantly, the transactions they are occurring within. 对该代码的初步调查没有发现任何明显的原因,因此我想在记录正在运行的SQL以及最重要的是它们正在其中进行的事务时重新创建这种情况。

I started adding my own debug statements, but this seems like I am re-inventing the wheel and has already proved error prone (I initially missed that one of my EJB methods was defined as "RequiresNew") 我开始添加自己的调试语句,但这似乎是我在重新发明轮子,并且已经证明容易出错(我最初错过了将我的EJB方法之一定义为“ RequiresNew”)。

Are there tools which will do this? 有工具可以做到这一点吗? I've looked at: 我看了看:

  • log4jdbc, but it is not clear from the docs that I've seen that it will log the separate transactions, plus it doesn't support datasources, so I'd need work round that. log4jdbc,但是从文档中还不清楚我是否看到它会记录单独的事务,而且它不支持数据源,因此我需要解决这一问题。

  • jdbcslog - also not clear if it would log transactions jdbcslog-也不清楚是否会记录事务

Or am I missing some more obvious way to do this? 还是我缺少一些更明显的方法来做到这一点?

Solved similar case a few times. 解决了类似情况几次。 It's very difficult (I call it lucky) to find solution in complicated app just from your session logging. 仅从您的会话日志记录中很难在复杂的应用程序中找到解决方案(我称之为幸运)。 (Oracle kills one of these sessions. One is killed and the other one lives on happily) (Oracle杀死了其中一个会话。一个被杀死,另一个则幸福地活着)

Best solution is to ask your DBA (or if you have access to your oracle instalation, you can google and then get them yourself, it's not sou complicated) for trace file(this file is mentioned in exception of killed session, so search your alert log), there will be deadlock graph. 最好的解决方案是向您的DBA询问(或者如果您有权访问oracle安装,则可以通过google然后自己获取,这并不复杂)来获取跟踪文件(此文件在被终止的会话中被提及,因此请搜索警报)日志),将出现死锁图。 (just fulltext trace file for DEADLOCK) (只是DEADLOCK的全文跟踪文件)

Just look here for exact information how to look into your trace file. 只需在此处查找有关如何查看跟踪文件的确切信息即可。 LINK 链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM