Enabling Tracing in Your Application

原创 2012年03月28日 10:46:44

If you own the source code to theapplication you wish to trace, it might be feasible for you to modify the codedirectly to enable SQL Trace. This can be advantageous because you can enableSQL Trace at precisely the point in your application where you have a doubt.This can greatly narrow the scope of your tracing exercise, allowing you tofocus efforts on the bottleneck itself.

Depending on the tools used to build yourapplication, you may be able to enable SQL Trace with the simple command:

ALTER SESSION SET SQL_TRACE = TRUE;
If you need to enable SQL Trace from withina PL/SQL block, you can call:
dbms_session.set_sql_trace (TRUE);

SQL Trace output is most valuable when timedstatistics are enabled. You can instantly enable timed statistics for allsessions by logging on to the database as a DBA and executing the command:

ALTER SYSTEM SET TIMED_STATISTICS = TRUE;

If you are concerned about the overhead thiscauses, you may instead modify the application code to enable timed statisticsfor the current session instead of the entire instance. You can do this withthe command:

ALTER SESSION SET TIMED_STATISTICS = TRUE;

To enable timed statistics from within aPL/SQL block, you must use the dbms_sql package to build and execute a dynamicSQL statement:

DECLARE
  c INTEGER; i INTEGER;
BEGIN
  c := dbms_sql.open_cursor;
  dbms_sql.parse (c, 'ALTER SESSION SET TIMED_STATISTICS = TRUE',
                  dbms_sql.native);
  i := dbms_sql.execute (c);
  dbms_sql.close_cursor (c);
END;


相关文章推荐

Saving data to a file in your Android application

Internal storage Each application has its own private internal storage to save files. This is the...

如何在Android程序中使用ACRA3(How to install ACRA3 in your Android application)

一、介绍(Introduction)ACRA 允许你的Android应用将崩溃报告以谷歌文档电子表的形式进行发送。本教程将引导您在应用程序项目中安装ACRA。ACRA allows your Andr...

《Netty in Action V5》-- 第2章 Your First Netty Application

本章,通过对Netty核心内容的入门介绍为本书的其他章节做准备。其中一项内容是学习怎么样利用Netty拦截和处理异常,当我们开始使用Netty需要调试问题的时候,这是非常重要的。本章也介绍了其他的核心...

How to add a Custom Pull to Refresh in your iOS Application

If you love your iOS Application and like to make sure that branding is consistent throughout then i...

How to embed VideoIO in your Flex/Flash application?

VideoIO Flash-based audio and video communication Home › Flash-VideoIO Tutorial ...

Code Quick Start: Capturing diagnostics in your Windows Azure application

http://msdn.microsoft.com/en-us/library/windowsazure/hh180875.aspx using System; using System.C...

真机调试The entitlements specified in your application’s Code Signing Entitlements file do not match tho

在往真机上装应用程序的时候出现“The entitlements specified in your application’s Code Signing Entitlements file do n...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Enabling Tracing in Your Application
举报原因:
原因补充:

(最多只允许输入30个字)