文章分类 | 推荐文章 | 最新文章 | 热点文章 | 最新软件 | 精品软件 | 下载排行 | 推荐下载 | 免费看大片 | WPS | 杀毒软件
清风网络
首 页 软件下载 网络学院 数码学院
QQ 电脑入门 游戏 操作系统 图形处理 办公软件 媒体动画 精文荟萃 工具软件 网络编程 程序开发 网络技术 认证考试 网站建设 文章专栏
当前位置:清风网络学院程序开发Oracle在Oracle10g Release 2中的Autotrace
精品推荐
特别推荐
·常用数据库比较
·ODBC API常用函数诠释
·提高ORACLE数据库的查询统计速度
·细化解析:Oracle使用的hints调整机制
·解析Oracle/Oracle Forms 的多用途代码
·从Oracle的FORM中调用REPORT的实用技巧
·Oracle SQL精妙SQL语句讲解
·ORACLE学习笔记--性能优化四
·ORACLE常用傻瓜问题1000问
·ORACLE常见错误代码的分析与解决之二
·深刻理解Oracle数据库的启动和关闭
·监控Oracle数据库的常用shell脚本
·Oracle在Solaris下的性能与调整简介
·通俗解说ORACLE
·数据库安全性策略
热点TOP10
·详细介绍ORACLE sqlplus命令
·ORACLE常用傻瓜问题1000问
·我的oracle笔记四(DBA管理)
·Oracle SQL精妙SQL语句讲解
·Oracle Tuning (Oracle 性能调整)的一些总结
·我的oracle笔记一(sql语句方面)
·程序员如何掌握计算机英语
·用正则表达式函数验证身份证号码合法性
·oracle数据库 exp/imp命令详解
·性能分析工具的使用
·ORACLE UPDATE 语句语法与性能分析看法
·在Solaris 10 X86上安装Oracle 10g RAC详解 (1)
·ORA-01092: ORACLE 例程终止。强行断开连接
·VMware下RedHat安装Oracle 9i RAC全攻略
·监控Oracle数据库的常用shell脚本
·手工创建oracle数据库
·常用数据库比较
·PL/Sql循序渐进全面学习教程
·在Solaris 10 X86上安装Oracle 10g RAC详解 (2)
·Oracle客户端文件打包

在Oracle10g Release 2中的Autotrace

日期:2007年7月2日 作者: 查看:[大字体 中字体 小字体]


   今天在测试过程中,偶然发现在Oracle10g Release 2中,Autotrace的功能已经被极大加强和改变。
  
  这是一个很有意思的小的变化,关于autotrace的使用,请参考:启用AutoTrace
  
  接下来让我们先来看一下什么地方发生了改变: SQL> set linesize 120
  
  SQL> set autotrace on
  SQL> select count(*) from v$session
   2 /
  
   COUNT(*)
  ----------
      21
  
  
  Execution Plan
  ----------------------------------------------------------
  Plan hash value: 2376410614
  
  ---------------------------------------------------------------------------------------------
   Id  Operation         Name       Rows  Bytes Cost (%CPU) Time  
  ---------------------------------------------------------------------------------------------
    0 SELECT STATEMENT                 1   65    0  (0) 00:00:01
    1  SORT AGGREGATE                  1   65            
    2   NESTED LOOPS                  1   65    0  (0) 00:00:01
  * 3   FIXED TABLE FULL    X$KSUSE        1   52    0  (0) 00:00:01
  * 4   FIXED TABLE FIXED INDEX X$KSLED (ind:2)    1   13    0  (0) 00:00:01
  ---------------------------------------------------------------------------------------------
  
  Predicate Information (identified by operation id):
  ---------------------------------------------------
  
    3 - filter("S"."INST_ID"=USERENV('INSTANCE') AND BITAND("S"."KSSPAFLG",1)<>0 AND
         BITAND("S"."KSUSEFLG",1)<>0)
    4 - filter("S"."KSUSEOPC"="E"."INDX")
  
  
  Statistics
  ----------------------------------------------------------
  1 recursive calls
  0 db block gets
  0 consistent gets
  0 physical reads
  0 redo size
  411 bytes sent via SQL*Net to client
  385 bytes received via SQL*Net from client
  2 SQL*Net roundtrips to/from client
  0 sorts (memory)
  0 sorts (disk)
  1 rows processed
  
  注意,此时autotrace的输出被良好格式化,并给出关于执行计划部分的简要注释。
  其实这里并没有带来新的东西,从Oracle9i开始,Oracle提供了一个新的工具dbms_xplan用以格式化和查看SQL的执行计划。其原理是通过对plan_table的查询和格式化提供更友好的用户输出。
  
  dbms_xplan的调用的语法类似:
  select * from table(dbms_xplan.display(format=>'BASIC'))
  使用 TABLE() 操作符,或者 CAST 操作。
  
  具体用法可以参考Oracle官方文档。
  
  实际上从Oracle9i开始我们就经常使用如下方式调用dbms_xplan:
  Connected to:
  Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
  With the Partitioning option
  JServer Release 9.2.0.4.0 - Production
  
  SQL> explain plan for
   2 select count(*) from dual;
  
  Explained.
  
  SQL> @?/rdbms/admin/utlxplp;
  
  PLAN_TABLE_OUTPUT
  ----------------------------------------------------------------------------------
  
  --------------------------------------------------------------------
   Id  Operation       Name    Rows  Bytes Cost 
  --------------------------------------------------------------------
    0 SELECT STATEMENT                     
    1  SORT AGGREGATE                     
    2   TABLE ACCESS FULL  DUAL               
  --------------------------------------------------------------------
  
  Note: rule based optimization
  
  10 rows selected.
  
  utlxplp.sql脚本中正是调用了dbms_xplan:
  
  SQL> get ?/rdbms/admin/utlxplp;
  1 Rem
  2 Rem $Header: utlxplp.sql 23-jan-2002.08:55:23 bdagevil Exp $
  3 Rem
  4 Rem utlxplp.sql
  5 Rem
  6 Rem Copyright (c) 1998, 2002, Oracle Corporation. All rights reserved.
  7 Rem
  8 Rem  NAME
  9 Rem   utlxplp.sql - UTiLity eXPLain Parallel plans
  10 Rem
  11 Rem  DESCRIPTION
  12 Rem   script utility to display the explain plan of the last explain plan
  13 Rem     command. Display also Parallel Query information if the plan happens to
  14 Rem   run parallel
  15 Rem
  16 Rem  NOTES
  17 Rem   Assume that the table PLAN_TABLE has been created. The script
  18 Rem   utlxplan.sql should be used to create that table
  19 Rem
  20 Rem   With SQL*plus, it is recomended to set linesize and pagesize before
  21 Rem   running this script. For example:
  22 Rem      set linesize 130
  23 Rem      set pagesize 0
  24 Rem
  25 Rem  MODIFIED  (MM/DD/YY)
  26 Rem  bdagevil  01/23/02 - rewrite with new dbms_xplan package
  27 Rem  bdagevil  04/05/01 - include CPU cost
  28 Rem  bdagevil  02/27/01 - increase Name column
  29 Rem  jihuang   06/14/00 - change order by to order siblings by.
  30 Rem  jihuang   05/10/00 - include plan info for recursive SQL in LE row source
  31 Rem  bdagevil  01/05/00 - make deterministic with order-by
  32 Rem  bdagevil  05/07/98 - Explain plan script for parallel plans
  33 Rem  bdagevil  05/07/98 - Created
  34 Rem
  35 set markup html preformat on
  36 Rem
  37 Rem Use the display table function from the dbms_xplan package to display the last
  38 Rem explain plan. Use default mode which will display only relevant information
  39 Rem
  40* select * from table(dbms_xplan.display());
  41
  SQL>
  
  而在Oracle10gR2中,Oracle帮我们简化了这个过程,一个autotrace就完成了所有的输出,这也是易用性上的一个进步吧。在使用 Oracle的过程中,我们经常能够感受到Oracle针对用户需求或易用性的改进,这也许是很多人喜爱Oracle的一个原因吧。
  
  如果足够信息我们还会注意到,在Oracle10g中PLAN_TABLE不再需要创建,Oracle缺省增加了一个字典表PLAN_TABLE$,然后基于PLAN_TABLE$创建公用同义词供用户使用。
  
  关于dbms_xplan工具的使用还可以参考Itpub上的讨论:使用dbms_xplan工具查看执行计划.


[1] [2] 下一页 




上一篇:ORACLE碎片整理 (1)

下一篇:Oracle聚合函数RANK和dense_rank的使用

在Oracle10g Release 2中的Autotrace 相关文章:
·RFC4083 - Input 3rd-Generation Partnership Project (3GPP) Release 5 Requirements on the Session Initiation Protocol (SIP)
·3GPP2的cdma2000 1x Release0协议一致性测试
·在RedHat 7.0下Oracle 8I release 2 (version 8.1.6)的安装实例
·Oracle 10g Release2新功能之变化通知
·Oracle10g Release 2手工建立数据库步骤
·15.12 The lock statementreleases the lock.
·ReleaseCapture
·ImageLoader 1.1 Release
·MyHTML Player release v1.1
·Oracle 10G First Release的新特性简介(下)
在Oracle10g Release 2中的Autotrace 相关软件:
·Solaris 9 (SPARC Platform) Release Notes
·Office 2007 Pre Release
·dBpowerAMP Music Converter Release V10 Beta 4 汉化版
·PHP Coder R2 Final Prerelease 3 汉化补丁
·Miranda IM v0.5 Preview Release 5
·3D RPG Editor releaseV2 Build 845 汉化版
·iDowS v3.0 RC2 Release
·COCOON Db Tools Final Release 完整篇
·Sveta Portable Audio Release 4 Beta 2
·Ultr@VNC Release CandidateV1.01

特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
[打印本页] [关闭窗口] 转载请注明来源:http://www.vipcn.net
| 帮助(?) | 版权声明 | 友情连接 | 关于我们 | 信息发布
Copyright 2007 www.vipcn.net All Rights Reserved. 鄂ICP备05000083号Powered by:viphot