【Oracle】一款非常好用的trace文件分析工具之一

 

北在南方 2016-04-14 11:23:58 浏览547 评论0

摘要: 介绍一款非常好用的10046分析工具--trca(Trace Analyzer),以前分析10046跟踪文件的时候都是使用tkprof 工具,但是trca 比tkprof要简单的多而且分析的结果更全面: 可以从ML的文章:Trace Analyzer TRCANLZR - Interpreting

介绍一款非常好用的10046分析工具--trca(Trace Analyzer),以前分析10046跟踪文件的时候都是使用tkprof 工具,但是trca 比tkprof要简单的多而且分析的结果更全面:
可以从ML的文章:Trace Analyzer TRCANLZR - Interpreting Raw SQL Traces with Binds and/or Waits generated by EVENT 10046 [ID 224270.1] 来下载此工具!
trca.zip 主要包括一下文件
install:
TRCACREA.sql - creates all objects needed by Trace Analyzer by calling other scripts below. 
TRCADROP.sql - drops the schema objects.
TRCAPKGB.sql - creates the package body.
TRCAPKGS.sql - creates the package header (specification). 
TRCAREPO.sql - creates the staging repository.
TRCADIRA.sql - creates the directory object pointing to the place where the trace files exist (only if placing traces on a directory other than user_dump_dest). 
TRCAGRNT.sql - grants privileges needed to use Trace Analyzer
TRCAREVK.sql - revokes privileges granted by TRCAGRNT.
TRCAPURG.sql - purges old SQL traces from the repository. 
TRCATRNC.sql - truncates the staging repository. 
TRCANLZR.sql - main Trace ANalyzer script. that generates the report. 
TRCACRSR.sql - generates report for one cursor. 
TRCAEXEC.sql - generates report for one cursor execution.
 
run:
trcanlzr.sql 用来分析10046产生的跟踪文件的 用法:
trcanlzr.sql  controlfile |跟踪文件名
下面介绍一下trca的安装和使用
进入/trca/install 目录,以sys 用户登录数据库:
sys@RAC> @tacreate.sql
Uninstalling TRCA, please wait
TADOBJ completed.
sys@RAC> 
sys@RAC> WHENEVER SQLERROR EXIT SQL.SQLCODE;
sys@RAC> REM If this DROP USER command fails that means a session is connected with this user.
sys@RAC> DROP USER trcanlzr CASCADE;
sys@RAC> WHENEVER SQLERROR CONTINUE;
sys@RAC> 
sys@RAC> SET ECHO OFF;
TADUSR completed.
TADROP completed.
Specify optional Connect Identifier (as per Oracle Net)
Include "@" symbol, ie. @PROD
If not applicable, enter nothing and hit the "Enter" key
Optional Connect Identifier (ie: @PROD): @rac
Define the TRCANLZR user password (hidden and case sensitive).
Specify TRCANLZR password: --输入用户TRCANLZR的密码
Re-enter password: 
Set up TRCANLZR temporary and default tablespaces
Below are the list of online tablespaces in this database.
Decide which tablespace you wish to create the TRCANLZR tables
and indexes.  This will also be the TRCANLZR user default tablespace.
Specifying the SYSTEM tablespace will result in the installation
FAILING, as using SYSTEM for tools data is not supported.
Wait...
Above is the list of online tablespaces in this database.
Decide which tablespace you wish to create the TRCANLZR tables
and indexes.  This will also be the TRCANLZR user default tablespace.
Specifying the SYSTEM tablespace will result in the installation
FAILING, as using SYSTEM for tools data is not supported.
 
Tablespace name is case sensitive.
Default tablespace [UNKNOWN]: EXAMPLE  --(必须大写,小写会创建失败)
DEFAULT_TABLESPACE
------------------------------
EXAMPLE
Choose the TRCANLZR user temporary tablespace.
Specifying the SYSTEM tablespace will result in the installation
FAILING, as using SYSTEM for the temporary tablespace is not recommended.
Wait...
TABLESPACE_NAME
------------------------------
TEMP
Tablespace name is case sensitive.
Temporary tablespace [UNKNOWN]: TEMP
TEMPORARY_TABLESPACE
------------------------------
TEMP
Type of TRCA repository
Create TRCA repoitory as Temporary or Permanent objects?
Enter T for Temporary or P for Permanent.
T is recommended and default value.
Type of TRCA repository [T]: T
TACUSR completed.
No errors.
SQLT$STAGE: created
SQLT$STAGE: READ,WRITE access granted to TRCANLZR
SQLT$STAGE: write test file tasqdirset.txt
SQLT$STAGE: read test file tasqdirset.txt
SQLT$STAGE: get attributes for file tasqdirset.txt
SQLT$STAGE: /opt/rac/oracle/diag/rdbms/rac/rac1/trace
TRCA$STAGE: created
TRCA$STAGE: READ,WRITE access granted to TRCANLZR
TRCA$STAGE: write test file tasqdirset.txt
TRCA$STAGE: read test file tasqdirset.txt
TRCA$STAGE: get attributes for file tasqdirset.txt
TRCA$STAGE: /opt/rac/oracle/diag/rdbms/rac/rac1/trace
SQLT$UDUMP: created
SQLT$UDUMP: READ access granted to TRCANLZR
SQLT$UDUMP: read test file tasqdirset.txt
SQLT$UDUMP: get attributes for file tasqdirset.txt
SQLT$UDUMP: /opt/rac/oracle/diag/rdbms/rac/rac1/trace
SQLT$BDUMP: created
SQLT$BDUMP: READ access granted to TRCANLZR
SQLT$BDUMP: read test file tasqdirset.txt
SQLT$BDUMP: get attributes for file tasqdirset.txt
SQLT$BDUMP: /opt/rac/oracle/diag/rdbms/rac/rac1/trace
TRCA$INPUT1: created
TRCA$INPUT1: READ access granted to TRCANLZR
TRCA$INPUT1: read test file tasqdirset.txt
TRCA$INPUT1: get attributes for file tasqdirset.txt
TRCA$INPUT1: /opt/rac/oracle/diag/rdbms/rac/rac1/trace
TRCA$INPUT2: created
TRCA$INPUT2: READ access granted to TRCANLZR
TRCA$INPUT2: read test file tasqdirset.txt
TRCA$INPUT2: get attributes for file tasqdirset.txt
TRCA$INPUT2: /opt/rac/oracle/diag/rdbms/rac/rac1/trace
Connected.
 
TAUTLTEST completed.
no rows selected
TACOBJ completed.
tool_owner: "TRCANLZR"
Creating Package Specs TRCA$G
No errors.
Creating Package Specs TRCA$P
No errors.
Creating Package Specs TRCA$T
No errors.
Creating Package Specs TRCA$I
No errors.
Creating Package Specs TRCA$E
No errors.
Creating Package Specs TRCA$R
No errors.
Creating Package Specs TRCA$X
No errors.
Creating Views
Creating Package Body TRCA$G
No errors.
Creating Package Body TRCA$P
No errors.
Creating Package Body TRCA$T
No errors.
Creating Package Body TRCA$I
No errors.
Creating Package Body TRCA$E
No errors.
Creating Package Body TRCA$R
No errors.
Creating Package Body TRCA$X
No errors.
Creating Grants on Packages
Tool Version
----------------
11.4.3.1
Install Date
----------------
20111008
Directories
--------------------------------------------------------------------------------------------------------------------------------
TRCA$INPUT1(VALID)      /opt/rac/oracle/diag/rdbms/rac/rac1/trace
TRCA$INPUT2(VALID)      /opt/rac/oracle/diag/rdbms/rac/rac1/trace
TRCA$STAGE(VALID)       /opt/rac/oracle/diag/rdbms/rac/rac1/trace
user_dump_dest          /opt/rac/oracle/diag/rdbms/rac/rac1/trace
background_dump_dest    /opt/rac/oracle/diag/rdbms/rac/rac1/trace
 
Libraries
--------------------------------------------------------------------------------------------------------------------------------
VALID PACKAGE TRCA$I /* $Header: 224270.1 tacpkgi.pks 11.4.2.7 2011/04/08 csierra $ */
VALID PACKAGE TRCA$E /* $Header: 224270.1 tacpkge.pks 11.4.2.7 2011/04/08 csierra $ */
VALID PACKAGE TRCA$G /* $Header: 224270.1 tacpkgg.pks 11.4.2.7 2011/04/08 csierra $ */
VALID PACKAGE TRCA$P /* $Header: 224270.1 tacpkgp.pks 11.4.1.4 2010/07/12 csierra $ */
VALID PACKAGE TRCA$R /* $Header: 224270.1 tacpkgr.pks 11.4.2.7 2011/04/08 csierra $ */
VALID PACKAGE TRCA$T /* $Header: 224270.1 tacpkgt.pks 11.4.3.1 2011/06/17 csierra $ */
VALID PACKAGE TRCA$X /* $Header: 224270.1 tacpkgx.pks 11.4.2.7 2011/04/08 csierra $ */
VALID PACKAGE BODY TRCA$I /* $Header: 224270.1 tacpkgi.pkb 11.4.2.7 2011/04/08 csierra $ */
VALID PACKAGE BODY TRCA$E /* $Header: 224270.1 tacpkge.pkb 11.4.2.7 2011/04/08 csierra $ */
VALID PACKAGE BODY TRCA$G /* $Header: 224270.1 tacpkgg.pkb 11.4.2.7 2011/04/08 csierra $ */
VALID PACKAGE BODY TRCA$P /* $Header: 224270.1 tacpkgp.pkb 11.4.3.1 2011/06/17 csierra $ */
VALID PACKAGE BODY TRCA$R /* $Header: 224270.1 tacpkgr.pkb 11.4.2.7 2011/04/08 csierra $ */
VALID PACKAGE BODY TRCA$T /* $Header: 224270.1 tacpkgt.pkb 11.4.3.1 2011/06/17 csierra $ */
VALID PACKAGE BODY TRCA$X /* $Header: 224270.1 tacpkgx.pkb 11.4.2.7 2011/04/08 csierra $ */
TACPKG completed.
Taking a snapshot of some Data Dictionary objects, please wait...
19:56:30 => refresh_trca$_dict_from_this
19:56:30 -> purge_trca$_dict
19:56:30 dict_state_before_purge
19:56:30 -----------------------
19:56:30 -> print_dict_state
19:56:30 dict_refresh_days :
19:56:30 dict_refresh_date :
19:56:30 dict_database_id  :
19:56:30 dict_database_name:
19:56:30 dict_instance_id  :
19:56:30 dict_instance_name:
19:56:30 dict_host_name    :
19:56:30 dict_platform.     :
19:56:30 dict_rdbms_version:
19:56:30 dict_db_files     :
19:56:30 <- print_dict_state
19:56:30 -> purge_trca$_dict_gtt
19:56:30 <- purge_trca$_dict_gtt
19:56:30 dict_state_after_purge
19:56:30 ----------------------
19:56:30 -> print_dict_state
19:56:30 dict_refresh_days :
19:56:30 dict_refresh_date :
19:56:30 dict_database_id  :
19:56:30 dict_database_name:
19:56:30 dict_instance_id  :
19:56:30 dict_instance_name:
19:56:30 dict_host_name    :
19:56:30 dict_platform.     :
19:56:30 dict_rdbms_version:
19:56:30 dict_db_files     :
19:56:30 <- print_dict_state
19:56:30 <- purge_trca$_dict
19:56:30 -> trca$_file$
19:56:30 <- trca$_file$ (6 rows)
19:56:30 using serial execution
19:56:30 -> trca$_segments
19:56:31 <- trca$_segments (6040 rows)
19:56:31 -> trca$_extents_dm
19:56:31 <- trca$_extents_dm (0 rows)
19:56:31 -> trca$_extents_lm
19:56:46 <- trca$_extents_lm (10462 rows)
19:56:46 -> trca$_users
19:56:46 <- trca$_users (22 rows)
19:56:46 -> trca$_extents
19:56:46 <- trca$_extents (10374 rows)
19:56:46 -> purge_trca$_dict_gtt
19:56:46 <- purge_trca$_dict_gtt
19:56:46 -> trca$_tables$
19:56:47 <- trca$_tables$ (2857 rows)
19:56:47 -> trca$_indexes$
19:56:48 <- trca$_indexes$ (4855 rows)
19:56:48 -> trca$_ind_columns$
19:56:49 <- trca$_ind_columns$ (7669 rows)
19:56:49 -> trca$_tab_cols$
19:56:51 <- trca$_tab_cols$ (6864 rows)
19:56:51 -> trca$_objects$
19:56:51 <- trca$_objects$ (7690 rows)
19:56:51 -> trca$_parameter2$
19:56:51 <- trca$_parameter2$ (28 rows)
19:56:51 dict_state_after_refresh
19:56:51 ------------------------
19:56:51 -> print_dict_state
19:56:51 dict_refresh_days : 1
19:56:51 dict_refresh_date : 20111008
19:56:51 dict_database_id  : 2350763456
19:56:51 dict_database_name: RAC
19:56:51 dict_instance_id  : 1
19:56:51 dict_instance_name: rac1
19:56:51 dict_host_name    : rac1
19:56:51 dict_platform.     : Linux
19:56:51 dict_rdbms_version: 11.2.0.1.0
19:56:51 dict_db_files     : 200
19:56:51 <- print_dict_state
19:56:51 <= refresh_trca$_dict_from_this
PL/SQL procedure successfully completed.
Snapshot of some Data Dictionary objects completed.
TAUTLTEST completed.
TACREATE completed. Installation completed successfully.
 
创建了trcanlzr用户和分析trace 文件所需要的对象!

转【Oracle】一款非常好用的trace文件分析工具的更多相关文章

  1. 一款好用且免费的语句分析工具Plan Explorer

    在调优过程中的查询语句优化阶段,分析语句的执行计划是必经之路,一款好的执行计划分析工具确实可以帮助我们事半功倍 小贴士:Plan Explorer是将Plan Explorer 专业版与免费版整合在一 ...

  2. Oracle 10046 trace文件分析

    生成10046 trace文件: SQL> create table t10046 as select * from dba_objects; Table created. SQL> se ...

  3. [Oracle运维工程师手记] 如何从trace 文件,判断是否执行了并行

    [Oracle运维工程师手记系列]如何从trace 文件,判断是否执行了并行 客户说,明明指定了并行的hint,OEM 却报说没有并行,并且提供了画面. 客户的SQL文长这样: INSERT/*+ p ...

  4. 几款开源的hybird移动app框架分析

    几款开源的Hybrid移动app框架分析 Ionic Onsen UI 与 ionic 相比 jQuery Mobile Mobile Angular UI 结论 很多移动开发者喜欢使用原生代码开发, ...

  5. 【转载】推荐5款超实用的.NET性能分析工具

    来源:http://www.csdn.net/article/2012-11-23/2812174-5-Good-and-useful-.NET-Profilers 虽然.NET框架号称永远不会发生内 ...

  6. Animo.js :一款管理 CSS 动画的强大的小工具

    Animo.js 是一个功能强大的小工具,用于管理 CSS 动画.它的特色功能包括像堆栈动画,创建跨浏览器的模糊,设置动画完成的回调等等.Animo 还包括惊人的 animate.css,为您提供了近 ...

  7. 推荐25款实用的 HTML5 前端框架和开发工具【下篇】

    快速,安全,响应式,互动和美丽,这些优点吸引更多的 Web 开发人员使用 HTML5.HTML5 有许多新的特性功能,允许开发人员和设计师创建应用程序和网站,带给用户桌面应用程序的速度,性能和体验. ...

  8. Oracle中有个tkprof来格式化oracle的trace文件

    1.MySQL日志文件系统的组成2.慢查询日志3.慢查询日志演示long_query_time : 设定慢查询的阀值,超出次设定值的SQL即被记录到慢查询日志,缺省值为10sslow_query_lo ...

  9. [原创]推荐一款强大的.NET程序内存分析工具.NET Memory Profiler

    [原创]推荐一款强大的.NET程序内存分析工具.NET Memory Profiler 1 官方网站:http://memprofiler.com/2 下载地址:http://memprofiler. ...

随机推荐

  1. SQL Server 调优系列进阶篇 - 查询优化器的运行方式

    前言 前面我们的几篇文章介绍了一系列关于运算符的基础介绍,以及各个运算符的优化方式和技巧.其中涵盖:查看执行计划的方式.几种数据集常用的连接方式.联合运算符方式.并行运算符等一系列的我们常见的运算符. ...

  2. SGU 110. Dungeon 计算几何 难度:3

    110. Dungeon time limit per test: 0.25 sec. memory limit per test: 4096 KB The mission of space expl ...

  3. 51nod1295

    题解: 考虑到是异或,那么就是位运算 位运算会想到什么?当然是按位拆开 那么就变成了一个个的字符串 考虑了trie 可是貌似有多个问题 那么就用可持久化trie! 代码: #include<bi ...

  4. property 的详细使用方法

    property(fget=None, fset=None, fdel=None, doc=None)  俗话说条条大路通罗马,同样是完成一件事,Python 其实提供了好几个方式供你选择. prop ...

  5. constexpr和常量表达式的注意事项

    1.常量表达式,是指其值不可改变,且在编译阶段就已经得出计算结果的表达式,例如字面值就是常量表达式. 2.判断是否是常量表达式,要关注数据类型是否是const类型,初始值是否是在编译阶段就得到的. 3 ...

  6. 2.2 C++类的成员变量和成员函数

    参考:http://www.weixueyuan.net/view/6334.html 总结: 类成员的声明和定义: 类成员函数的定义分类内定义(内联)和类外定义(可用 inline 关键字 强制转换 ...

  7. DevExpress v17.2—WPF篇(一)

    用户界面套包DevExpress v17.2终于正式发布,本站将以连载的形式为大家介绍各版本新增内容.本文将介绍了DevExpress WPF v17.2 新的Hamburger Menu.Sched ...

  8. ESET Smart Security 免费60天

    领取地址:http://goo.gl/aEl2Xy 兑换地址:http://goo.gl/h1n62K

  9. 特征选择: 卡方检验、F 检验和互信息

    特征选择是特征工程中的重要一环,其主要目的是从所有特征中选出相关特征 (relevant feature),或者说在不引起重要信息丢失的前提下去除掉无关特征 (irrelevant feature) ...

  10. firefor打不开问题

    解决办法如下,点击开始→运行→输入命令 firefox.exe -p -no-remote ,win7系统用户好像开始下没有运行栏,同时按键盘win+R键即可打开运行窗口,然后点击创建配置文件,创建一 ...