JUST DO IT ~

          我只想當(dāng)個程序員

          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 ;





          創(chuàng)建 plustrace 角色

          cd /sqlplus/admin

           @plustrace

          grant plustrace to public ;








          posted on 2007-11-20 00:34 小高 閱讀(737) 評論(1)  編輯  收藏

          評論

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

          1、使用sys用戶登陸

          2、執(zhí)行 $ORACLE_HOME/rdbms/admin/utlxplan.sql ,生成表。

          3、執(zhí)行 $ORACLE_HOME/sqlplus/admin/plustrce.sql 生成角色等。

          4、對需要使用該功能的用戶賦予角色。

          grant plustrace to public;


          序號

          命令

          解釋


          1

          SET AUTOTRACE OFF

          此為默認(rèn)值,即關(guān)閉Autotrace


          2

          SET AUTOTRACE ON

          產(chǎn)生結(jié)果集和解釋計劃并列出統(tǒng)計


          3

          SET AUTOTRACE ON EXPLAIN

          顯示結(jié)果集和解釋計劃不顯示統(tǒng)計


          4

          SETAUTOTRACE TRACEONLY

          顯示解釋計劃和統(tǒng)計,盡管執(zhí)行該語句但您將看不到結(jié)果集


          5

          SET AUTOTRACE


          TRACEONLY STATISTICS

          只顯示統(tǒng)計




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


          三、Autotrace執(zhí)行計劃的各列的涵義

          序號

          列名

          解釋


          1

          ID_PLUS_EXP

          每一步驟的行號


          2

          PARENT_ID_PLUS_EXP

          每一步的Parent的級別號


          3

          PLAN_PLUS_EXP

          實(shí)際的每步


          4

          OBJECT_NODE_PLUS_EXP

          Dblink或并行查詢時才會用到




          四、AUTOTRACE Statistics常用列解釋

          序號

          列名

          解釋


          1

          db block gets

          從buffer cache中讀取的block的數(shù)量


          2

          consistent gets

          從buffer cache中讀取的undo數(shù)據(jù)的block的數(shù)量


          3

          physical reads

          從磁盤讀取的block的數(shù)量


          4

          redo size

          DML生成的redo的大小


          5

          sorts (memory)

          在內(nèi)存執(zhí)行的排序量


          7

          sorts (disk)

          在磁盤上執(zhí)行的排序量






          ORACLE :: 評論 (0) :: 靜態(tài)鏈接網(wǎng)址 :: 引用 (0)
          發(fā)表評論
            回復(fù)  更多評論   


          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           

          導(dǎo)航

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

          統(tǒng)計

          常用鏈接

          留言簿(3)

          隨筆分類(352)

          收藏夾(19)

          關(guān)注的blog

          手冊

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 淳安县| 安龙县| 钟山县| 台江县| 通城县| 偏关县| 天峻县| 塘沽区| 黑水县| 普兰县| 渭源县| 古浪县| 抚顺市| 依安县| 成安县| 平邑县| 嵊泗县| 内丘县| 金昌市| 武乡县| 陇南市| 平邑县| 乳源| 从江县| 江都市| 平罗县| 射阳县| 资中县| 黄大仙区| 潍坊市| 雷波县| 大港区| 南昌市| 连州市| 内江市| 拜城县| 乃东县| 龙里县| 旺苍县| 湛江市| 中方县|