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 小高 閱讀(742) 評論(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

          手冊

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 黑河市| 陵水| 宣恩县| 钟祥市| 蓬莱市| 怀仁县| 山东省| 宝坻区| 东明县| 武穴市| 自治县| 威信县| 和平县| 枣阳市| 胶南市| 宣化县| 手游| 西林县| 舞阳县| 朔州市| 丹凤县| 岑巩县| 汤阴县| 三河市| 涟源市| 台湾省| 鱼台县| 吴旗县| 横峰县| 建水县| 岢岚县| 淮阳县| 平利县| 板桥市| 巴彦县| 抚顺市| 辽宁省| 汉寿县| 泌阳县| 万年县| 东宁县|