03 2014 档案
摘要:fromhttp://social.msdn.microsoft.com/Forums/sqlserver/en-US/1901f6e1-2dc3-4763-874d-d5420345eb3f/processor-could-not-start-the-necessary-thread-resources-for-parallel-query-execution?forum=sqldatabaseengineYou should changethe SQL Server's "Max degree of parallelism"setting from 0(defa
阅读全文
摘要:ProblemI have a busy SQL Server and notice that several queries are running in parallel. I know I can set the max degree of parallelism setting, but what MAXDOP should I use?SolutionThe purpose of this article is to share with the community a discussion I had with a Microsoft PFE (Premier Field Engi
阅读全文
摘要:I was working on an index build issue for an 80 CPU system and kept seeing that only 64 CPUs were getting used. I had carefully studied sys.dm_os_spinlock_stats and sys.dm_os_wait_stats along with performance counters, memory usage pattern, and I/O activities. In fact, I had an 80 CPU, 2TB RAM, 4TB
阅读全文
摘要:转自http://blog.itpub.net/4227/viewspace-1060788/又是一个11g新特性导致的问题。[@more@]这个新特性很早之前就研究过,也在其他客户处碰到过类似的问题。从11g开始,如果一个用户使用不正确的密码尝试登录数据库,那么随着登录失败次数的增加,每次登录验证前延迟等待的时间也会增加:SQL> set time on18:30:54 SQL>18:30:58 SQL> conn test/testConnected.18:31:25 SQL>18:31:25 SQL> conn test/aconn test/aconn t
阅读全文
摘要:转自http://blog.itpub.net/4227/viewspace-674527/SESSION_PRIVS和SESSION_ROLES用来获取用户当前的授权和角色,和V$视图类似,这两个视图访问的是当前生效的权限和角色。对比调用者权限存储过程和定义者权限存储过程:SQL> SELECT ...
阅读全文
摘要:fromhttp://geekswithblogs.net/johnsPerfBlog/archive/2008/04/16/ntext-vs-nvarcharmax-in-sql-2005.aspxI recently profiled a sproc that makes heavy use of the TSQL SUBSTRING function (hundreds of thousands of times) to see how it performs on a SQL 2005 database compared to a SQL 2000 database. Much to
阅读全文
摘要:fromhttp://www.orafaq.com/wiki/JDBCJDBC driversOracle provides three categories of JDBC drivers:JDBC Thin Driver (no local SQL*Net installation requir...
阅读全文
摘要:一.JDBC 连接Oracle 说明JDBC 的应用连接Oracle 遇到问题,错误如下:ORA-12505,TNS:listener does not currently know of SID given in connect descriptor TheConnection descripto...
阅读全文
摘要:最近,一个系统升级后,发现系统运行非常慢。CPU消耗将近100%。用top查看系统,发现一个进程占用了几乎90%的CPU。用以下语句查出进程相应会话正在执行的操作:select b.spid, a.sid, a.username, s.sql_text from vpr...
阅读全文
摘要:生产环境中发现一条语句很慢,拿回来一看,其实是一个简单的Group By语句:表CCMMT的数据量比较大,5M多条记录。1、SQL> select CDE, CID2fromCCMMT3GROUPBY CDE, CID4havingmax(ADT) select DISTINCT CDE, CID...
阅读全文
摘要:数据库版本: 10.2.0.3;案例背景:我们有一个Java程序会从一个配置文件中读取并执行以下一条SQL语句,由查询结果确认是否存在满足条件的数据记录,然后据此再执行后续代码。最初的语句为:SQL代码Selectcount(1)asrowcountfromB2B_BIZ_KEYBWHEREEXIS...
阅读全文
摘要:fromhttp://www.dbaref.com/home/dba-routine-tasks/tracingsessionsFor Query Performance issues the typical requirement is to record wait and bind variable information for queries. This is achieved using 10046 with level 12.The following examples outline how to set the event in various scenarios:Trace
阅读全文
摘要:fromhttp://www.dbaref.com/home/oracle-11g-new-features/costbasedtransformationsoracledatabase10gto11gchangeIn Oracle Database 11g three new enhancements have been made to the cost based transformations. The three enhancements are turned on by default and are controlled by the optimizer_features_enab
阅读全文
摘要:fromhttp://www.dbaref.com/database-tuning/generatingvarioustypesofawrreportsRunning a Basic ReportWith appropriate licenses for AWR, you may generate an AWR report by executing the following script and pick the two snapshots you want to use for the sample :$ORACLE_HOME/rdbms/admin/awrrpt.sqlDependin
阅读全文
摘要:fromhttp://www.dbaref.com/monitoring-blocking-sessionsMany times we see the alert from OEM "Database instance PRODDB1 Warning Session 501 blocking 86 other sessions Feb 6, 2012 11:34:01 AM EST etc............". We have been asked to look at it. Now lets analyse this problem.SQL> SELECT
阅读全文
摘要:fromhttp://www.dbaref.com/tracing-performance-issues-in-oracle/tracingaspecificsqlstatementYou want to trace a specific SQL statement to find where the database is spending its time during the execution of the statement.1. Setup the traceSQL> alter session set events 'sql_trace level 12';
阅读全文
摘要:fromhttp://www.dbaref.com/monitoring-active-sqlThe real-time SQL monitoring feature of Oracle Database enables you to monitor the performance of SQL statements while they are executing. By default, SQL monitoring is automatically started when a SQL statement runs parallel, or when it has consumed at
阅读全文
摘要:Shows current statements for active sessionsselect p.username pu , s.username su,s.status stat, s.sid ssid, s.serial# sser , substr(p.spid,1,8) spid,s...
阅读全文
摘要:fromhttp://www.morganslibrary.org/reference/hints.htmlGeneral InformationHint SectionsAccess Path Hints (Cluster)Miscellaneous HintsQuery Rewrite HintsAccess Path Hints (Table)Model ClauseQuery Transformation HintsCache HintsOnline Application UpgradeSemantic Effect HintsGeneral PurposeOptimization
阅读全文
摘要:fromhttp://www.morganslibrary.org/reference/joins.htmlGeneral InformationLibrary NoteThe Library is currently in the process of being upgraded from Oracle Database Version 11.2.0.3 to 12.1.0.1. Demos are being upgraded to reflect the new Container paradigm as well as EBR (Edition Based Redefinition)
阅读全文
摘要:转自http://www.dbaxiaoyu.com/archives/1872Itpub上的一篇帖子http://www.itpub.net/thread-1851403-3-1.html ,其中是提到sql语句排序与不排序执行效率为何变化如此之大。版本oracle 9I :select *from a1 twhere t.j_uptime >=to_date('2014-02-01', 'yyyy-mm-dd')and t.j_uptime create table table01 as select * from dba_objects;SQL>
阅读全文
摘要:Fromhttp://www.dba-oracle.com/t_sql_loader_tab_delimited_data.htmQuestion: I want to use sqlldr (the SQL:*Loader) utility to load a tab delimited file. How do I specify a tab delimiter in SQL Loader control files?Answer: Oracle SQL*Loader allows you to specify several variations of the tab character
阅读全文
摘要:from http://www.dba-oracle.com/t_push_subq_hint.htmIn general, subqueries that are not merged into the outer query are sometimes executed as the last step in the execution plan. Thepush_subqhint is used to force all subqueries in the query block to be executed at the earliest possible place in the e
阅读全文
摘要:转自http://psoug.org/reference/dbms_auto_task_admin.htmlOracleDBMS_AUTO_TASK_ADMINVersion 11.1GeneralNote:Optimizer statistics are automatically gathered by automatic optimizer statistics collection, which gathers statistics on all objects in the database which have stale or missing statistics. Automa
阅读全文
摘要:转自 回帖http://www.itpub.net/thread-1306866-1-1.html首先,我们看看 Jonathan Lewis 的解释:• Merge / no_merge: if you use a complex view (e.g. aggregate view, or join view) in your query, should you rewrite the query to merge the tables in the view into a single from clause with all the other tables (merge), or s.
阅读全文
摘要:今天在QQ群的技术讨论中有人提及AWR实际保留的天数并非10g的 7天 或 11g 的 8天 ,而是视乎SYSAUX表空间的使用率而定,当SYSAUX表空间空闲空间较多时会将AWR数据保留地更久。虽然不知道以上这番理论出自那部书籍,但是至少是说的有模有样的,而且网友还告诉我这是他测试过的结果。实际是这样吗?我相信这位网友并没有吹牛,他很可能查询dba_hist_snapshot等AWR视图且看到了的确有7天之前的快照仍被保留着,而没有被清理掉。我们来重演他所看到的现场:测试使用版本11.2.0.2 , 11g中默认AWR保留8天:SQL> select * from v$version;
阅读全文
摘要:转自http://www.jiagulun.com/thread-120-1-1.htmlDescriptionPush a predicate into a viewRequires the session parameter "_push_join_predicate" to be set to TRUEVersionsThis operation was introduced in Oracle 8.1.5This operation is implemented in the following versions8.1.58.1.68.1.79.0.19.2.010
阅读全文
摘要:转自http://www.dba-oracle.com/t_packages_dbms_auto_task_admin.htmOracle 11g introduces a new feature called Automated Maintenance Tasks (AMR) and AMRstarts with some of the more common duties of a database administrator. Information gathered from the AWR repository is analyzed by Autotask and it then
阅读全文
摘要:转自http://blog.chinaunix.net/uid-77311-id-2045055.html一、Oracle跟踪文件Oracle跟踪文件分为三种类型,一种是后台报警日志文件,记录数据库在启动、关闭和运行期间后台进程的活动情况,如表空间创建、回滚段创建、某些alter命令、日志切换、错误消息等。在数据库出现故障时,应首先查看该文件,但文件中的信息与任何错误状态没有必然的联系。后台报警日志文件保存BACKGROUND_DUMP_DEST参数指定的目录中,文件格式为SIDALRT.LOG。另一种类型是DBWR、LGWR、SMON等后台进程创建的后台跟踪文件。后台跟踪文件根据后台进程运行
阅读全文
摘要:转自http://blog.chinaunix.net/uid-77311-id-2045049.html环境:OS:Red Hat Linux As 5DB:10.2.0.4今天有个刚接触oracle的朋友问我,两个字段的组合索引,其中一个字段存储的是空值(null),那这个空值会不会存储到索引中,我回答是会的,下面通过一个例子说明.1.建表和索引SQL> create table tb_index_test(c1 number,c2 number);Table created.SQL>SQL> create index idx_tb_index_test on tb_in
阅读全文
摘要:转自http://blog.csdn.net/leshami/article/details/7442328Oracle SQL语句的运行环境分为多个不同的层次,主要包括实例级别,会话级别,语句级别,其优先级依次递增。即语句级别的执行环境具有最高的优先权,会话级别次之,实例级别最低。反过来,实例级别的环境设置影响全局,而会话级别的则影响当前会话,语句级别的设置当然也就只影响当前语句。由此可知,运行环境中每一个环节的参数都对最终的数据库性能或所执行的SQL语句有直接的影响。因此在对数据库优化或调试SQL时,获得当前SQL语句运行环境显得尤为重要。为此,Oracle提供了三个重要的视图来获取不同级
阅读全文
摘要:_b_tree_bitmap_plans修改语句alter system set "_b_tree_bitmap_plans"=false scope=both此语句用处_b_tree_bitmap_plans参数是指是否将索引转换为bitmap索引然后执行更具熊哥讲解,如有两个字段A,B都有btree索引,oracle有可能将这两个索引转换成bitmap索引然后做and操作得出结果集。如果改为false就会选用其中的一个索引,走btree的索引删除一个索引后就正常了
阅读全文
摘要:转自 http://blog.itpub.net/1384/viewspace-342874/记得在tom的oracle 9i&10g编程艺术中这样一句话:在一个非唯一索引中,oracle会把rowid作为一个额外列加到键上,使索引键为唯一; 先按索引键排序,再按rowid升序排序;在一个唯一索引中,不会再加rowid到索引键上。今天有时间验证一下,呵呵。验证:非唯一索引,oracle会把rowid作为一个额外列加到键上,使索引键为唯一;先按索引键排序,再按rowid升序排序SQL> create table test_nounique(a number);Table creat
阅读全文
摘要:转自 http://www.360doc.com/content/09/1103/13/397210_8325689.shtml1.B树索引的相关概念索引与表一样,也属于段(segment)的一种。里面存放了用户的数据,跟表一样需要占用磁盘空间。只不 过,在索引里的数据存放形式与表里的数据存放形式非常的不一样。在理解索引时,可以想象一本书,其中书的内容就相当于表里的数据,而书前面的目录就相当于 该表的索引。同时,通常情况下,索引所占用的磁盘空间要比表要小的多,其主要作用是为了加快对数据的搜索速度,也可以用来保证数据的唯一性。但是,索引作为一种可选的数据结构,你可以选择为某个表里的创建索引,也可
阅读全文
摘要:假如聚簇因子过大,那么重建索引可能会有好处,聚簇因子应该接近块的数量,而非行的数量。 B-tree索引: ·索引会随着时间的增加而变的不平衡; ·删除的索引空间不会被重用; ·随着索引层数的增加,索引将会变得无效并需要重建; ·聚簇因子差,索引需要重建; ·为了提高性能,索引需要经常重建; 索引基础 ·一个更新由一个删除和一个插入组成; ·页块由索引条目(row header(2/3B)|length(1B)|indexed data value(nB)|length(1B)|RowID(6B))和相应的rowid组成; &
阅读全文
摘要:Disable the auto stats job in 11g.SQL> select client_name,status from Dba_Autotask_Client;CLIENT_NAME STATUS------------------------------------------...
阅读全文
摘要:转自 http://blog.csdn.net/ballontt/article/details/17548991Oracle中为了提高sql的执行效率,需要减少硬解析,实现shared cursor共享,最常见的方法是使用绑定变量,但很多时候由于各种原因未能在开发初期使用绑定变量,对于减少硬解析的目的,退而求其次地方法是设置cursor_sharing.1.准备环境实验环境BALLON@PROD> select * from v$version;BANNER----------------------------------------------------------------O
阅读全文
摘要:今天看到个帖子,关于索引中是否包含ROWID,做个DUMP跟踪下看,以下为详细的跟踪记录:SQL> create table test as select rownum a ,'c' c from dual connect by level create index u_test on test(a);Index createdSQL> select extent_id,file_id,block_id from dba_extents where segment_name='U_TEST';EXTENT_ID FILE_ID BLOCK_ID---
阅读全文
摘要:转自http://blog.csdn.net/robinson1988/article/details/5396595今天在研究Bitmap Index internal的东东,不过刚开始就被卡住了,dump出来了bitmap index 根据DSI知道有个叫start rowid,end rowid的东东,却不能将rowid还原回file_id,block_id。现在终于搞懂了呵呵,写出来分享下。哎,前面的路还很长,很长..................SQL> create table test(name varchar2(100),age number);表已创建。SQL>
阅读全文
摘要:转自http://blog.csdn.net/stevendbaguo/article/details/8215225本地有个pub_department的表,索引为PK_PUB_DEPARTMENT。1.找到object_idselectobject_idfromdba_objects swhere s.object_name='PK_PUB_DEPARTMENT';OBJECT_ID----------644082.进行转储altersessionsetevents'immediate trace name treedump level 64408';---
阅读全文
摘要:转自http://blog.csdn.net/leshami/article/details/6931886ROWID 是一个类似于rownum的伪列,用于定位数据库中一条记录的一个相对唯一地址值。通常情况下,该值在该行数据插入到数据库表时即被确定且唯一。而对于聚簇表,由于聚簇特性,不同表上的记录由...
阅读全文
摘要:转自http://www.eygle.com/archives/2005/02/eabtreeeeoooeie.htmlJonathan Lewis在他的文章中,奇妙的利用B*Tree索引分裂的原则,通过24条记录就成功的构造出了24层的索引结构,从而验证了B*Tree索引的最大允许高度。通常我们按照升序创建索引条目,索引会一直向右扩展;可是如果反过来,索引将会向左扩展。这样,除了最左面一个Branch会有两个Leaf节点以外,所有Branch就只有一个Leaf节点。我采用Oracle9.2.0.4,测试表空间Block_Size大小为2K.背景文章:1.B*Tree索引能有多高?--推荐Jo
阅读全文
摘要:转自http://blog.itpub.net/21818314/viewspace-693214这是一个实验总结帖,包括联合索引的实验 和总结。我们是以邮件的形式发送和回复的 所以只能隐去真实姓名 请见谅。请自底到顶阅读 。=============================================================我X ,这个帖子好,前一段时间还因为判断数据的问题伤神呢,算来算去都算不明白。发件人: A(运维部\DBA\XXX)发送时间: 2011年3月10日 17:43收件人: B(开发部\XXX); C(运维部\DBA\XXX); D(运维部\DBA\XXX
阅读全文
摘要:搭建环境:SQL> create table tt as select * from dba_objects;表已创建。SQL> select count(*) from tt;COUNT(*) ----------50441SQL> insert into tt select * from tt;已创建50441行。SQL> /已创建100882行。SQL> /已创建201764行。SQL> /已创建403528行。SQL> /已创建807056行。SQL> create index tt_index on tt(object_id) tabl
阅读全文
摘要:索引与表一样,也属于段(segment)的一种。里面存放了用户的数据,跟表一样需要占用磁盘空间。只不过,在索引里的数据存放形式与表里的数据存放形式非常的不一样。在理解索引时,可以想象一本书,其中书的内容就相当于表里的数据,而书前面的目录就相当于该表的索引。同时,通常情况下,索引所占用的磁盘空间要比表要小的多,其主要作用是为了加快对数据的搜索速度。 但是,索引作为一种可选的数据结构,你可以选择为某个表里的创建索引,也可以不创建。这是因为一旦创建了索引,就意味着oracle对表进行DML(包括INSERT、UPDATE、DELETE)时,必须处理额外的工作量(也就是对索引结构的维护)以及存储方面.
阅读全文
摘要:转自 http://blog.csdn.net/leshami/article/details/6860007 在SQL语句的执行计划中,包含很多字段项和很多模块,其不同字段代表了不同的含义且在不同的情形下某些字段、模块显示或不显示,下面的描述给出了执行计划中各字段的含义以及各模块的描述。 有关执行计划中各字段模块的描述请参考: 执行计划中各字段各模块描述 有关由SQL语句来获取执行计划请参考: 使用 EXPLAIN PLAN 获取SQL语句执行计划 有关使用autotrace来获取执行计划请参考:启用 AUTOTRACE 功能 有关display_cursor函数的使用请参考: dbm...
阅读全文
摘要:转自http://blog.csdn.net/leshami/article/details/7474308和ROWNUM一样,ROWID是一个伪列,即是一个非用户定义的列,而又实际存储于数据库之中。每一个表都有一个ROWID列,一个ROWID值用于唯一确定数据库表中的的一条记录。因此通过ROWID 方式来访问数据也是 Oracle 数据库访问数据的实现方式之一。一般情况下,ROWID方式的访问一定以索引访问或用户指定ROWID作为先决条件,因为所有的索引访问方式最终都会转换为通过ROWID来访问数据记录。(注:index full scan 与index fast full scan除外)由
阅读全文
摘要:转自 http://blog.csdn.net/leshami/article/details/7452310INDEX FULL SCAN 与 INDEX FAST FULL SCAN两个长相差不多,乃是一母同胞,因此既有其共性,也有其个性。两者来说其共性是不用扫描表而是通过索引就可以直接返回所需要的所有数据。这对提高查询性能而言,无疑是一个难得的数据访问方式之一,因为索引中存储的数据通常是远小于原始表的数据。下面具体来看看两者之间的异同。一、何时INDEX FULL SCAN 或 INDEX FAST FULL SCAN 1、select 与where子句中出现的所有列必须存在索引 2、查
阅读全文
摘要:转自http://www.xifenfei.com/2865.html模拟环境创建一个表,含有位图index和b-tree indexSQL> create table t_xifenfei as2 select object_id,object_name from dba_objects;Table created.SQL> create index b_tree_t_xifenfei on t_xifenfei(object_id);Index created.SQL> CREATE BITMAP INDEX bitmap_t_xifenfei on t_xifenfei
阅读全文
摘要:转自http://www.dbanotes.net/Oracle/Index_full_scan_vs_index_fast_full_scan.htmindex full scan和index fast full scan是指同样的东西吗?答案是no。两者虽然从字面上看起来差不多, 但是实现的机制完全不同。我们一起来看看两者的区别在哪里?首先来看一下IFS,FFS能用在哪里: 在一句sql中,如果我们想搜索的列都包含在索引里面的话,那么index full scan 和 index fast full scan 都可以被采用代替full table scan。比如以下语句:SQL> C
阅读全文
摘要:转自http://www.infoq.com/cn/news/2013/11/how-to-think-angularjs utm_source=infoq&utm_medium=related_content_link&utm_campaign=relatedContent_news_clk1. 不要先设计页面,然后再使用DOM操作来改变它的展现在jQuery中,你通常会设计一个页面,然后再给它动态效果。这是因为jQuery的设计就是为了扩充DOM并在这个简单的前提下疯狂的生长的。但是在AngularJS里,必须从头开始就在头脑中思考架构。必须从你想要完成的功能开始,然后设计
阅读全文
摘要:转自http://www.infoq.com/cn/news/2013/02/angular-web-appAngularJS是由Google创建的一种JS框架,使用它可以扩展应用程序中的HTML词汇,从而在web应用程序中使用HTML声明动态内容。在该团队工作的软件工程师Brian Ford近日撰写了一篇blog,分享了如何使用AngularJS构建大型Web应用的经验。这些经验对于使用其他JS框架构建大型应用的开发者也极具借鉴意义。AngularJS的官方网站上给出了这个框架的基本使用方法,如:如何引入AugularJS,从而让你的web应用使用该框架如何添加控件,并对其进行数据绑定如何进
阅读全文
摘要:最近一个项目拿到客户那运行不了。原来我的这个项目要和另一个系统通过http的接口进行通讯。但在客户的生产环境中,那套系统将web应用的登录和Windows Domain的登录结合,做了一个sso单点登录(jcifs实现)。那么我必须要修改我的程序,好自动登录Windows Domain。 通过抓包分...
阅读全文
摘要:fromhttp://www.oracle-base.com/articles/misc/detect-and-correct-corruption.phpOracle provides a number of methods to detect and repair corruption within datafiles:DBVerifyANALYZE .. VALIDATE STRUCTUREDB_BLOCK_CHECKINGRMAN (BACKUP VALIDATE, RESTORE VALIDATE, VALIDATE)Block Media Recovery (BMR)DBMS_RE
阅读全文