02 2014 档案

摘要:from http://www.oracle.com/technetwork/articles/sharma-indexes-093638.htmlConventional wisdom holds that bitmap indexes are most appropriate for columns having low distinct values--such as GENDER, MARITAL_STATUS, and RELATION. This assumption is not completely accurate, however. In reality, a bitmap 阅读全文
posted @ 2014-02-27 00:56 princessd8251 阅读(128) 评论(0) 推荐(0) 编辑
摘要:from http://www.akadia.com/services/ora_bitmapped_index.htmlOverviewOracle's two major index types areBitmap indexesandB-Tree indexes. B-Tree indexes are the regular type thatOLTP systemsmake much use of, and bitmap indexes are a highly compressed index type that tends to be used primarily forda 阅读全文
posted @ 2014-02-27 00:41 princessd8251 阅读(156) 评论(0) 推荐(0) 编辑
摘要:转自 http://blog.itpub.net/9842/viewspace-343286/位图(bitmap)索引是另外一种索引类型,它的组织形式与B树索引相同,也是一棵平衡树。与B树索引的区别在于叶子节点里存放索引条目的方式不同。从前面我们知道,B树索引的叶子节点里,对于表里的每个数据行,如果被索引列的值不为空的,则会为该记录行在叶子节点里维护一个对应的索引条目。而位图索引则不是这样,其叶子节点里存放的索引条目如下图所示。假设某个表T里所有的记录在列C1上只具有三个值:01、02和03。在表T的C1列上创建位图索引以后,则叶子节点的内容如图9-14所示。可以看到,位图索引只有三个索引条目 阅读全文
posted @ 2014-02-27 00:35 princessd8251 阅读(149) 评论(0) 推荐(0) 编辑
摘要:转自 http://www.cnblogs.com/LBSer/p/3322630.html1. 案例 有张表名为table的表,由三列组成,分别是姓名、性别和婚姻状况,其中性别只有男和女两项,婚姻状况由已婚、未婚、离婚这三项,该表共有100w个记录。现在有这样的查询: select * from table where Gender=‘男’ and Marital=“未婚”;姓名(Name)性别(Gender)婚姻状况(Marital)张三男已婚李四女已婚王五男未婚赵六女离婚孙七女未婚.........1)不使用索引 不使用索引时,数据库只能一行行扫描所有记录,然后判断该记录是否满足查... 阅读全文
posted @ 2014-02-27 00:09 princessd8251 阅读(149) 评论(0) 推荐(0) 编辑
摘要:转自 http://www.askoracle.org/oracle/performance/654.html1.统计信息简介统计信息主要是描述数据库中表,索引的大小,规模,数据分布状况等的一类信息。比如,表的行数,块数,平均每行的大小,索引的leaf blocks,索引字段的行数,不同值的大小等,都属于统计信息。CBO正是根据这些统计信息数据,计算出不同访问路径下,不同join方式下,各种计划的成本,最后选择出成本最小的计划。在CBO(基于代价的优化器模式)条件下,SQL语句的执行计划由统计信息来决定,若没有统计信息则会采取动态采样的方式决定执行计划!可以说统计信息关乎sql的执行计划是否正 阅读全文
posted @ 2014-02-25 23:45 princessd8251 阅读(10571) 评论(0) 推荐(1) 编辑
摘要:转自 http://www.cnblogs.com/mybook/articles/2825370.html创建一个数据库看起来容易,做起来难。若是手动来创建的话,就需要对数据库的内容必须了解,知道各个功能可以执行哪些脚本后可以使用。因此本文收集一些oracle中的rdbms及其他目录的一些脚本说明及使用方法。 $ORACLE_HOME 这个路径就不写了,只写相对路径。这些脚本若不会使用,不知道是否添加参数,就先打开脚本,查看页头的说明,就明白是否需要执行时写入参数。1. @?/rdbms/admin/catlog.sql 执行这个脚本后,创建数据库的统计视图,审计视图。2. @?/rdbms 阅读全文
posted @ 2014-02-25 18:09 princessd8251 阅读(224) 评论(0) 推荐(0) 编辑
摘要:IntroductionTemporary LOBs, as the name would suggest, are not permanent and hence not stored in the database. Normally, the temporary LOB would exist throughout the entire duration of a user's session. However, it is possible to specify that you want the temporary LOB to exist only during the d 阅读全文
posted @ 2014-02-25 01:28 princessd8251 阅读(206) 评论(0) 推荐(0) 编辑
摘要:from http://www.toadworld.com/platforms/oracle/w/wiki/2050.datatypes-temporary-lobs.aspxDatatypes - Temporary LOBsThe previously listed types of LOBs have been permanently storing large amounts of unstructured data by means of the various LOB datatypes. Such LOBs are known as persistent LOBs. Many a 阅读全文
posted @ 2014-02-25 01:24 princessd8251 阅读(230) 评论(0) 推荐(0) 编辑
摘要:IntroductionFor a long time DBAs have been encouraged to use variations on theYAPPmethod of performance tuning, which focuses on wait event monitoring, rather than hit ratios. Tools likeStatspack,AWR,ADDMandSQL Traceare all very useful for gathering wait event information during tuning, but they ten 阅读全文
posted @ 2014-02-25 01:06 princessd8251 阅读(329) 评论(0) 推荐(0) 编辑
摘要:from http://www.oracle-developer.net/display.php?id=425Unloading Oracle data to flat-files is still very common. There are numerous "unloader" utiliti... 阅读全文
posted @ 2014-02-25 01:03 princessd8251 阅读(192) 评论(0) 推荐(0) 编辑
摘要:from http://www.dba-oracle.com/t_reclaim_space_temp_segment.htmQuestion:I was in the process of dropping a table when the instance crashed! I now have a bunch of TEMP segments in the tablespace. How do I reclaim space held by temporary segments in Oracle?Answer: I would wait for SMON to clean it up 阅读全文
posted @ 2014-02-25 01:01 princessd8251 阅读(300) 评论(0) 推荐(0) 编辑
摘要:from http://www.ora00600.com/wordpress/scripts/databasemonitoring/monitoring-temp-space-usage-in-oracle/It’s a common problem encountered by many DBAs on a daily basis; developers writing queries which run out of TEMP space. It can come at the worst of times, too…For example, you’ve run in the scrip 阅读全文
posted @ 2014-02-25 01:00 princessd8251 阅读(437) 评论(0) 推荐(0) 编辑
摘要:from http://www.dba-oracle.com/oracle10g_tuning/t_waits_events_signatures.htmSignature Analysis of Wait EventsThere are many more benefits that can be achieved using information provided by the ASH as it is a useful tool for database activity analysis and performance tuning. The two sample analytica 阅读全文
posted @ 2014-02-25 00:35 princessd8251 阅读(372) 评论(0) 推荐(0) 编辑
摘要:转自 http://news.newhua.com/news/2010/0917/102508.shtmlDUMP是一个动词,它代表一种操作,说的简单一点,拿内存举例,就是原封不动的把某一片内存给展现出来。拿跟踪举例,就是它原始的展示了Oracle处理某个问题的过程。大家在学习研究ORACLE的过程... 阅读全文
posted @ 2014-02-24 15:05 princessd8251 阅读(203) 评论(0) 推荐(0) 编辑
摘要:转自 http://www.tyson1.com/professional/parallel/px_ash.htmActive Session History (ASH) is one of the most powerful debugging tools available to the DBA... 阅读全文
posted @ 2014-02-24 00:58 princessd8251 阅读(1637) 评论(0) 推荐(0) 编辑
摘要:这是10.2版本提出的mutex(互斥)机制用来解决library cache bin latch争夺问题引入的新事件,是否使用这种机制受到隐含参数_kks_use_mutex_pin的限制,从10.2.0.2开始该参数default为true,使用这种机制oracle是为了解决library ca... 阅读全文
posted @ 2014-02-23 13:08 princessd8251 阅读(441) 评论(0) 推荐(0) 编辑
摘要:转自 http://blog.itpub.net/24996904/viewspace-772651因为系统出现事件cursor: pin S wait on X过去几天,在v$session_wait找不到对应的记录,现需要找到引起问题的sid,从其他途径获得了对应的p2,故验证p2与p2raw的... 阅读全文
posted @ 2014-02-23 12:59 princessd8251 阅读(284) 评论(0) 推荐(0) 编辑
摘要:转自 http://blog.sina.com.cn/s/blog_61cd89f60102ecsv.html早上开发的同事反馈ORACLE数据库中无法进行数据查询,随即把写的SQL也发了过来,很简单一个SQL,内容如下:select count(FO_SNO) from EPMFRAMEWORK.... 阅读全文
posted @ 2014-02-23 12:50 princessd8251 阅读(534) 评论(0) 推荐(0) 编辑
摘要:转自 http://www.laoxiong.net/clob-in-procedure.html#more-838客户新上线的一套重要生产系统,某个存储过程每小时调用约11万次,每次调用的逻辑读超过了10000,消耗的CPU占数据库CPU Time的25-30%。很显然,这样一个存储过程是值得优化的。不幸的是,这个存储过程的业务逻辑很复杂,光是参数就有9个。而存储过程所在的包其代码超过了1万行。通过复查代码的方式,耗时耗力,还不一定能够找出问题。诊断性能问题,首要的是了解这个存储过程所大概要完成的业务功能,然后通过trace或instrument收集足够详细的性能数据。从客户和开发商那里了解 阅读全文
posted @ 2014-02-22 01:25 princessd8251 阅读(1475) 评论(0) 推荐(0) 编辑
摘要:http://asktom.oracle.com/pls/asktom/ASKTOM.download_file?p_file=6551378329289980701This is the test harness I use to try out different ideas. It shows two vital sets of statistics for meThe elapsed time difference between two approaches. It very simply shows me which approach is faster by the wall c 阅读全文
posted @ 2014-02-21 11:57 princessd8251 阅读(158) 评论(0) 推荐(0) 编辑
摘要:IN子查询相当于OR条件,根据NULL的逻辑运算规则,哪个条件为TRUE的行就返回那个行,很简单,主要说NOT IN-----------------------------------Q1:单列NOT IN子查询中有NULL的分析---------------------------------drop table test1;drop table test2;create table test1(id number);create table test2(id number);insert into test1 values(1);insert into test1 values(2);i 阅读全文
posted @ 2014-02-21 00:16 princessd8251 阅读(102) 评论(0) 推荐(0) 编辑
摘要:http://www.dba-oracle.com/t_display_multiple_column_values_same_rows.htmUntil 11g, Oracle SQL did not have a direct mechanism for allowing multiple values from the same column to be displayed in the same row of output. SQL is designed not to disallow repeating values on a single line of output, but 阅读全文
posted @ 2014-02-19 23:41 princessd8251 阅读(672) 评论(0) 推荐(0) 编辑
摘要:转自 http://www.blogjava.net/wangbing/archive/2010/03/15/315482.html关于varchar2的最大长度varchar2有两个最大长度:一个是在字段类型4000;一个是在PL/SQL中变量类型32767。今天犯了一个小错误,就是函数的varchar2类型的返回值长度也是4000,而不是我以为的32767。想了一下,这是一个比较容易出错的地方。因为在函数中我可以声明长度超过4000的字符串变量,并且将它作为返回值,这里是不会提示编译错误的。这个函数平时都可以正常执行,而一旦这个字符串长度超过4000,函数执行就会出错。所以这个问题虽然比较 阅读全文
posted @ 2014-02-19 01:21 princessd8251 阅读(239) 评论(0) 推荐(0) 编辑
摘要:From http://www.oracle-developer.net/display.php?id=515This article describes the new LISTAGG function in Oracle 11g Release 2. LISTAGG is a built-in function that enables us to perform string aggregation natively. String aggregation is a popular technique, and there are several methods available on 阅读全文
posted @ 2014-02-19 01:18 princessd8251 阅读(245) 评论(0) 推荐(0) 编辑
摘要:FROM http://www.oracle-developer.net/display.php?id=306Oracle 10g has introduced an extremely useful new group function, COLLECT. This function enables us to aggregate data into a collection, retaining multiple records of data within a single row (like a nested table). One of the main benefits of th 阅读全文
posted @ 2014-02-19 01:15 princessd8251 阅读(138) 评论(0) 推荐(0) 编辑
摘要:下面为您介绍的Java调用Oracle函数方法,共两种情况,一种调用无入参的Oracle函数,一种则是调用有一个入参,一个输出参数以及一个字符串返回值的Oracle函数。调用无入参的函数函数定义CREATEORREPLACEFunctionf_getstringReturnVarchar2Is Begin Return''Stringvalue''; Endf_getstring;调用函数的Java片断CallableStatementcstmt=con.prepareCall("{?=callf_getstring}"); cstmt.re 阅读全文
posted @ 2014-02-18 13:44 princessd8251 阅读(379) 评论(0) 推荐(0) 编辑
摘要:http://beyondrelational.com/modules/2/blogs/80/posts/10768/day-75-plsql-13-how-to-make-custom-aggregate-function-in-oracle.aspxIn this article, we will look into creating our own Aggregate Function in Oracle.User-defined aggregates are a feature of the Extensibility Framework.It is possbile to make 阅读全文
posted @ 2014-02-18 13:30 princessd8251 阅读(370) 评论(0) 推荐(0) 编辑
摘要:CREATE OR REPLACE TYPE STR_SUM_OBJ AS OBJECT --聚合函数的实质就是一个对象 ( SUM_STRING VARCHAR2(4000), STATIC FUNCTION ODCIAGGREGATEINITIALIZE(V_SELF IN OUT STR_SUM_OBJ) RETURN NUMBER, --对象初始化 --聚合函数的迭代方法(这是最重要的方法) MEMBER FUNCTION ODCIAGGREGATEITERATE(SELF IN OUT STR_SUM_OBJ, VALUE ... 阅读全文
posted @ 2014-02-18 12:30 princessd8251 阅读(305) 评论(0) 推荐(0) 编辑
摘要:一. 在虚拟机上 使用rowid 进行update 测试 使用rowid 进行update能提高速度,是因为通过rowid 能够迅速的进行定位,不用全表进行扫描。-- 查看表dave 记录数SYS@dave2(db2)> select count(*) from dave; COUNT(*)---------- 3080115 --300万数据-- 创建测试表dbaSYS@dave2(db2)> create table dba as select * from dave;Table created.--用dave 表去更新DBA表SYS@dave2(db2)> update 阅读全文
posted @ 2014-02-18 11:58 princessd8251 阅读(228) 评论(0) 推荐(0) 编辑
摘要:转自 http://www.eygle.com/archives/2012/10/wmsys_wm_concat.html在网上流传很多文章,描述了使用wmsys.wm_concat对象实现行列转换的方法,这种方法不被Oracle所推荐,因为WMSYS用户用于 Workspace Manager,其函数对象可能因版本而不同,这种变化在11.2.0.3及10.2.0.5中体现出来。原本WM_CONCAT函数返回值为 VARCHAR2变更为CLOB。这一变化导致了很多程序的异常。该函数可以实现行列转换:SQL> select wmsys.wm_concat(username) from db 阅读全文
posted @ 2014-02-18 10:34 princessd8251 阅读(247) 评论(0) 推荐(0) 编辑
摘要:from http://www.orafaq.com/node/2450What I love about writing SQL Tuning articles is that I very rarely end up publishing the findings I set out to achieve. With this one, I set out to demonstrate the advantages of PARALLEL DML, didn't find what I thought I would, and ended up testing 8 differen 阅读全文
posted @ 2014-02-18 10:33 princessd8251 阅读(174) 评论(0) 推荐(0) 编辑
摘要:FROM http://www.razorsql.com/articles/oracle_compile_errors.html When creating procedures, functions, packages, triggers, or package bodies via Oracle, if there are compilation errors, Oracle will store these errors in a system table.To view these errors, you will need to know the type of object bei 阅读全文
posted @ 2014-02-17 15:31 princessd8251 阅读(241) 评论(0) 推荐(0) 编辑
摘要:转自 http://www.itpub.net/forum.php?mod=viewthread&tid=1816475&page=4#pid21826834直方图系列文章(一): 为什么?Jonathan Lewis 发表于2013年8月28号原文链接:http://allthingsoracle.com/histograms-part-1-why/(经作者同意发布中文版,如有转载请注明出处)关于作者:Jonathan Lewis是Oracle世界的知名人物,拥有将近25年的使用经验。他出版了三本关于Oracle的书,并参与写作其他的三本。他最近的著作是《Oracle核心》( 阅读全文
posted @ 2014-02-17 00:04 princessd8251 阅读(245) 评论(0) 推荐(0) 编辑
摘要:转自 http://www.itpub.net/thread-1366572-1-1.html这篇文章是我偶然在asktom上看到的,当时有人问子查询合并(subquery coalescing),TOM给出了这篇文章的链接:http://www.vldb.org/pvldb/2/vldb09-423.pdf我花了大约一周时间翻译,有很多术语找不到相关翻译就只好自己杜撰一个,根据自己的理解对一些难懂的地方做了注释。如果你发现了错误请不吝指正。文中的例子非常值得一读,目前我没有时间去一一验证哪些已由CBO实现,如果你都看懂了对提高自己的SQL技巧是非常有帮助的。插图只上传了前四个,后面的都是一些 阅读全文
posted @ 2014-02-16 23:57 princessd8251 阅读(735) 评论(0) 推荐(0) 编辑
摘要:转自 http://www.itpub.net/thread-1357925-1-1.html这篇文章是关于SQL SERVER的,但仍有参考价值。http://www.simple-talk.com/sql/p ... -a-visual-approach/Designing Efficient SQL: A Visual Approach25 February 2010by Jonathan Lewis设计高效SQL: 一种视觉的方法人们提到SQL时总是说,既然它是一种声明性语言,你不必告诉它如何获得你要的数据; 你只需描述你要找的数据。确实如此:描述你的需求,你就会得到你想要的,但没人能 阅读全文
posted @ 2014-02-16 23:53 princessd8251 阅读(147) 评论(0) 推荐(0) 编辑
摘要:转自 http://www.itpub.net/thread-1396183-1-1.html更(Edition-Based Redefinition)[复制链接]众所周知PLSQL程序具有依赖性,一旦依赖对象被修改程序就会失效,需要重编译,这也是很多人反对使用存储过程的理由,比如这个:http://www.itpub.net/thread-1393352-1-1.html现在这个问题已经被ORACLE完美解决了,你用PLSQL开发的应用可以实现无缝的平滑过渡。总的来说有这么几点:1. 你可以在当前库创建一个新的版本号,这个新版本在发布之前对其他会话是不可见的,你可以随意修改编译你的PLSQL 阅读全文
posted @ 2014-02-16 23:51 princessd8251 阅读(316) 评论(0) 推荐(0) 编辑
摘要:转自 http://www.itpub.net/thread-1254018-1-1.html心血来潮,准备写一篇所有11G新的SQL hint的整理性文章。11G有了一个新的视图v$sql_hint,我们可以通过它找到所有的新的SQL hints。故名思意,INVERSE列代表这个hint相反操作... 阅读全文
posted @ 2014-02-16 23:48 princessd8251 阅读(350) 评论(0) 推荐(0) 编辑
摘要:整理自 http://www.itpub.net/thread-1796279-1-1.html1. select rownum rn from all_objects where rownum select count(*) from (select rownum rn from dual con... 阅读全文
posted @ 2014-02-16 20:17 princessd8251 阅读(446) 评论(0) 推荐(0) 编辑
摘要:转自 http://hnwsha.blog.sohu.com/235686790.html有些东西,不总结一下,还真不能系统化。今天,好好总结一下,在Oracle中,如何把某些列中的值,合并起来从而形成一条记录。 准备工作:准备相关数据,以数据库维护平台中,字段审计表为例,数据记录如下所示: select * from sys_audit_column; 方法一:使用wmsys.wm_concat wmsys.wm_concat将字段的值用","来隔开。 select table_name , column_name , ptdb_name , wmsys.wm_conca 阅读全文
posted @ 2014-02-13 17:50 princessd8251 阅读(190) 评论(0) 推荐(0) 编辑
摘要:转自 http://www.oracle-base.com/articles/10g/character-set-migration.phpThis article presents a simple example of migrating the default character set of a database using the CSSCAN and CSALTER character set scanner utilities provided by Oracle. The basic steps involved in character set conversion are 阅读全文
posted @ 2014-02-13 14:39 princessd8251 阅读(214) 评论(0) 推荐(0) 编辑
摘要:With hints one can influence the optimizer. The usage of hints (with exception of the RULE-hint) causes Oracle to use the Cost Based optimizer.The fol... 阅读全文
posted @ 2014-02-13 14:18 princessd8251 阅读(555) 评论(0) 推荐(0) 编辑
摘要:转自 http://blog.csdn.net/robinson1988/article/details/7025141上周五要下班的时候,盖尔发来一个SQL[html] view plaincopyprint?selecttpc.policy_id,tcm.policy_code,tpf.orga... 阅读全文
posted @ 2014-02-13 14:08 princessd8251 阅读(155) 评论(0) 推荐(0) 编辑
摘要:1.最大值和最小值,如果从索引结构上来看,无非就是从root到branch再到leaf的最左边或者是最右边,一般来说能从叶子的最左边和最右边取到值,那么执行计划里一般会出现index full scan(max/min),这是查询的速度正常来说都是比较快的,逻辑读的次数与索引的高度有关,如果执行计划里出现index full scan(max/min),然而逻辑读又很大,这时候可能是因为叶子的左右节点存在大量被删除的数据,index full scan(max/min)蕴含着stopkey的机制,从最左边或者最右边的叶子节点开始扫描,读到第一个值后就停止扫描,而最左边或者最右边被删除大量数据后 阅读全文
posted @ 2014-02-11 23:53 princessd8251 阅读(485) 评论(0) 推荐(0) 编辑
摘要:转自 http://blog.chinaunix.net/uid-7655508-id-3708308.html访问索引的最大和最小值,ORACLE做了哪些优化呢?不同的版本是否有限制呢?索引是有序存储的,因此,获取索引的最大值,只需要扫描最右(最左desc索引)叶子块,最小值,只需要扫描最左(最右... 阅读全文
posted @ 2014-02-11 20:50 princessd8251 阅读(1598) 评论(0) 推荐(0) 编辑
摘要:转自 http://www.dba-oracle.com/t_hint_no_merge.htmQuestion: I want to understand the no_merge hint and understand when to use the no_merge hint. Is it t... 阅读全文
posted @ 2014-02-11 14:52 princessd8251 阅读(341) 评论(0) 推荐(0) 编辑
摘要:转自http://www.dba-oracle.com/t_export_import_cbo_optimizer_statistics_dbms_stats.htmQuestion:I want to understand when to export and import by dbms_stats statistics and learn when it is a good idea to export and import statistics.Answer: Importing and exporting statistics for the CBO and the systems 阅读全文
posted @ 2014-02-10 21:35 princessd8251 阅读(208) 评论(0) 推荐(0) 编辑
摘要:转自 http://blog.csdn.net/47522341/article/details/5454531事务的锁定和阻塞机制1,oracle锁的分类与产生1.1 oracle的锁类型1.2悲观封锁和乐观封锁1.3阻塞1.4 TM锁的类型1.5 TX锁的类型2,锁相关的数据字典2.1关于v$lock2.2其他相关视图说明3,锁相关的sql statement3.1 TM阻塞的检索3.2 latch阻塞的检索3.3.用于检查系统中锁的简单脚本3.4.显示数据库锁的信息3.5.产生在数据库中持有的锁的报表3.6.产生等待锁的用户的报告3.7.显示持有锁的会话的信息3.8.用于鉴别系统中闩性能 阅读全文
posted @ 2014-02-05 02:31 princessd8251 阅读(396) 评论(0) 推荐(0) 编辑
摘要:转自 http://www.hellodba.com/reader.php?ID=6&lang=CN警告:本工具目前为beta版,可能会造成系统出现不可预知的异常,切勿在任何重要环境中运行! 基于以前开发的一个用于监控线程的CPU使用状况的小工具,TopShow,我开发了一个用于追踪Oracle内部... 阅读全文
posted @ 2014-02-05 01:48 princessd8251 阅读(238) 评论(0) 推荐(0) 编辑
摘要:转自 http://www.oracle-base.com/articles/9i/dbms_xplan.phpTheDBMS_XPLANpackage is used to format the output of an explain plan. It was introduced in Oracle 9i as a replacement for the "utlxpls.sql" script or custom queries of the plan table. Subsequent database versions have increased the fu 阅读全文
posted @ 2014-02-04 01:29 princessd8251 阅读(243) 评论(0) 推荐(0) 编辑
摘要:转自 http://my.oschina.net/feichexia/blog/196575 现实企业级Java开发中,有时候我们会碰到下面这些问题:OutOfMemoryError,内存不足内存泄露线程死锁锁争用(Lock Contention)Java进程消耗CPU过高...... 这些问题在... 阅读全文
posted @ 2014-02-04 01:22 princessd8251 阅读(258) 评论(0) 推荐(0) 编辑
摘要:转自 http://www.itpub.net/thread-1280336-1-1.html其实,许多人已经提到过这个东西了,我这里只是举一个简单的例子演示一遍具体的流程而已比如说优化这个语句:SELECT MAX(P.PAGEVIEW)FROM PRODUCT P, CATALOGRELATEPRODUCT CATAPWHERE CATAP.CATALOGID = 291 AND P.ID = CATAP.PRODUCTID AND PUBLISHSTATUS = 3;我收集运行时的统计信息:SELECT /*+ gather_plan_statistics ZHAOSJ1*/max(P. 阅读全文
posted @ 2014-02-03 03:01 princessd8251 阅读(759) 评论(0) 推荐(0) 编辑
摘要:转自 http://www.hellodba.com/reader.php?ID=12&lang=CNOUTLINE是用于保证语句的执行计划稳定性的一种手段。有的时候,我们也需要借助OUTLINES将一个环境下的语句的执行计划在另外一个环境下(如生产环境下发现的TOP SQL,在测试环境中无法直接重现时)重现,以进行进一步优化。 实际上,HINT是构成一个OUTLINE的重要组成,包含了环境参数的设置、对象的选择、访问顺序及JOIN方式等等能影响该语句的执行计划的因素。SQL代码HELLODBA.COM>select*fromdemo.t_test1whereobject_nam 阅读全文
posted @ 2014-02-03 02:55 princessd8251 阅读(239) 评论(0) 推荐(0) 编辑
摘要:转自 http://otn.itpub.net/12974804/viewspace-1062268/DBMS_XPLAN完整结构-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=ZHONG@ zhongpdbSQL>descdbms_xplanFUNCTIONBUILD_PLAN_XMLRETURNSXMLTYPE参数名称类型输入/输出默认值?-------------------------------------------------------------------TABLE_NAMEVARCHAR2INDEFAULTSTATEM 阅读全文
posted @ 2014-02-03 02:45 princessd8251 阅读(255) 评论(0) 推荐(0) 编辑
摘要:转自 http://www.dbaroad.me/archives/2011/06/dbms_shared_pool_purge.html有时候,我们需要将某个特定的SQL刷出shared pool,使其重新解析,比如遇到bink peeking 执行计划变差的时候,9I里常用授权,把语句相关表进行授权,但影响太大,与该表相关的语句都重新解析了。在10.2.0.4以后有了新方法,用BMS_SHARED_POOL.PURGE来完成:DBMS_SHARED_POOL.PURGE is available from 11.1. In 10.2.0.4, it is availablethrough 阅读全文
posted @ 2014-02-01 01:54 princessd8251 阅读(252) 评论(0) 推荐(0) 编辑
摘要:10G中可以使用dbms_stats.restore_table_stats恢复表老的统计信息,这功能还是挺不错的。因为统计信息的变化有时会引起某些语句执行计划变差,这时恢复原有统计信息,常常会有效果。当然分析前备份老的统计信息,始终是个好习惯。查询统计信息保存时间,当然这个时间不一定能保证:SQL> select DBMS_STATS.GET_STATS_HISTORY_RETENTION from dual;GET_STATS_HISTORY_RETENTION--------------------------- 31也可以通过execut... 阅读全文
posted @ 2014-02-01 01:47 princessd8251 阅读(462) 评论(0) 推荐(0) 编辑
摘要:转自 http://www.dbaroad.me/archives/2011/07/move_sql_profiles.html发现培训环境上某条语句与生产环境一样存在性能问题,生产环境用SQL Profile进行了固化,所以决定把生产环境的SQL Profile都导到测试环境。生产环境导出:SYS@DB1> exec DBMS_SQLTUNE.CREATE_STGTAB_SQLPROF (table_name=>'S_SQLPROFILE',schema_name=>'PERFSTAT');PL/SQL procedure successfu 阅读全文
posted @ 2014-02-01 01:45 princessd8251 阅读(530) 评论(0) 推荐(0) 编辑
摘要:SPM是11G中的功能,写了个脚本,使用其中的LOAD_PLANS_FROM_CURSOR_CACHE来固定执行计划。功能类似9I中的OUTLINE,10G中的SQL PROFILE。sql_id1、child_no1用于生成原语句。sql_id2、child_no2用于生成是调整后语句的计划(一般是手工加过HINT后的计划)set feedback offset sqlblanklines onaccept sql_id1 - prompt 'Enter value for sql_id1(used to generate sql_text): ' - default... 阅读全文
posted @ 2014-02-01 01:42 princessd8251 阅读(392) 评论(0) 推荐(0) 编辑
摘要:转自 http://blog.itpub.net/22034023/viewspace-680497/SQL> select * from v$version;BANNER----------------------------------------------------------------... 阅读全文
posted @ 2014-02-01 01:20 princessd8251 阅读(160) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示