News, views, tips and tricks on Oracle and other fun stuff

Oracle Trace Analyzer is TKPROF on Steroids

When you generate a raw Oracle SQL Trace file you are faced with the arduous task of analyzing this trace file. Of course, TKPROF has always been there to help you with this analysis. This post is not about TKPROF, it is about another, lesser known, utility called Trace Analyzer, that is everything TKPROF is and more.

Let’s learn about Trace Analyzer by answering these questions:

What is Trace Analyzer?

Trace Analyzer is a utility that reads a raw SQL Trace generated by standard SQL Trace or by EVENT 10046 (Level 4, 8 or 12), and generates a comprehensive HTML report with performance related details. The HTML report contains information about the Oracle instance (i.e. Statspack type of information) as well as all the details found on TKPROF including a very nice explain plan. The HTML report page is hyper-linked so you can easily jump to different sections of the report.

Where can I get Trace Analyzer?

Trace Analyzer is available as a MetaLink download, note # 224270.1. After you download the zip file, you need to perform a few installation steps before you can use this utility.

How do I install Trace Analyzer?

Let’s go through the installation steps on Oracle XE (Windows XP with Oracle home = C:\oraclexe\app\oracle\product\10.2.0\server):

Unzip the content of the zip file into in your Oracle home folder. Your Oracle home should now contain a folder called “trca”.

In your DOS command window, go to the trca folder in your Oracle home directory

C:\>cd oraclexe\app\oracle\product\10.2.0\server\trca

Run SQL*Plus and connect as SYS

C:\oraclexe\app\oracle\product\10.2.0\server\trca>sqlplus sys as sysdba

SQL*Plus: Release - Production on Sun Jul 16 14:22:42 2006

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Enter password:

Connected to:
Oracle Database 10g Express Edition Release - Production

Run the Trace Analyzer installation script

SQL> @tacreate.sql
... Creating TRCA$ UDUMP Directory

... Creating TRCANLZR user ...

Choose the TRCANLZR user's password.

Not specifying a password will result in the installation FAILING

Specify TRCANLZR password

Enter a password for the new user TRCANLZR

Enter value for trcanlzr_password: tracemeifucan
... Getting Host String ...

Specify Host String (TNS Alias) including @ symbol (if not applicable just hit e

Just hit enter here

Specify Host String including @ prefix (i.e.: @CERBDEV)
Enter value for host_string:

Below are the list of online tablespaces in this database.
Decide which tablespace you wish to create the Trace Analyzer tables
and indexes.  This will also be the TRCANLZR user's default tablespace.

Specifying the SYSTEM tablespace will result in the installation
FAILING, as using SYSTEM for tools data is not supported.

------------------------------ ---------
SYSAUX                         PERMANENT
TEMP                           TEMPORARY
UNDO                           UNDO
USERS                          PERMANENT

Specify TRCANLZR user's default tablespace

You have to enter the default tablespace here, otherwise the installation will fail. You may wish to create a new tablespace before installation to assign the TRCANLZR objects to it.

Enter value for default_tablespace: USERS
Using USERS for the default tablespace

Choose the TRCANLZR user's temporary tablespace.

Specifying the SYSTEM tablespace will result in the installation
FAILING, as using SYSTEM for the temporary tablespace is not recommended.

Specify TRCANLZR user's temporary tablespace.

You have to enter the temporary tablespace here, otherwise the installation will fail.

Enter value for temporary_tablespace: TEMP
Using TEMP for the temporary tablespace


TACPKG complete. Please check tacpkg.lis for any errors.

That’s it. Trace Analyzer is intalled. You can now execute Trace Analyzer from any schema.

How do I use Trace Analyzer?

Use from SQL*Plus connected as the user that originated the SQL Trace:

SQL> connect hr
Enter password:

To provide maximum trace data, start a Level 12 trace:


Let Oracle collect trace data during the session

SQL> select count(*) from employees;


Take note of the trace file that was generated in the UDUMP directory on the server. Now, execute the trcanlzr.sql script passing the trace file name as the parameter. This generates the Trace Analyzer HTML report into your local client directory using SPOOL

SQL> @trcanlzr.sql xe_ora_832.trc


...generating report

Trace Analyzer Report "trcanlzr_832_1.html" has been created in C:\ORACLEXE\APP\

...copying report "trcanlzr_832_1.html" has been copied into local directory
...exiting now (hit enter key)

Disconnected from Oracle Database 10g Express Edition Release - Produ


And here is the Trace Analyzer HTML report.

Why is Trace Analyzer better than TKPROF?

Trace Analyzer is better than TKPROF because It:

  • Provides the actual values of the bind variables in SQL.
  • Provides the hottest blocks, optimizer statistics for indexes and tables and other information not available through TKPROF.
  • Separates user recursive and internal recursive calls, unlike TKPROF.
  • Provides more detailed wait event information.
  • Generates an HTML report that is more readable and extensive than the text output generated by TKPROF.

However, unlike TKPROF, Trace Analyzer requires objects in the database and that means more configuration work on each database that needs the utility installed. Moreover, TKPROF executes more quickly than Trace Analyzer, but that’s because Trace Analyzer does more analysis than TKPROF.

Where can I get more information?

Here is a list of links to additional resources:

Filed in Oracle, Tips on 18 Jul 06 | Tags: , , ,

Reader's Comments

  1. |

    From (admittedly) a very quick look, it doesn’t seem much use to me as a developer. Seems more like something for the DBA guys who are 13 floors above me and don’t always answer their email. Then again that rather goes for TKPROF and Statspack as well.

  2. |

    Hi William,

    Trace Analyzer is useful to whoever wants to analyze trace files to solve or investigate database performance issues. Whether you are a developer or a DBA is irrelevant in this case.

    I do see many developers, including myself, as well as DBAs, using tools such as TKPROF or Trace Analyzer for reasons mentioned above.

    By the way, I feel sorry for you that your DBAs don’t always answer their email :(

    My DBAs, on the other hand, are really responsive to email and phone calls :)

  3. |


    I force my (our) developers to use tools like tkprof and the analyzer. Without tools like that developers write “easy sql” instead of good sql.

    On our little standardized test we give the perspect new developers, the first 6 questions are all related to explain plans, autotrace and proper use of indexes.

    Makes it REAL easy to wade through perspective developers.

    I don’t answer my phone, I always enter emails. :)

  4. |

    very interesting Eddie! Greetings Karl

  5. |

    Thanks for the tip! I mentioned it on Log Buffer.