Using Oracle Trace Analyzer (trcanlzr.sql)
Using Oracle Trace Analyzer (trcanlzr.sql)
Dave Moore: Author of Oracle Utilities
Oracle has provided another utility initially designed for performance tuning Oracle Applications. Trace Analyzer is provided in the form of a PL/SQL package (TRCA$ ). The Trace Analyzer utility is available via download on the Oracle Metalink web site.
How Oracle trace analyzer Works
Trace Analyzer requires that a one-time configuration be performed. During this configuration, many objects are installed in the database to serve as a tracing repository. Once downloaded from Metalink and installed, a SQL script can be executed passing in the name of the trace file.
Executing Oracle Trace Analyzer
First, tracing needs enabled at the appropriate level. For example, to provide maximum trace data, a Level 12 trace can be started for the current session:
SQL> ALTER SESSION SET EVENTS '10046 TRACE NAME CONTEXT FOREVER, LEVEL 12';
After the session executes for enough time to gain needed data, the trcanlzr SQL script can be executed. It requires the name of the directory object. This object points to the physical operating system directory for the user_dump_dest. The installation of the utility will automatically create the directory object required (named UDUMP).
SQL>@d:\trcanlzr.sql UDUMP asg920xr_ora_13033.trc
Once executed, the output will be displayed on the screen and a spool file is created.
Is Oracle trace Analyzer better than tkprof?
Traditionally, tkprof has been the best tracing diagnostics tool available. That is, until the introduction of Trace Analyzer which is everything tkprof is and more. However, as of version 10.2, the Trace Analyzer utility is still not shipped with the Oracle DBMS like tkprof.
Given access to both utilities, Trace Analyzer has the following advantages:
1. Trace Analyzer provides the actual values of the bind variables in SQL. N
Ïà¹ØÎĵµ£º
oracleµÄͬÒå´Ê×ܽ᣺
¡¡¡¡´Ó×ÖÃæÉÏÀí½â¾ÍÊDZðÃûµÄÒâ˼£¬ºÍÊÔͼµÄ¹¦ÄÜÀàËÆ¡£¾ÍÊÇÒ»ÖÖÓ³Éä¹Øϵ¡£
¡¡¡¡1.´´½¨Í¬Òå´ÊÓï¾ä£º
¡¡¡¡create public synonym table_name for user.table_name;
¡¡¡¡ÆäÖеÚÒ»¸öuser_tableºÍµÚ¶þ¸öuser_table¿ÉÒÔ²»Ò»Ñù¡£
¡¡¡¡´ËÍâÈç¹ûÒª´´½¨Ò»¸öÔ¶³ÌµÄÊý¾Ý¿âÉϵÄijÕűí ......
1¸öʵÀý
create table tjob2(tt date);
´´½¨Ò»¸ö´æ´¢¹ý³Ì
create or replace procedure t26 is
begin
insert into tjob2 values(sysdate);
commit;
end t26;
´´½¨job£¬Ã¿·ÖÖÓÖ´ÐÐÒ»´Î
SQL> declare
2 tjob number;
3 begin
4 sys.dbms_jo ......
¡¡¡¡OracleÊý¾Ýµ¼Èëµ¼³öimp/exp¾ÍÏ൱ÓÚoracleÊý¾Ý»¹ÔÓ뱸·Ý¡£expÃüÁî¿ÉÒÔ°ÑÊý¾Ý´ÓÔ¶³ÌÊý¾Ý¿â·þÎñÆ÷µ¼³öµ½±¾µØµÄdmpÎļþ£¬impÃüÁî¿ÉÒÔ°ÑdmpÎļþ´Ó±¾µØµ¼Èëµ½Ô¶´¦µÄÊý¾Ý¿â·þÎñÆ÷ÖС£ ÀûÓÃÕâ¸ö¹¦ÄÜ¿ÉÒÔ¹¹½¨Á½¸öÏàͬµÄÊý¾Ý¿â£¬Ò»¸öÓÃÀ´²âÊÔ£¬Ò»¸öÓÃÀ´ÕýʽʹÓÃ……
¡¡¡¡OracleÊý¾Ýµ¼Èëµ¼³öimp/exp¾ÍÏàµ±Ó ......
·ÖÎöº¯ÊýÓÃÓÚ¼ÆËã»ùÓÚ×éµÄijÖÖ¾ÛºÏÖµ£¬ËüºÍ¾ÛºÏº¯ÊýµÄ²»Í¬Ö®´¦ÊÇ
¶ÔÓÚÿ¸ö×é·µ»Ø¶àÐУ¬¶ø¾ÛºÏº¯Êý¶ÔÓÚÿ¸ö×éÖ»·µ»ØÒ»ÐС£
SQL> select t.empno,t.ename,sum(t.sal)
2 from emp t;
select t.empno,t.ename,sum(t.sal)
*
ERROR at line 1:
ORA-00937: not a single-group group function
SQL> selec ......
µÚÒ»ÖÖÓ÷¨£º
SELECT (CASE type WHEN 'u' THEN 'Óû§±í' WHEN 's' THEN 'ϵͳ±í' ELSE 'ÆäËû' END) AS TABLEKIND,* from SYSOBJECTS
µÚ¶þÖÐÓ÷¨£º
SELECT (CASE WHEN crdate<'2006-01-01' THEN 'early' WHEN crdate<'2009-01-01' THEN 'nearly' ELSE 'now' END) AS PERIOD,* from SYSOBJECTS ......