本篇文章主要介绍了"Oracle TRCA 工具 说明 ",主要涉及到Oracle TRCA 工具 说明 方面的内容,对于Oracle TRCA 工具 说明 感兴趣的同学可以参考一下。
 
 

一.TRCA 说明

分析10046的trace 文件,之前介绍过一个工具,tkprof,但是tkprof的功能有限。 相比之下,TRCA工具则能提供更加详细的报告。

关于tkprof 工具说明,参考之前的Blog:

使用Tkprof 分析ORACLE 跟踪文件

http://blog.csdn.net/tianlesoftware/article/details/5632003

Oracle SQLTrace 和 10046事件

http://blog.csdn.net/tianlesoftware/article/details/5857023

Trace Analyzer,also known as TRCANLZR or TRCA, is a toolprovided by Oracle Server Technologies Center of Expertise - ST CoE. TRCAinputs one or several SQL trace(s) generated by Event 10046 and outputs adiagnostics report in two formats (html and text). These reports are commonly usedto diagnose processes performing poorly.

--Trace Analyzer,也称TRCANLZR 或者 TRCA,其由STCoE 提供。 TRCA 输入一个或者多个10046 的trace 文件,然后生成诊断报告,报告有2种格式:html和text。

TRCA identifiesexpensive SQL out of the provided trace(s), then it connects to the databaseand collects their explain plans, Cost-based Optimizer CBO statistics,metadata, configuration parameters, and similar elements that influence theperformance of the process being analyzed.

--TRCA 可以通过trace 分析消耗资源多的SQL时,会连接数据库,收集其执行计划,CBO 的统计信息,metadata,配置参数。 同样的道理,影响性能的进程也会被分析。

For best outputresults TRCA must be installed and used in the same system and database wherethe trace is generated. Understanding that installing TRCA in a production systemis not always possible, TRCA is capable of analyzing a trace using a differentsystem. Refer to the included instructions for details.

--为了达到最好的分析结果,TRCA 必须安装在产生trace 文件相同的系统和数据库上,不过一般生产环境不允许安装TRCA。 TRCA 可以分析跨系统分析trace 文件。

TRCA 工具可以从MOS上下载:

Trace Analyzer TRCANLZR - Interpreting RawSQL Traces with Binds and/or Waits generated by EVENT 10046 [ID 224270.1]

也可以从我的CSDN 下载:

http://download.csdn.net/detail/tianlesoftware/4053543

二.使用示例

2.1 安装TRCA

TRCA installsunder its own schema TRCANLZR. It does not install any objects into theapplication schema(s). You can install this version of TRCA in Oracle databases9.2, 10.1, 10.2, 11.1, 11.2 and higher, on UNIX, Linux or Windows platforms.

--TRCA 会安装到自己的用户:TRCANLZR,不会安装对象到其他用户。

安装方法:

--先解压缩trca,然后使用sys用户运行tacreate.sql

C:\Users\Administrator.DavidDai>cdE:\Software\OracleSoftware\Tools\trca\install

C:\Users\Administrator.DavidDai>E:

E:\Software\OracleSoftware\Tools\trca\install>sqlplus/ as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 9 16:13:20 2012

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

Connected to:

Oracle Database 11g Enterprise EditionRelease 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Miningand Real Application Testing options

SQL>@tacreate.sql

Uninstalling TRCA, please wait

TADOBJ completed.

SQL>

SQL> WHENEVER SQLERROR EXIT SQL.SQLCODE;

SQL> REM If this DROP USER command failsthat means a session is connected with this user.

SQL> DROP USER trcanlzr CASCADE;

SQL> WHENEVER SQLERROR CONTINUE;

SQL>

SQL> SET ECHO OFF;

TADUSR completed.

TADROP completed.

--提示一:这里默认,直接回车

Specify optional Connect Identifier (as perOracle Net) Include "@" symbol, ie. @PROD,If not applicable, enter nothingand hit the "Enter" key

Optional Connect Identifier (ie: @PROD):

--提示二:指定TRCANLZR用户的密码(隐藏,大小写敏感)

Define the TRCANLZR user password (hiddenand case sensitive).

Specify TRCANLZR password:

Re-enter password:

Set up TRCANLZR temporary and defaulttablespaces

Below are the list of online tablespaces inthis database.

Decide which tablespace you wish to createthe TRCANLZR tables

and indexes.  This will also be the TRCANLZR user defaulttablespace.

Specifying the SYSTEM tablespace willresult in the installation

FAILING, as using SYSTEM for tools data isnot supported.

Wait...

Above is the list of online tablespaces inthis database.

Decide which tablespace you wish to createthe TRCANLZR tables

and indexes.  This will also be the TRCANLZR user defaulttablespace.

Specifying the SYSTEM tablespace willresult in the installation

FAILING, as using SYSTEM for tools data isnot supported.

Tablespace name is case sensitive.

--提示三:指定TRCANLZR用户默认表空间

Default tablespace [USERS]:

DEFAULT_TABLESPACE

------------------------------

USERS

Choose the TRCANLZR user temporarytablespace.

Specifying the SYSTEM tablespace willresult in the installation

FAILING, as using SYSTEM for the temporarytablespace is not recommended.

Wait...

TABLESPACE_NAME

------------------------------

TEMP

Tablespace name is case sensitive.

--提示四:指定TRCANLZR用户默认临时表空间

Temporary tablespace [TEMP]:

TEMPORARY_TABLESPACE

------------------------------

TEMP

Type of TRCA repository

Create TRCA repository as Temporary orPermanent objects?

Enter T for Temporary or P for Permanent.

T is recommended and default value.

--提示五:选择保存类型:T,临时,P 永久

Type of TRCA repository [T]:

TACUSR completed.

No errors.

SQLT$STAGE: created

SQLT$STAGE: READ,WRITE access granted toTRCANLZR

SQLT$STAGE: write test file tasqdirset.txt

SQLT$STAGE: read test file tasqdirset.txt

SQLT$STAGE: get attributes for filetasqdirset.txt

SQLT$STAGE:d:\app\administrator\diag\rdbms\dave\dave\trace

TRCA$STAGE: created

TRCA$STAGE: READ,WRITE access granted toTRCANLZR

TRCA$STAGE: write test file tasqdirset.txt

TRCA$STAGE: read test file tasqdirset.txt

TRCA$STAGE: get attributes for filetasqdirset.txt

TRCA$STAGE:d:\app\administrator\diag\rdbms\dave\dave\trace

SQLT$UDUMP: created

SQLT$UDUMP: READ access granted to TRCANLZR

SQLT$UDUMP: read test file tasqdirset.txt

SQLT$UDUMP: get attributes for filetasqdirset.txt

SQLT$UDUMP:d:\app\administrator\diag\rdbms\dave\dave\trace

SQLT$BDUMP: created

SQLT$BDUMP: READ access granted to TRCANLZR

SQLT$BDUMP: read test file tasqdirset.txt

SQLT$BDUMP: get attributes for filetasqdirset.txt

SQLT$BDUMP:d:\app\administrator\diag\rdbms\dave\dave\trace

TRCA$INPUT1: created

TRCA$INPUT1: READ access granted toTRCANLZR

TRCA$INPUT1: read test file tasqdirset.txt

TRCA$INPUT1: get attributes for filetasqdirset.txt

TRCA$INPUT1:d:\app\administrator\diag\rdbms\dave\dave\trace

TRCA$INPUT2: created

TRCA$INPUT2: READ access granted toTRCANLZR

TRCA$INPUT2: read test file tasqdirset.txt

TRCA$INPUT2: get attributes for filetasqdirset.txt

TRCA$INPUT2:d:\app\administrator\diag\rdbms\dave\dave\trace

Connected.

TAUTLTEST completed.

no rows selected

TACOBJ completed.

tool_owner: "TRCANLZR"

role_name: "PUBLIC"

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.4.2

Install Date

----------------

20120209

Directories

------------------------------------------------------------------------------------------------

TRCA$INPUT1(VALID)     d:\app\administrator\diag\rdbms\dave\dave\trace

TRCA$INPUT2(VALID)     d:\app\administrator\diag\rdbms\dave\dave\trace

TRCA$STAGE(VALID)      d:\app\administrator\diag\rdbms\dave\dave\trace

user_dump_dest          d:\app\administrator\diag\rdbms\dave\dave\trace

background_dump_dest   d:\app\administrator\diag\rdbms\dave\dave\trace

Libraries

------------------------------------------------------------------------------------------------

VALID PACKAGE TRCA$I /* $Header: 224270.1tacpkgi.pks 11.4.4.1 2012/01/02 csierra $ */

VALID PACKAGE TRCA$E /* $Header: 224270.1tacpkge.pks 11.4.2.7 2011/04/08 csierra $ */

VALID PACKAGE TRCA$G /* $Header: 224270.1tacpkgg.pks 11.4.2.7 2011/04/08 csierra $ */

VALID PACKAGE TRCA$P /* $Header: 224270.1tacpkgp.pks 11.4.4.1 2012/01/02 csierra $ */

VALID PACKAGE TRCA$R /* $Header: 224270.1tacpkgr.pks 11.4.2.7 2011/04/08 csierra $ */

VALID PACKAGE TRCA$T /* $Header: 224270.1tacpkgt.pks 11.4.3.1 2011/06/17 csierra $ */

VALID PACKAGE TRCA$X /* $Header: 224270.1tacpkgx.pks 11.4.2.7 2011/04/08 csierra $ */

VALID PACKAGE BODY TRCA$I /* $Header:224270.1 tacpkgi.pkb 11.4.4.1 2012/01/02 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.4.2 2012/02/02 csierra $ */

VALID PACKAGE BODY TRCA$P /* $Header:224270.1 tacpkgp.pkb 11.4.4.1 2012/01/02 csierra $ */

VALID PACKAGE BODY TRCA$R /* $Header:224270.1 tacpkgr.pkb 11.4.4.1 2012/01/02 csierra $ */

VALID PACKAGE BODY TRCA$T /* $Header:224270.1 tacpkgt.pkb 11.4.4.1 2012/01/02 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 Dictionaryobjects, please wait...

16:17:25 => refresh_trca$_dict_from_this

16:17:25 -> purge_trca$_dict

16:17:25 dict_state_before_purge

16:17:25 -----------------------

16:17:25 -> print_dict_state

16:17:25 dict_refresh_days :

16:17:25 dict_refresh_date :

16:17:25 dict_database_id  :

16:17:25 dict_database_name:

16:17:25 dict_instance_id  :

16:17:25 dict_instance_name:

16:17:25 dict_host_name    :

16:17:25 dict_platform     :

16:17:25 dict_rdbms_version:

16:17:25 dict_db_files     :

16:17:25 <- print_dict_state

16:17:25 -> purge_trca$_dict_gtt

16:17:25 <- purge_trca$_dict_gtt

16:17:25 dict_state_after_purge

16:17:25 ----------------------

16:17:25 -> print_dict_state

16:17:25 dict_refresh_days :

16:17:25 dict_refresh_date :

16:17:25 dict_database_id  :

16:17:25 dict_database_name:

16:17:25 dict_instance_id  :

16:17:25 dict_instance_name:

16:17:25 dict_host_name    :

16:17:25 dict_platform     :

16:17:25 dict_rdbms_version:

16:17:25 dict_db_files     :

16:17:25 <- print_dict_state

16:17:25 <- purge_trca$_dict

16:17:25 -> trca$_file$

16:17:25 <- trca$_file$ (5 rows)

16:17:25 using serial execution

16:17:25 -> trca$_segments

16:17:25 <- trca$_segments (5391 rows)

16:17:25 -> trca$_extents_dm

16:17:25 <- trca$_extents_dm (0 rows)

16:17:25 -> trca$_extents_lm

16:17:33 <- trca$_extents_lm (8310 rows)

16:17:33 -> trca$_users

16:17:34 <- trca$_users (16 rows)

16:17:34 -> trca$_extents

16:17:35 <- trca$_extents (8105 rows)

16:17:35 -> purge_trca$_dict_gtt

16:17:35 <- purge_trca$_dict_gtt

16:17:35 -> trca$_tables$

16:17:36 <- trca$_tables$ (2806 rows)

16:17:36 -> trca$_indexes$

16:17:37 <- trca$_indexes$ (4726 rows)

16:17:37 -> trca$_ind_columns$

16:17:39 <- trca$_ind_columns$ (7534rows)

16:17:39 -> trca$_tab_cols$

16:17:43 <- trca$_tab_cols$ (6746 rows)

16:17:43 -> trca$_objects$

16:17:44 <- trca$_objects$ (6944 rows)

16:17:44 -> trca$_parameter2$

16:17:44 <- trca$_parameter2$ (17 rows)

16:17:44 dict_state_after_refresh

16:17:44 ------------------------

16:17:44 -> print_dict_state

16:17:44 dict_refresh_days : 1

16:17:44 dict_refresh_date : 20120209

16:17:44 dict_database_id  : 837618292

16:17:44 dict_database_name: DAVE

16:17:44 dict_instance_id  : 1

16:17:44 dict_instance_name: dave

16:17:44 dict_host_name    : DAVIDDAI

16:17:44 dict_platform     : 64-bit Windows

16:17:44 dict_rdbms_version: 11.2.0.1.0

16:17:44 dict_db_files     : 200

16:17:44 <- print_dict_state

16:17:44 <= refresh_trca$_dict_from_this

PL/SQL procedure successfully completed.

Snapshot of some Data Dictionary objectscompleted.

TAUTLTEST completed.

TACREATE completed. Installation completedsuccessfully.

SQL>

2.2 卸载TRCA

UninstallingTRCA removes the TRCA repository and all TRCANLZR schema objects.The TRCANLZR user also gets dropped. To uninstall TRCA simplyexecute trca/install/tadrop.sql connected as SYS.

--卸载时会移除TRCA 的数据和TRCANLZR用户的所有对象,最后也会drop 这个用户,卸载用sys执行脚本:tadrop.sql

# cd trca/install

# sqlplus / as sysdba

SQL> START tadrop.sql

2.3 示例

2.3.1 分析同系统的一个trace文件

--生成10046trace

SQL> oradebug setmypid

Statement processed.

SQL> oradebug event 10046 trace name context forever,level 12;

Statement processed.

SQL> select * from all_users;

SQL> oradebug event 10046 trace name context off;

Statement processed.

SQL> oradebug tracefile_name

d:\app\administrator\diag\rdbms\dave\dave\trace\dave_ora_4588.trc

SQL>

--进入trca/run目录

E:\Software\OracleSoftware\Tools\trca\install>cd../run

E:\Software\OracleSoftware\Tools\trca\run>

--使用生成trace的用户连接sqlplus,

E:\Software\OracleSoftware\Tools\trca\run>sqlplus/ as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 9 16:43:18 2012

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

Connected to:

Oracle Database 11g Enterprise EditionRelease 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Miningand Real Application Testing option

SQL>

--这里直接用sys用户

注意:

这里强调是生成trace 的用户,因为TRCA在分析性能查的SQL时会连接到数据库去收集相关的信息,所以这里必须是生成trace 的用户。

--使用生成trace的用户执行trcanlzr.sql 脚本分析trace

--这里要注意一个trace文件的位置问题,默认情况下这个目录是USER_DUMP_DEST.

SQL> SELECT directory_path FROMdba_directories WHERE directory_name = 'TRCA$INPUT1';

DIRECTORY_PATH

--------------------------------------------------------------------------------

d:\app\administrator\diag\rdbms\dave\dave\trace

SQL> show parameter USER_DUMP_DEST

NAME           TYPE        VALUE

----------------------------------------------- ------------------------------

user_dump_dest    string     d:\app\administrator\diag\rdbms\dave\dave\trace

这个TRCA$INPUT1 的默认位置可以修改,具体见后面常见问题部分。

--开始分析

SQL> @trcanlzr.sql dave_ora_4588.trc

--这里注意2点:

(1)trace名称不包含路径,使用TRCA$INPUT1的目录

(2)sqlplus 连接的是trace 生成的用户

Parameter 1:

Trace Filename or control_file.txt(required)

Value passed to trcanlzr.sql:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TRACE_FILENAME: dave_ora_4588.trc

Analyzing dave_ora_4588.trc

To monitor progress, login as TRCANLZR intoanother session and execute:

SQL> SELECT * FROM trca$_log_v;

... analyzing trace(s) ...

Trace Analyzer completed.

Review first trcanlzr_error.log file forpossible fatal errors.

Review next trca_e15491.log for parsingmessages and totals.

Copying now generated files into localdirectory

TKPROF: Release 11.2.0.1.0 - Development on星期四 2月 9 16:47:53 2012

Copyright (c) 1982, 2009, Oracle and/or itsaffiliates.  All rights reserved.

adding: trca_e15491.html (224 bytes security) (deflated 88%)

adding: trca_e15491.log (224 bytes security) (deflated 83%)

adding: trca_e15491.tkprof (224 bytes security) (deflated 79%)

adding: trca_e15491.txt (224 bytes security) (deflated 84%)

adding: trcanlzr_error.log (224 bytes security) (deflated 81%)

test of trca_e15491.zip OK

deleting: trcanlzr_error.log

Archive:  trca_e15491.zip

Length      Date    Time   Name

--------- ---------- -----   ----

98344  2012/02/09 16:47   trca_e15491.html

16010  2012/02/09 16:47   trca_e15491.log

7368  2012/02/09 16:47   trca_e15491.tkprof

47565  2012/02/09 16:47   trca_e15491.txt

---------                     -------

169287                     4 files

File trca_e15491.zip hasbeen created

--分析结束生成了一个zip 的包,里面包含以上4个文件。该包存在sqlplus 的当前目录下,即开始连接sqlplus 的用户,这里是trca/run目录

TRCANLZR completed.

SQL>

Html 如下:

2.3.2 分析同系统的多个trace文件

--创建controlfile

将多个trace 文件名写入control file,只要名称,不包含路径,每行写一个trace名。

--将controlfile 拷贝到TRCA$INPUT1目录下,这个可以目录可以使用如下SQL 查询:

SQL>SELECT directory_path FROMdba_directories WHERE directory_name = 'TRCA$INPUT1';

--使用trace 的生成用户连接,分析trace

SQL>oradebug setmypid

Statement processed.

SQL>oradebug event 10046 trace name context forever,level 12;

Statement processed.

SQL>select * from dba_data_files;

SQL>oradebug event 10046 trace name context off;

Statement processed.

SQL>oradebug tracefile_name

d:\app\administrator\diag\rdbms\dave\dave\trace\dave_ora_6596.trc

--control_file.txt 内容:

dave_ora_6596.trc

dave_ora_4588.trc

--开始分析

SQL>@trcanlzr.sql control_file.txt

Parameter 1:

Trace Filename or control_file.txt(required)

Value passed to trcanlzr.sql:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TRACE_FILENAME: control_file.txt

Analyzing control_file.txt

To monitor progress, login as TRCANLZR intoanother session and execute:

SQL> SELECT * FROM trca$_log_v;

... analyzing trace(s) ...

Trace Analyzer completed.

Review first trcanlzr_error.log file forpossible fatal errors.

Review next trca_e15492.log for parsingmessages and totals.

Copying now generated files into localdirectory

TKPROF: Release 11.2.0.1.0 - Development on星期四 2月 9 17:05:21 2012

Copyright (c) 1982, 2009, Oracle and/or itsaffiliates.  All rights reserved.

adding: trca_e15492.html (224 bytes security) (deflated 90%)

adding: trca_e15492.log (224 bytes security) (deflated 85%)

adding: trca_e15492.tkprof (224 bytes security) (deflated 81%)

adding: trca_e15492.txt (224 bytes security) (deflated 87%)

adding: trcanlzr_error.log (224 bytes security) (deflated 82%)

test of trca_e15492.zip OK

deleting: trcanlzr_error.log

Archive: trca_e15492.zip

Length      Date    Time   Name

--------- ---------- -----   ----

198791  2012/02/09 17:05   trca_e15492.html

19080  2012/02/09 17:05   trca_e15492.log

10162  2012/02/09 17:05   trca_e15492.tkprof

96165  2012/02/09 17:05   trca_e15492.txt

---------                     -------

324198                     4 files

File trca_e15492.zip has been created

TRCANLZR completed.

SQL>

在报告的顶部会列出分析的trace 文件名。

2.3.3 在Target系统上分析Source系统上的一个trace 文件

(1)在Source数据库上操作,使用SYS 连接,执行/trca/dict/trcadictexp.sql 脚本,生成一个TRCA_DICT.ZIP 文件,其内容是Source data dictionary的一个子集。 执行这部不需要在源库上安装TRCA.

[oracle@localhost ~]$ cd /u01/trca/ dict/

[oracle@localhost dict]$ ls

trcadictexp.sql  trcadictimp.sql  trcadictpurge.sql

[oracle@localhost dict]$ sqlplus / assysdba

SQL*Plus: Release 10.2.0.4.0 - Productionon 星期四 2月 9 18:21:49 2012

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to:

Oracle Database 10g Enterprise EditionRelease 10.2.0.4.0 - Production

With the Partitioning, Data Mining and RealApplication Testing options

SQL> @trcadictexp.sql

exporting data dictionary...

01 of 11: control file

02 of 11: sys.file$

03 of 11: sys.uet$ dictionary managedextents (subset)

04 of 11: sys.x$ktfbue locally managedextents (subset)

05 of 11: dba_segments (subset)

06 of 11: dba_tables

07 of 11: dba_indexes

08 of 11: dba_tab_cols (only indexedcolumns)

09 of 11: dba_ind_columns

10 of 11: dba_objects (subset)

11 of 11: v$parameter2 (subset)

generating zip file...

adding: TRCA_CONTROL.txt (deflated 8%)

adding: TRCA_EXTENTS_DM.txt (stored 0%)

adding: TRCA_EXTENTS_LM.txt (deflated 79%)

adding: TRCA_FILE.txt (deflated 41%)

adding: TRCA_IND_COLUMNS.txt (deflated 87%)

adding: TRCA_INDEXES.txt (deflated 87%)

adding: TRCA_OBJECTS.txt (deflated 82%)

adding: TRCA_PARAMETER2.txt (deflated 47%)

adding: TRCA_SEGMENTS.txt (deflated 83%)

adding: TRCA_TAB_COLS.txt (deflated 84%)

adding: TRCA_TABLES.txt (deflated 83%)

adding: trcadictexp.log (deflated 52%)

test of TRCA_DICT.zip OK

TRCA_DICT.zip has been generated

trcadictexp.sql completed.

--生成的文件在sqlplus的当前目录下。

(2)将生成的TRCA_DICT.zip文件在拷贝到TRCA$STAGE目录下,查看目录使用如下脚本,一般是USER_DUMP_DEST.

SQL>SELECT directory_path FROMdba_directories WHERE directory_name = 'TRCA$STAGE';

(3)将源库生成的trace 文件拷贝到Target 库的TRCA$INPUT1目录下

SQL>SELECT directory_path FROMdba_directories WHERE directory_name = 'TRCA$INPUT1';

这里的文件名是:xezf_ora_24571.trc

(4)在TRCA$STAGE下解压缩TRCA_DICT.ZIP 文件, 其会生成一个TRCA_*.txt的文件,注意不能有文件夹,生成的文件必须直接放在TRCA$STAGE目录下。

# cd [STAGE directory]

# unzip TRCA_DICT.zip

(5)在Target 库,切换trca 目录,使用TRCANLZR 连接sqlplu,执行trca/dict/trcadictimp.sql脚本导入源库的TRCA repository。

E:\Software\OracleSoftware\Tools\trca\dict>sqlplustrcanlzr/oracle

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 9 18:39:38 2012

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

Connected to:

Oracle Database 11g Enterprise EditionRelease 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Miningand Real Application Testing options

SQL> @trcadictimp.sql

Trace Analyzer data dictionary repositoryhas been imported.

trcadictimp.sql completed.

(6)使用trcanlzr用户运行trca/run/trcanlzr.sql 脚本分析之前拷贝过来的trace 文件。

SQL> @trcanlzr.sql xezf_ora_24571.trc

Parameter 1:

Trace Filename or control_file.txt(required)

Value passed to trcanlzr.sql:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TRACE_FILENAME: xezf_ora_24571.trc

Analyzing xezf_ora_24571.trc

To monitor progress, login as TRCANLZR intoanother session and execute:

SQL> SELECT * FROM trca$_log_v;

... analyzing trace(s) ...

Trace Analyzer completed.

Review first trcanlzr_error.log file forpossible fatal errors.

Review next trca_e15493.log for parsingmessages and totals.

Copying now generated files into localdirectory

TKPROF: Release 11.2.0.1.0 - Development on星期四 2月 9 18:43:19 2012

Copyright (c) 1982, 2009, Oracle and/or itsaffiliates.  All rights reserved.

adding: trca_e15493.html (224 bytes security) (deflated 89%)

adding: trca_e15493.log (224 bytes security) (deflated 84%)

adding: trca_e15493.tkprof (224 bytes security) (deflated 78%)

adding: trca_e15493.txt (224 bytes security) (deflated 83%)

adding: trcanlzr_error.log (224 bytes security) (deflated 81%)

test of trca_e15493.zip OK

deleting: trcanlzr_error.log

Archive: trca_e15493.zip

Length      Date    Time   Name

--------- ---------- -----   ----

97228  2012/02/09 18:43   trca_e15493.html

15881  2012/02/09 18:43   trca_e15493.log

8669  2012/02/09 18:43   trca_e15493.tkprof

44707  2012/02/09 18:43   trca_e15493.txt

---------                     -------

166485                     4 files

File trca_e15493.zip has been created

TRCANLZR completed.

小结:

1.我这里的测试环境:

Source : linux + Oracle10gR2

Target : win7 + Oracle 11gR2

2. 不同系统与同系统的区别在于,当系统不同时,需要先使用trca 脚本,把Source 库的data dictionary 导出在导入到Target 系统上,然后使用trcanlzr用户来进行操作。

如果是同系统,那么直接使用生成trace 的用户来连接,因为在分析时,其要收集相关的信息。

2.3.4 在Target系统上分析Source系统上的多个trace 文件

这里的流程和前面的就差不多了。

(1)在Source 库用SYS用户执行trca/dict/trcadictexp.sql脚本,导出TRCA_DICT.ZIP。

# sqlplus / as sysdba

SQL> START trcadictexp.sql

(2)将生成的TRCA_DICT.ZIP 文件拷贝到TARGET系统的TRCA$STAGE目录下,通常是USER_DUMP_DEST。然后解压缩,将文件直接放在TRCA$STAGE目录下。

(3)将要分析的trace 文件都拷贝到Target 系统的TRCA$INPUT1目录下。

(4)创建控制文件,control_file.txt,将要分析的trace 文件名写入control_file.txt,每行一个文件名,不包含路径,然后将控制文件放到TRCA$INPUT1下。

(5)在Target系统上使用TRCANLZR用户连接sqlplus,然后执行trca/dict/trcadictimp.sql导入Source 库的数据字典,在执行trca/run/trcanlzr.sql 脚本分析trace 文件。

三.常见问题

3.1 What is new in this TRCA release?

A summary ofrecent TRCA changes can be found in file trca/doc/trca_changes.html.

3.2 Can I change the TRCA staging directory?

Yes,use trca/utl/tacdirs.sql passing the full directory path. This pathcannot contain the "?" or "*" symbols and it is casesensitive in most systems. This directory must exist in the serverand ORACLE must have read/write access to it.

3.3 Can I change the TRCAinput directories?

Yes, but this isnot recommended. You can use trca/utl/tacdiri1.sql or trca/utl/tacdiri2.sql passing the full directory path. This pathcannot contain the "?" or "*" symbols and it is casesensitive in most systems. This directory must exist in the serverandORACLE must have read access to it.

3.4 How can I expedite"Taking a snapshot of some Data Dictionary objects"?

A snapshot ofsome Data Dictionary objects takes between a couple of minutes and up toseveral hours, depending on the size of the data dictionary. This is the laststep of the installation. If killed, it will be automatically executed when thetool is first used.

To expedite thesnapshot time, and with some loss of functionality, you can disable the snaphotof extents by executing these commands connecting as TRCANLZR:

SET SERVEROUT ON;
EXEC trca$g.set_param('capture_extents', 'N');
EXEC trca$t.refresh_trca$_dict_from_this;

If still"Taking a snapshot of some Data Dictionary objects" takes longer thanseveral hours, it can be disabled altogether with significant loss of functionality,by executing these commands connecting as TRCANLZR: 
SET SERVEROUT ON;
EXEC trca$g.set_param('refresh_dict_repository', 'N');
EXEC trca$t.refresh_trca$_dict_from_this;

Oracle TRCA 工具(转)的更多相关文章

  1. Oracle TRCA 工具 说明 10046

    本篇文章主要介绍了"Oracle TRCA 工具 说明 ",主要涉及到Oracle TRCA 工具 说明 方面的内容,对于Oracle TRCA 工具 说明 感兴趣的同学可以参考一 ...

  2. Oracle客户端工具出现“Cannot access NLS data files or invalid environment specified”错误的解决办法

    Oracle客户端工具出现"Cannot access NLS data files or invalid environment specified"错误的解决办法 方法一:参考 ...

  3. 电脑上不安装Oracle时,C# 调用oracle数据库,Oracle客户工具

    Oracle的安装包通常都比较大,安装又比较费时,而且如果安装过程中不幸出错,各种蛋疼,即便是安装过N遍的老手,有时候安装起来也觉得挺烦.而工作中,通常服务器上面安装oracle就可以了,我们本地电脑 ...

  4. 客户视角:Oracle ETL工具ODI

    客户视角:Oracle ETL工具ODI 数据集成已成为企业在追求市场份额中的关键技术组件,与依靠手工编码的方式不同,越来越多的企业选择完整的数据集成解决方案来支持其IT战略,从大数据分析到云平台的集 ...

  5. oracle tkprof 工具详解

    oracle  tkprof 工具详解 今天是2013-09-26,进行tkprof工具使用学习,在此记录一下笔记: 一)查看需要跟踪会话信息: select s.sid,s.serial#,s.us ...

  6. Oracle客户端工具安装

    Oracle简易客户端登录工具安装 @[Database|Oracle|客户端工具] [TOC] 引言 Oracle服务的安装是一件的繁琐的事情,我们往往喜欢在本地不安装oracle数据库的方式来访问 ...

  7. oracle12c:通过oracle客户端工具配置tns,并使用sqlldr进行批量导入数据

    通过oracle客户端工具配置tns: 进入oracle配置工具“Net Configuration Assistant”-> 点击“下一步”,完成tns配置. 测试是否tns可用 命令:tns ...

  8. 电脑上不安装Oracle时,C# 调用oracle数据库,Oracle客户工具 【转载】

    http://www.cnblogs.com/jiekzou/p/5047850.html Oracle的安装包通常都比较大,安装又比较费时,而且如果安装过程中不幸出错,各种蛋疼,即便是安装过N遍的老 ...

  9. Oracle诊断工具 - ORA-4030 Troubleshooting Tool

    ORA-4030 说明Oracle服务器进程(server process)无法在操作系统(OS)上分配到足够的内存.   导致ORA-4030 的主要原因有: -物理内存不足 -OS kernel/ ...

随机推荐

  1. Javascript 验证上传图片大小[客户端验证]

    需求分析: 在做上传图片的时候,如果不限制上传图片大小,后果非常的严重.那么我们怎样才可以解决一个棘手的问题呢?有两种方式: 1)后台处理: 也就是AJAX POST提交到后台,把图片上传到服务器上, ...

  2. 011杰信-创建购销合同Excel报表系列-4-建立合同货物(修改,删除):合同货物表是购销合同表的子表

    前面的一篇文章做的是修改删除,这篇文章做的是合同货物的修改和删除. 业务功能如下:

  3. 【BZOJ】1675: [Usaco2005 Feb]Rigging the Bovine Election 竞选划区(暴力dfs+set判重)

    http://www.lydsy.com/JudgeOnline/problem.php?id=1675 一开始我写了个枚举7个点....... 但是貌似... 写挫了. 然后我就写dfs.. 判重好 ...

  4. Linux下面变量的疑问处

    SHLVL是Shell累加器的变量,具体请看下面 http://www.cnblogs.com/ziyunfei/p/4803832.html OLDPWD = old pwd(就是是之前一次的pwd ...

  5. Oracle Data Provider for .NET的使用(三)-ORACLE与.NET类型对应关系

    想来这个是最重要的事情了,因为多数情况下,我们使用dbhelper来调用数据库的时候,是因为如下三个地方导致错误: 1.错误的sql语句:末尾多了分号,少了部分关键字 2.sql中的参数与parame ...

  6. HTML 标签 参考手册

    按功能类别排列 基础 标签 描述 <!DOCTYPE>  定义文档类型. <html> 定义 HTML 文档. <title> 定义文档的标题. <body& ...

  7. JavaScript 二、eval 和 with 函数

    /* * ========================================================= * * JavaScript 词法欺骗 * * 1.欺骗词法作用域,会导致 ...

  8. Hibernate_day01--解决配置文件没有提示问题_演示常见错误

    解决配置文件没有提示问题 1 可以上网 2 把约束文件引入到eclipse中 (1)在配置文件中复制一句话 重启eclipse开发工具 演示常见错误 1 在映射配置文件中,把name属性值写错了,和实 ...

  9. Python 正则表达式贪婪模式

    贪婪模式也就是我们使用 .* 匹配任意字符时会尽可能长地向后匹配,如果我们想阻止这种贪婪模式,需要加个问号,尽可能少地匹配,如下例子: In []: import re In []: html = ' ...

  10. Zabbix-3.0.3结合Grafana-3.1.0给你想要的绘图

    导读 Grafana 是 Graphite 和 InfluxDB 仪表盘和图形编辑器.Grafana 是开源的,功能齐全的度量仪表盘和图形编辑器,支持 Graphite,InfluxDB 和 Open ...