05.11.2015 Views

Apress.Expert.Oracle.Database.Architecture.9i.and.10g.Programming.Techniques.and.Solutions.Sep.2005

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 3 ■ FILES 79<br />

• Resource Manager (DBMS_RESOURCE_MANAGER): This feature allows you to micromanage<br />

resources (CPU, I/O, <strong>and</strong> the like) within the database. What makes a Resource Manager<br />

in the database a possibility is the fact that it has access to all of the runtime<br />

statistics describing how the resources are being used.<br />

• <strong>Oracle</strong> “events”: These provide the ability for you to ask <strong>Oracle</strong> to produce trace or diagnostic<br />

information as needed.<br />

• DBMS_TRACE: This facility within the PL/SQL engine exhaustively records the call tree of<br />

stored procedures, exceptions raised, <strong>and</strong> errors encountered.<br />

• <strong>Database</strong> event triggers: These triggers, such as ON SERVERERROR, allow you to monitor<br />

<strong>and</strong> log any condition you feel is “exceptional” or out of the ordinary. For example, you<br />

can log the SQL that was running when an “out of temp space” error was raised.<br />

• SQL_TRACE: The SQL Trace facility is also available in an extended fashion via the 10046<br />

<strong>Oracle</strong> event.<br />

. . . among others. Instrumentation is vital in application design <strong>and</strong> development, <strong>and</strong> the<br />

<strong>Oracle</strong> database becomes better instrumented with each release. In fact, the amount of additional<br />

instrumentation in the database between <strong>Oracle</strong>9i Release 2 <strong>and</strong> <strong>Oracle</strong> 10g Release 1<br />

itself is phenomenal. <strong>Oracle</strong> 10g took code instrumentation in the kernel to a whole new level.<br />

In this section we’re going to focus on the information that can be found in various types<br />

of trace files. We’ll cover what they are, where they are stored, <strong>and</strong> what we can do with them.<br />

There are generally two types of trace file, <strong>and</strong> what we do with each kind is very different:<br />

• Trace files you expected <strong>and</strong> want: For example, these are the result of enabling<br />

SQL_TRACE=TRUE. They contain diagnostic information about your session <strong>and</strong> will help<br />

you tune your application to optimize its performance <strong>and</strong> diagnose what bottlenecks<br />

it is experiencing.<br />

• Trace files you were not expecting to receive but the server generated as the result of an<br />

ORA-00600 “Internal Error”, ORA-03113 “End of file on communication channel”, or<br />

ORA-07445 “Exception Encountered” error: These traces contain diagnostic information<br />

that is most useful to an <strong>Oracle</strong> Support analyst <strong>and</strong>, beyond showing us where in our<br />

application the internal error was raised, are of limited use to us.<br />

Requested Trace Files<br />

The trace files you expect to be most commonly generated as the result of setting<br />

SQL_TRACE=TRUE, or using the extended trace facility via the 10046 event, are as follows:<br />

ops$tkyte@ORA10G> alter session set events<br />

2 '10046 trace name context forever, level 12';<br />

Session altered.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!