Oracle XE 查询日志

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1570978/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 19:13:28  来源:igfitidea点击:

Oracle XE query log

oraclelogging

提问by David Aldridge

In Postgres you can switch on query logging, resulting in a file containing all queries issued by any client.

在 Postgres 中,您可以打开查询日志记录,从而生成一个包含任何客户端发出的所有查询的文件。

Is there a similar possibility in Oracle XE? How do I switch it on and where do I find the resulting file?

Oracle XE 中是否有类似的可能性?如何打开它以及在哪里可以找到生成的文件?

回答by David Aldridge

You would:

你会:

alter session set sql_trace=true;

更改会话集 sql_trace=true;

The trace file will be in the udump subdirectory under the installation directory.

跟踪文件将位于安装目录下的 udump 子目录中。

Edit: Actually the docs say that sql_traceis deprecated in 10g: http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams205.htm#REFRN10208

编辑:实际上文档说sql_trace10g 已弃用:http: //download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams205.htm#REFRN10208

It looks like DBMS_SESSIONis the way to go now:

看起来DBMS_SESSION是现在要走的路:

eg.

例如。

EXECUTE DBMS_SESSION.SESSION_TRACE_ENABLE(waits => TRUE, binds => FALSE);

http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/sqltrace.htm#CHDDGCCB

http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/sqltrace.htm#CHDDGCCB

回答by Billy

If you're targeting a specific application, you might find useful to use p6spywhich is "an open source framework that intercept and optionally modify database statements"

如果您的目标是特定的应用程序,您可能会发现使用p6spy很有用,它是“一个拦截和选择性修改数据库语句的开源框架”

Can be used with JBoss, ATG, Orion, JOnAS, iPlanet, WebLogic, WebSphere, Resin and Tomcat.

可与 JBoss、ATG、Orion、JOnAS、iPlanet、WebLogic、WebSphere、Resin 和 Tomcat 一起使用。

回答by Jay

If you log into the web admin interface, and go into administration, you'll "Top-SQL" .... It has a search functionality, you can supply part of the query your looking for. I find that to be very helpful.

如果您登录 Web 管理界面并进入管理,您将“Top-SQL”.... 它具有搜索功能,您可以提供您要查找的部分查询。我觉得这很有帮助。