JUST DO IT ~

我只想当个程序员

autotrace explain plan 安装 oracle

不废话。


C:\oracle\ora92\rdbms\admin

 脚本utlxplan.sql

run @utlxplan

 

rem
rem $Header: utlxplan.sql 29-oct-2001.20:28:58 mzait Exp $ xplainpl.sql
rem
Rem Copyright (c) 1988, 2001, Oracle Corporation.  All rights reserved. 
Rem NAME
REM    UTLXPLAN.SQL
Rem  FUNCTION
Rem  NOTES
Rem  MODIFIED
Rem     mzait      10/26/01  - add keys and filter predicates to the

plan table
Rem     ddas       05/05/00  - increase length of options column
Rem     ddas       04/17/00  - add CPU, I/O cost, temp_space columns
Rem     mzait      02/19/98 -  add distribution method column
Rem     ddas       05/17/96 -  change search_columns to number
Rem     achaudhr   07/23/95 -  PTI: Add columns partition_{start, stop,

id}
Rem     glumpkin   08/25/94 -  new optimizer fields
Rem     jcohen     11/05/93 -  merge changes from branch 1.1.710.1 -

9/24
Rem     jcohen     09/24/93 - #163783 add optimizer column
Rem     glumpkin   10/25/92 -  Renamed from XPLAINPL.SQL
Rem     jcohen     05/22/92 - #79645 - set node width to 128 (M_XDBI in

gendef)
Rem     rlim       04/29/91 -         change char to varchar2
Rem   Peeler     10/19/88 - Creation
Rem
Rem This is the format for the table that is used by the EXPLAIN PLAN
Rem statement.  The explain statement requires the presence of this
Rem table in order to store the descriptions of the row sources.

create table PLAN_TABLE (
 statement_id  varchar2(30),
 timestamp     date,
 remarks       varchar2(80),
 operation     varchar2(30),
 options        varchar2(255),
 object_node   varchar2(128),
 object_owner  varchar2(30),
 object_name   varchar2(30),
 object_instance numeric,
 object_type     varchar2(30),
 optimizer       varchar2(255),
 search_columns  number,
 id  numeric,
 parent_id numeric,
 position numeric,
 cost  numeric,
 cardinality numeric,
 bytes  numeric,
 other_tag       varchar2(255),
 partition_start varchar2(255),
        partition_stop  varchar2(255),
        partition_id    numeric,
 other  long,
 distribution    varchar2(30),
 cpu_cost numeric,
 io_cost  numeric,
 temp_space numeric,
        access_predicates varchar2(4000),
        filter_predicates varchar2(4000));

 

 


 create public synonym plan_table for plan_table ;

 grant all on plan_table to public ;





创建 plustrace 角色

cd /sqlplus/admin

 @plustrace

grant plustrace to public ;








posted on 2007-11-20 00:34 小高 阅读(727) 评论(1)  编辑  收藏

评论

# re: autotrace explain plan 安装 oracle 2007-11-26 16:43 小高

1、使用sys用户登陆

2、执行 $ORACLE_HOME/rdbms/admin/utlxplan.sql ,生成表。

3、执行 $ORACLE_HOME/sqlplus/admin/plustrce.sql 生成角色等。

4、对需要使用该功能的用户赋予角色。

grant plustrace to public;


序号

命令

解释


1

SET AUTOTRACE OFF

此为默认值,即关闭Autotrace


2

SET AUTOTRACE ON

产生结果集和解释计划并列出统计


3

SET AUTOTRACE ON EXPLAIN

显示结果集和解释计划不显示统计


4

SETAUTOTRACE TRACEONLY

显示解释计划和统计,尽管执行该语句但您将看不到结果集


5

SET AUTOTRACE


TRACEONLY STATISTICS

只显示统计




Eg:SET AUTOTRACE ON, set timing on, alter session set time_statistics=true;


三、Autotrace执行计划的各列的涵义

序号

列名

解释


1

ID_PLUS_EXP

每一步骤的行号


2

PARENT_ID_PLUS_EXP

每一步的Parent的级别号


3

PLAN_PLUS_EXP

实际的每步


4

OBJECT_NODE_PLUS_EXP

Dblink或并行查询时才会用到




四、AUTOTRACE Statistics常用列解释

序号

列名

解释


1

db block gets

从buffer cache中读取的block的数量


2

consistent gets

从buffer cache中读取的undo数据的block的数量


3

physical reads

从磁盘读取的block的数量


4

redo size

DML生成的redo的大小


5

sorts (memory)

在内存执行的排序量


7

sorts (disk)

在磁盘上执行的排序量






ORACLE :: 评论 (0) :: 静态链接网址 :: 引用 (0)
发表评论
  回复  更多评论   


只有注册用户登录后才能发表评论。


网站导航:
 

导航

<2007年11月>
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678

统计

常用链接

留言簿(3)

随笔分类(352)

收藏夹(19)

关注的blog

手册

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜