warehouse 客栈
===========================================================
当存在read only或者offline表空间时,重建控制文件时要注意!
===========================================================

当存在read only或者offline表空间时,重建控制文件分两种情况:

1、重建controlfile的script中包含read only或者offline所对应的datafile;这种情况比较简单,datafile不需要rename,如果是offline的表空间,那么重建controlfile之后只需要online tbs即可;如果是read only tbs那么重建controlfile之后需要对其对应的daafile进行恢复。

2、重建controlfile的script中不包含read only或者offline所对应的datafile;重建controlfile之后需要rename datafile到正确的位置,之后如果是offline的表空间,那么重建controlfile之后只需要online tbs即可;如果是read only tbs那么重建controlfile之后需要对其对应的daafile进行恢复。

 查看全文
warehouse 发表于:2008.07.03 22:20 ::分类: ( 备份恢复 ) ::阅读:(16次) :: 评论 (0)
===========================================================
一个有意思的权限问题!
===========================================================

题意是这样的:

有3个用户test,test1,test2

test下有一表t

test1下有一个view:create view v1as select * from test.t

现在test1要把v1的select权限授予test2,需要具备什么条件?

 查看全文
warehouse 发表于:2008.07.03 16:47 ::分类: ( sql/plsql ) ::阅读:(12次) :: 评论 (0)
===========================================================
connect-time failover的配置!
===========================================================
我的理解connect-time failover通常用在rac中,不过单实例环境下依然可以enable connect-time failover特性,实际意义有多大暂且不说! 查看全文
warehouse 发表于:2008.07.01 14:02 ::分类: ( network ) ::阅读:(7次) :: 评论 (0)
===========================================================
dbms_scheduler中参数repeat_interval的一些例子!
===========================================================

来至于管理向导上的一些例子!

 查看全文
warehouse 发表于:2008.06.30 13:28 ::分类: ( sql/plsql ) ::阅读:(14次) :: 评论 (0)
===========================================================
oracle标准版和企业版的区别!
===========================================================

经常有人我,正好找到一个比较全面而又简洁的doc介绍,随手记录一下!

 查看全文
warehouse 发表于:2008.06.30 10:09 ::分类: ( 内部结构 ) ::阅读:(14次) :: 评论 (0)
===========================================================
OMF和flash_recovery_area的关系!
===========================================================

在OMF出现之前(9i R1),oracle db的文件,主要指dbf,redo,ctl是通过os管理的,为了简化对数据库文件的管理,oracle引入了OMF,通过omf创建的dbf和redo,其default的大小都是100m,autoextend umlimited。9i R1的dbf文件格式default:ora_%t_%u.dbf,

redo格式:ora_%g_%u.log;9iR2的格式发生了一些变化,把ora变成了o1_mf_%t(%g)_%u.dbf(log),其中%t表示dbf所属的tbs,%g表示redo所属的group#,%u表示唯一。

 查看全文
warehouse 发表于:2008.06.29 22:46 ::分类: ( 内部结构 ) ::阅读:(15次) :: 评论 (0)
===========================================================
有关role的一点总结!
===========================================================

没有role完全可以控制权限的使用,只是不够灵活和方便而已,那么角色的作用到底是什么呢?简单的归结为2条:
1)实现批量授权
2)动态控制权限

 查看全文
warehouse 发表于:2008.06.27 14:36 ::分类: ( sql/plsql ) ::阅读:(11次) :: 评论 (0)
===========================================================
系统权限UNLIMITED TABLESPACE为什么如此特殊?
===========================================================

1、系统权限UNLIMITED TABLESPACE 不能被授予role,可以被授予用户!

2、UNLIMITED TABLESPACE 没有被包括在resource role中,但是UNLIMITED TABLESPACE 随着resource的授出而被授予用户的。

3、UNLIMITED TABLESPACE 不能伴随着resource被授予role而授予用户。

 查看全文
warehouse 发表于:2008.06.27 13:12 ::分类: ( 内部结构 ) ::阅读:(16次) :: 评论 (0)
===========================================================
使用hostname方式连接数据库!
===========================================================

hostname方式是通过client端hostname连接数据库,无需配置tns!

 查看全文
warehouse 发表于:2008.06.26 10:17 ::分类: ( network ) ::阅读:(26次) :: 评论 (0)
===========================================================
SYS_CONTEXT小记!
===========================================================
SYS_CONTEXT函数非常有用,和系统触发器结合起来可以很好的实现审计功能! 查看全文
warehouse 发表于:2008.06.26 09:33 ::分类: ( sql/plsql ) ::阅读:(27次) :: 评论 (0)
===========================================================
对read only表空间进行热备份和使用备份的controlfile进行恢复时的一点总结!
===========================================================

1. 对read only tbs进行热备份时不需要执行begin backup;

2.从9i开始通过备份的controlfile对只读表空间进行恢复时不再需要把read only tbs对应的数据文件设置为offline

 查看全文
warehouse 发表于:2008.06.24 13:13 ::分类: ( 备份恢复 ) ::阅读:(30次) :: 评论 (0)
===========================================================
那些操作会发生局部检查点(Partial checkpoint)!
===========================================================

Partial checkpoint
– Dirty buffers belonging to the tablespace
– ALTER TABLESPACE BEGIN BACKUP
– ALTER TABLESPACE tablespace OFFLINE NORMAL

上面2种操作会发生局部检查点!使相应的dirty buffer被写入和tablespace对应的datafile中

 查看全文
warehouse 发表于:2008.06.23 21:35 ::分类: ( 内部结构 ) ::阅读:(40次) :: 评论 (0)
===========================================================
How to Dump Redo Log File Information!
===========================================================

http://yumianfeilong.com/2007/04/02/how-to-dump-redo-log-file-information/

一篇不错的文章

 查看全文
warehouse 发表于:2008.06.22 18:14 ::分类: ( 内部结构 ) ::阅读:(26次) :: 评论 (0)
===========================================================
what is Goals for Tuning?
===========================================================

The objective of tuning a system is either to reduce the response time for end users of the system, or to reduce the resources used to process the same work.

 查看全文
warehouse 发表于:2008.06.20 20:57 ::分类: ( 性能优化 ) ::阅读:(18次) :: 评论 (0)
===========================================================
query rewrite和基于函数的索引有关系?
===========================================================

The NOREWRITE hint disables the use of function-based indexes.

看到这句话之后不太理解为什么提示NOREWRITE 的使用会丧失基于函数index的使用能力!

 查看全文
warehouse 发表于:2008.06.18 19:03 ::分类: ( 性能优化 ) ::阅读:(18次) :: 评论 (0)
===========================================================
大连oracle培训!
===========================================================

本人在大连,面向全国各地长期提供专业的oracle培训!有oracle培训需求的客户可以联系我!

培训的形式大致分两种:

1、类似官方培训,以官方的培训讲义为基础结合讲师多年来的实践经验和培训经验为有oracle培训需求的企业或者个人提供最优质的服务;

2、企业定制培训,完全根据客户自身的需求为企业或者个人量身定制培训。

培训的内容:

1、和开发相关的内容,主要介绍sql、plsql的使用;

2、oracle数据库的基本概念,基本管理,体系架构;

3、详细介绍oracle数据库的备份恢复原理、手段以及备份恢复策略的制定等;

4、详细介绍数据库的性能优化,定位产生性能问题的瓶颈所在并且调整它,主要介绍实例优化和sql语句优化。

5、详细介绍dataguard的种类、安装、配置、管理、使用、优化。

6、详细介绍rac的安装、配置、管理、使用、优化。

7、详细介绍大数据量的存储,管理,使用和优化。

8、详细介绍高可用性,高并发行数据库的设计、管理、使用和优化。

 查看全文
warehouse 发表于:2008.06.17 22:17 ::分类: ( 生活点点滴滴 ) ::阅读:(32次) :: 评论 (0)
===========================================================
按照oracle性能改进方法论的步骤来优化系统!
===========================================================

doc上的原话,记录一下,感觉写的很精彩!

 查看全文
warehouse 发表于:2008.05.22 10:19 ::分类: ( 性能优化 ) ::阅读:(85次) :: 评论 (0)
===========================================================
oracle性能改进方法论告诉我们!
===========================================================

定位系统性能瓶颈的时候要多利用数据以及统计信息等资源而不要过多的依赖自己以前积累的经验想当然。因为今天的系统已经变的非常复杂,性能分析的一些浮浅的规则不容易产生。oracle性能改进方法论定义的是一种工作的方法而不是一组权威性的规则。在定位性能瓶颈的时候,最好的规则就是没有规则(With bottleneck detection, the only rule is that there are no rules!The best performance engineers use the data provided and think laterally to determine performance problems.)

 查看全文
warehouse 发表于:2008.05.22 09:06 ::分类: ( 性能优化 ) ::阅读:(53次) :: 评论 (0)
===========================================================
oracle占用os的cpu资源的多少算是健康的!
===========================================================
从下面的doc理解,如果单一的应用程序跑在oracle数据库服务器上,那么(

On an Oracle data server system, where there is generally only one application running, the server runs database activity in user space. Activities required to service database requests (such as scheduling, synchronization, I/O, memory management, and process/thread creation and tear down) run in kernel mode. In a system where all CPU is fully utilized, a healthy Oracle system runs between 65% and 95% in user space.

)oracle对系统cpu的利用如果在user cpu(应用程序使用cpu的百分比)的65% ~95%之间,则oralcle system被认为是健康的。

e文不好,不知理解的是否准确!

 查看全文
warehouse 发表于:2008.05.21 22:30 ::分类: ( 性能优化 ) ::阅读:(81次) :: 评论 (0)
===========================================================
oracle time_zone!
===========================================================

http://space.itpub.net/756652/viewspace-244138

转,不错的文章!

 查看全文

warehouse 发表于:2008.05.21 07:43 ::分类: ( sql/plsql ) ::阅读:(34次) :: 评论 (0)
===========================================================
Thomas Kyte 关于"unix system kernel parameters"的回答
===========================================================


http://www.itpub.net/thread-148366-1-2.html

记录一下!

 查看全文
warehouse 发表于:2008.05.19 13:06 ::分类: ( 内部结构 ) ::阅读:(39次) :: 评论 (0)
===========================================================
What is Scalability?
===========================================================

什么是Scalability,看看他的形容词的意思:scalable adj.可攀登的
可升级的,这里Scalability我通常理解为系统的可攀升能力。doc的原意是:

Scalability is a system's ability to process more workload, with a proportional increase in system resource usage. In other words, in a scalable system, if you double the workload, then the system would use twice as many system resources. This sounds obvious, but due to conflicts within the system, the resource usage might exceed twice the original workload.

 查看全文
warehouse 发表于:2008.05.14 22:29 ::分类: ( 性能优化 ) ::阅读:(38次) :: 评论 (0)
===========================================================
为什么会产生性能问题!
===========================================================

不知道该起个什么样的标题来记录这句话,看到这句话时感觉写的非常好,想记录一下:

Performance problems are usually the result of contention for, or exhaustion of, some system resource

性能问题通常是一些系统资源被争夺或者是被耗尽的结果!

 查看全文
warehouse 发表于:2008.05.14 22:23 ::分类: ( 性能优化 ) ::阅读:(36次) :: 评论 (0)
===========================================================
cpu等待io的原因!
===========================================================

What Is Disk Contention?

Disk contention occurs when multiple processes try to access the same disk simultaneously. Most disks have limits on both the number of accesses (I/O operations each second) and the amount of data they can transfer each second (I/O data rate, or throughput). When these limits are reached, processes must wait to access the disk.

 查看全文
warehouse 发表于:2008.05.07 22:49 ::分类: ( 性能优化 ) ::阅读:(77次) :: 评论 (0)
===========================================================
fast parse,soft parse,hard parse的区别!
===========================================================

http://www.itpub.net/thread-877110-1-5.html

收藏记录一下!

 查看全文
warehouse 发表于:2008.05.07 22:13 ::分类: ( sql/plsql ) ::阅读:(60次) :: 评论 (0)
===========================================================
理解好这些"缺陷"有助于我们根据statistics发现系统的性能瓶颈!
===========================================================

Some pitfalls are discussed in the following sections:

  • Hit ratios
  • Wait events with timed statistics
  • Comparing Oracle statistics with other factors
  • Wait events without timed statistics
  • Idle wait events
  • Computed statistics
 查看全文
warehouse 发表于:2008.05.06 13:00 ::分类: ( 性能优化 ) ::阅读:(42次) :: 评论 (0)
===========================================================
如何确定SORT_AREA_SIZE的大小!
===========================================================
尽管oracle已经不建议使用SORT_AREA_SIZE参数了,oracle建议通过设置PGA_AGGREGATE_TARGET来激活自动工作区管理。不过在doc上看到了,随手记录一下! 查看全文
warehouse 发表于:2008.05.06 10:51 ::分类: ( 性能优化 ) ::阅读:(65次) :: 评论 (0)
===========================================================
创建同样大小的永久表空间和临时表空间速度比较!
===========================================================

创建同样大小的表空间,永久表空间要比临时标空间慢很多,原因就像doc所言创建数据文件时block需要被初始化为"empty",其实就是检查block的过程,以保证之后以后每个block都能被写入;而临时文件不需要被初始化!

 查看全文
warehouse 发表于:2008.05.06 09:44 ::分类: ( 内部结构 ) ::阅读:(41次) :: 评论 (0)
===========================================================
rbo下针对表与表之间的连接执行计划的确定原则!
===========================================================

需要注意的一句话是:

Usually, the optimizer does not consider the order in which tables appear in the FROM clause when choosing an execution plan.

 查看全文
warehouse 发表于:2008.05.04 10:10 ::分类: ( 性能优化 ) ::阅读:(40次) :: 评论 (0)
===========================================================
Full Table Scan!
===========================================================
下面列出来的这些条件都会执行Full Table Scan,因此我们在使用时要特别注意! 查看全文
warehouse 发表于:2008.05.03 22:06 ::分类: ( 性能优化 ) ::阅读:(47次) :: 评论 (0)
===========================================================
and_equal最多可以指定5个index!
===========================================================

If the WHERE clauses uses columns of many single-column indexes, then Oracle executes the statement by performing a range scan on each index to retrieve the rowids of the rows that satisfy each condition. Oracle then merges the sets of rowids to obtain a set of rowids of rows that satisfy all conditions. Oracle then accesses the table using these rowids.

Oracle can merge up to five indexes. If the WHERE clause uses columns of more than five single-column indexes, then Oracle merges five of them, accesses the table by rowid, and then tests the resulting rows to determine whether they satisfy the remaining conditions before returning them.

 查看全文
warehouse 发表于:2008.05.02 23:58 ::分类: ( 性能优化 ) ::阅读:(37次) :: 评论 (0)
===========================================================
如何理解AND-EQUAL!
===========================================================

当我第一次看到hint相关内容中讲到AND_EQUAL时(

The AND_EQUAL hint explicitly chooses an execution plan that uses an access path that merges the scans on several single-column indexes.

)感觉没有读懂,不知道这里提到的merge到底指的什么意思,但是当看到RBO Path 9: Single-Column Indexes章节中的解释时对AND_EQUAL已经非常清楚了,原来是对单列index scan找到满足条件的rowid的mergeIf the WHERE clauses uses columns of many single-column indexes, then Oracle executes the statement by performing a range scan on each index to retrieve the rowids of the rows that satisfy each condition. Oracle then merges the sets of rowids to obtain a set of rowids of rows that satisfy all conditions. Oracle then accesses the table using these rowids.

 查看全文
warehouse 发表于:2008.05.02 23:29 ::分类: ( 性能优化 ) ::阅读:(39次) :: 评论 (0)
===========================================================
rbo下通过rowid单行访问表的2种情况!
===========================================================

RBO Path 1: Single Row by Rowid

This access path is available only if the statement's WHERE clause identifies the selected rows by rowid or with the CURRENT OF CURSOR embedded SQL syntax supported by the Oracle precompilers. To execute the statement, Oracle accesses the table by rowid.

 查看全文
warehouse 发表于:2008.05.01 22:53 ::分类: ( 性能优化 ) ::阅读:(36次) :: 评论 (0)
===========================================================
Access Paths for the RBO!
===========================================================

doc上的原话,随手记录下!

Note that the full table scan is the lowest ranked access path on the list. This means that the RBO always chooses an access path that uses an index if one is available, even if a full table scan might execute faster.

从上面这段话我们知道full table scan 是最低等级的访问路径,那意味着下面列出来的15种访问路径的数字越小等级越高,也就是说使用访问路径的等级越高rbo认为效率越高,当然实际情况可能并非如此。

 查看全文
warehouse 发表于:2008.05.01 22:36 ::分类: ( 性能优化 ) ::阅读:(35次) :: 评论 (0)
===========================================================
使用提示FIRST_ROWS(n)时需要注意的!
===========================================================

都是doc上的原话,记录一下!

FIRST_ROWS(n)提示告诉优化器要执行的sql语句的优化目标是获得最快的响应时间,但是下面这些情况该提示不起作用:

The optimizer ignores this hint in DELETE and UPDATE statement blocks and in SELECT statement blocks that contain any of the following syntax:

  • Set operators (UNION, INTERSECT, MINUS, UNION ALL)
  • GROUP BY clause
  • FOR UPDATE clause
  • Aggregate functions
  • DISTINCT operator
  • ORDER BY clauses, when there is no index on the ordering columns

These statements cannot be optimized for best response time, because Oracle must retrieve all rows accessed by the statement before returning the first row. If you specify this hint in any of these statements, then the optimizer uses the cost-based approach and optimizes for best throughput.

这是9i性能优化向导上的内容,在11g下测试count操作(Aggregate functions)发现提示也起作用!

 查看全文
warehouse 发表于:2008.04.28 15:02 ::分类: ( 性能优化 ) ::阅读:(61次) :: 评论 (0)
===========================================================
hint不能传播到view内部!
===========================================================

doc上介绍hint不能被传播到view内部,除非在创建view时把hint写在view的内部或者使用global hint!

 查看全文
warehouse 发表于:2008.04.28 13:11 ::分类: ( 性能优化 ) ::阅读:(31次) :: 评论 (0)
===========================================================
Optimizer Hints!
===========================================================

doc上的这段话对Optimizer Hints介绍的非常清楚,记录一下!

当然更重要的是能够熟练的使用各种hint来改变sql的执行计划从而优化sql

这里对下面一段做一点解释:

You can use hints to specify the following:

  • The optimization approach for a SQL statement
  • --The optimization approach 指的是cbo和rbo
  • The goal of the cost-based optimizer for a SQL statement
  • --The goal of the cost-based optimizer 指的是语句追求的是最大吞吐量( all_rows)还是最快响应时间(first_rows(n))
  • The access path for a table accessed by the statement
  • --The access path for a table accessed是指full table scan or index scan
  • The join order for a join statement
  • --是指表的连接顺序
  • A join operation in a join statement
  • --A join operation 指的应该是表与表之间的连接方法:nl,merge or hash

 查看全文

warehouse 发表于:2008.04.28 12:19 ::分类: ( 性能优化 ) ::阅读:(68次) :: 评论 (0)
===========================================================
Cardinality指什么?
===========================================================

在性能优化向导中经常会出现Cardinality,Cardinality到底是指什么,看看doc的准确解释:

Cardinality is the number of unique values in a column in relation to the number of rows in the table

 查看全文
warehouse 发表于:2008.04.25 22:56 ::分类: ( 性能优化 ) ::阅读:(220次) :: 评论 (0)
===========================================================
Enabled Novalidated的作用!
===========================================================

By placing a constraint in the enabled novalidated state, you enable the constraint without locking the table.如doc所言,把constriant由状态disable变成enable时在表上会产生lock,期间所有的DML, queries, or DDL都被阻塞(If you change a constraint from disabled to enabled, then the table must be locked. No new DML, queries, or DDL can occur, because there is no mechanism to ensure that operations on the table conform to the constraint during the enable operation.)。阻塞的原因是:because there is no mechanism to ensure that operations on the table conform to the constraint during the enable operation。而enabled novalidated对新数据生效对表里现有数据不产生作用,正是利用这个特性,oracle巧妙的实现了约束从enabled novalidated到enable不产生lock,从而也就不会引起在enabled novalidated变成enable期间阻塞表上的读写操作。oracle利用在表上的一致性查询来校验老数据是否满足约束,如果满足就把其状态变成enable,如果不一直就报错,在修改期间如果有新数据插入则enabled novalidated会发挥作用来校验。(The enabled novalidated state prevents operations violating the constraint from being performed on the table).

其实Enabled Novalidated的作用:

表面看是仅仅对新数据产生作用,对老数据不产生作用;实质上是解决了把约束的状态从disable变成enable而引起的lock从而阻塞对该表的读写操作!

 查看全文
warehouse 发表于:2008.04.24 12:16 ::分类: ( 内部结构 ) ::阅读:(58次) :: 评论 (0)
===========================================================
constraint和index的一点关系!
===========================================================

primary key和unique约束是要依赖index的,下面通过试验来看看他们之间的依赖关系!

 查看全文
warehouse 发表于:2008.04.23 23:42 ::分类: ( 性能优化 ) ::阅读:(106次) :: 评论 (0)
===========================================================
一篇介绍内部事件不错的文章!
===========================================================
在线/呼叫 tanfufa 上传了一些不错的东西,记录一下! 查看全文
warehouse 发表于:2008.04.23 18:41 ::分类: ( 内部结构 ) ::阅读:(40次) :: 评论 (0)
===========================================================
index有时候可能会比表大!
===========================================================

之前没有想过这个问题,第一次看到这样的说法是在piner的面试题中。当时觉得有点意思,这几天细读doc,上面也提到了这样的说法:

Consider an index on a table on which a lot of DML has been performed. Because of the DML, the size of the index can increase to the point where each block is only 50% full, or even less. If the index refers to most of the columns in the table, then the index could actually be larger than the table.

 查看全文

warehouse 发表于:2008.04.23 16:50 ::分类: ( 性能优化 ) ::阅读:(41次) :: 评论 (0)
===========================================================
什么是index的leading column(索引的前导列)?
===========================================================

看到经常有人问此问题!doc的原话,看到了随手记录下!

 查看全文
warehouse 发表于:2008.04.22 18:30 ::分类: ( 性能优化 ) ::阅读:(47次) :: 评论 (1)
===========================================================
使用自定义函数创Function-Based Indexes时需要使用DETERMINISTIC Functions!
===========================================================

那么究竟什么是DETERMINISTIC Functions,看看doc的解释!

DETERMINISTIC Functions

Any user-written function used in a function-based index must have been declared with the DETERMINISTIC keyword to indicate that the function will always return the same output return value for any given set of input argument values, now and in the future.

 查看全文
warehouse 发表于:2008.04.20 22:46 ::分类: ( 性能优化 ) ::阅读:(66次) :: 评论 (0)
===========================================================
从10g开始CBO下group by之后不能保证数据是按照分组字段排序的!
===========================================================
从10g开始CBO下group by之后不能保证数据是按照分组字段排序的! 查看全文
warehouse 发表于:2008.04.20 21:56 ::分类: ( 性能优化 ) ::阅读:(66次) :: 评论 (0)
===========================================================
使用不含通配符的like运算符遇到char类型的字段时要注意!
===========================================================
在CBO下,oracle会把不含通配符的like表达式转为为等式,前提是like前面的字段类型必须是可变宽度字符类型的。当遇到char类型的字段时它不会这样做! 查看全文
warehouse 发表于:2008.04.19 19:17 ::分类: ( 性能优化 ) ::阅读:(68次) :: 评论 (0)
===========================================================
修改statistics!
===========================================================

可以通过dbms_stats提供的set_table_stats来修改表的统计信息从而使cbo产生我们希望的执行计划!

 查看全文
warehouse 发表于:2008.04.17 12:13 ::分类: ( 性能优化 ) ::阅读:(46次) :: 评论 (0)
===========================================================
监视stale statistics(失真的统计信息)的对象!
===========================================================
通过dbms_stats提供的几个procedure可以监视stale statistics的对象以便之后对这些对象搜集statistics。 查看全文
warehouse 发表于:2008.04.17 11:35 ::分类: ( 性能优化 ) ::阅读:(85次) :: 评论 (3)
===========================================================
使用dbms_stats列出没有统计信息的对象!
===========================================================

利用dbms_stats的procedure gather_schema_stats 和gather_database_stats通过使用参数options 和objlist可以列出那些没有统计信息或者统计信息stale的对象。

 查看全文
warehouse 发表于:2008.04.17 10:55 ::分类: ( 性能优化 ) ::阅读:(56次) :: 评论 (0)
===========================================================
为基于函数index所产生的虚拟列搜集统计信息!
===========================================================

在创建函数index之后系统会自动产生虚拟列,而这一列也是隐藏的,在创建index时系统自动使用了compute statistics选项为创建的index搜集了statistics,然而并不会为生成的虚拟列搜集statistics,这时如果需要为虚拟列搜集statistics就需要重新分析表或者单独为虚拟列搜集statistics。

 查看全文
warehouse 发表于:2008.04.16 22:29 ::分类: ( 性能优化 ) ::阅读:(46次) :: 评论 (0)
===========================================================
statistics的export与import!
===========================================================
dbms_stats package中提供了过程export_X_stats和import_X_stats(其中X代表column,table,index,schema,database)可以实现统计信息的export和import。通过这种方法我们可以把生产环境的统计信息导入到测试库中模拟生产库。 查看全文
warehouse 发表于:2008.04.16 15:22 ::分类: ( 性能优化 ) ::阅读:(69次) :: 评论 (0)
===========================================================
DBMS_STATS和ANALYZE在搜集statistics时的一些差别!
===========================================================

doc上的原话,随手记录一下。

 查看全文

warehouse 发表于:2008.04.16 10:29 ::分类: ( 性能优化 ) ::阅读:(36次) :: 评论 (0)
===========================================================
请慎重分析对象!
===========================================================
对象被分析之后,所有和该对象相关的被parse过的sql都会失效,下次需要执行相同的sql时需要再次parse,因此当系统执行过搜集statistics的操作后面临的可能是在短时间内产生很多hard parse。 其实非常容易理解,因为有了新的statistics,oracle在下次执行相同的sql时会使用新的statistics产生新的执行计划。 查看全文
warehouse 发表于:2008.04.16 10:06 ::分类: ( 性能优化 ) ::阅读:(43次) :: 评论 (0)
===========================================================
statistics!
===========================================================

Use the DBMS_STATS package to generate statistics.

Statistics generated include the following:

 查看全文
warehouse 发表于:2008.04.15 23:36 ::分类: ( 性能优化 ) ::阅读:(41次) :: 评论 (0)
===========================================================
user_tab_columns和user_tab_cols的区别!
===========================================================

user_tab_cols differs from "USER_TAB_COLUMNS" in that hidden columns are not filtered out。10.2版本中user_tab_cols比user_tab_columns多出下面几列:

HIDDEN_COLUMN VARCHAR2(3)
VIRTUAL_COLUMN VARCHAR2(3)
SEGMENT_COLUMN_ID NUMBER
INTERNAL_COLUMN_ID NOT NULL NUMBER
QUALIFIED_COL_NAME VARCHAR2(4000)

 查看全文

warehouse 发表于:2008.04.15 23:10 ::分类: ( 内部结构 ) ::阅读:(134次) :: 评论 (0)
===========================================================
Index Joins的一点测试!
===========================================================

index和index之间是如何进行hash join的,因为index中包括了rowid,所以通过rowid可以连接。

Index Joins

An index join is a hash join of several indexes that together contain all the table columns that are referenced in the query. If an index join is used, then no table access is needed, because all the relevant column values can be retrieved from the indexes. An index join cannot be used to eliminate a sort operation. The index join is available only with the CBO.

Index Join Hints

You can specify an index join with the initialization parameter OPTIMIZER_FEATURES_ENABLE or the INDEX_JOIN hint. For more information on the INDEX_JOIN hint, see "INDEX_JOIN".

 查看全文

warehouse 发表于:2008.04.14 11:55 ::分类: ( 性能优化 ) ::阅读:(29次) :: 评论 (0)
===========================================================
Fast Full Index Scans的特点!
===========================================================

其实Fast Full Index Scans是针对full table scan而言的,Fast Full Index Scans的一些特点也和full table scan相似(如:多块读):

Fast Full Index Scans的一些特点:

1.Fast full scan is available only with the CBO

2.at least one column in the index key has the NOT NULL constraint

3. A fast full scan accesses the data in the index itself, without accessing the table

4.It cannot be used to eliminate a sort operation, because the data is not ordered by the index key.(粗略的试验了一下发现也是排好序了,按照index_key)

5.It reads the entire index using multiblock reads, unlike a full index scan

6.Fast full index scans cannot be performed against bitmap indexes(这里有点问题,在10g,11g下测似没有问题啊)

7.A fast full scan is faster than a normal full index scan in that it can use multiblock I/O and can be parallelized just like a table scan

8.There must be a parallel clause on the index if you want to perform a fast full index scan in parallel. The parallel degree of the index is set independently. The index does not inherit the degree of parallelism of the table.

9.You must have analyzed the index; otherwise, the optimizer might decide not to use it

 查看全文
warehouse 发表于:2008.04.13 16:00 ::分类: ( 内部结构 ) ::阅读:(44次) :: 评论 (0)
===========================================================
index和rowid的一点关系!
===========================================================

唯一index和非唯一index的index entry中尽管都存在rowid,但是其实有一点细微的差别,在唯一index中index_column就是index_column, 数据通过index_column排序;而在非唯一index中index_column其实是index_key+rowid,如果index_key相同,那么会使用rowid排序。

 查看全文
warehouse 发表于:2008.04.13 13:52 ::分类: ( 内部结构 ) ::阅读:(59次) :: 评论 (0)
===========================================================
有关lock的一点测试总结!
===========================================================

理解oracle lock的概念,有助于理解多用户的并发执行。

 查看全文
warehouse 发表于:2008.04.09 11:28 ::分类: ( 内部结构 ) ::阅读:(102次) :: 评论 (0)
===========================================================
权限传递的一点测试!
===========================================================

记得在北京讲课时曾经有学员问到过这个问题,当时没有详细测试,前几天看到pub上又有人提及这类问题,简单的测试了一下,还发现了一些问题。传递出去的对象权限可以cascade回收,而传递出去的系统权限却没有cascade回收!

 查看全文
warehouse 发表于:2008.04.07 23:33 ::分类: ( 内部结构 ) ::阅读:(379次) :: 评论 (0)
===========================================================
active session的准确定义!
===========================================================
什么是 active session ! 查看全文
warehouse 发表于:2008.04.07 17:13 ::分类: ( sql/plsql ) ::阅读:(75次) :: 评论 (0)
===========================================================
ORA-04031错误模拟!
===========================================================

不使用绑定变量,而open_cursors又开的很大,很容易导致ORA-04031错误!

 查看全文
warehouse 发表于:2008.04.04 18:39 ::分类: ( 性能优化 ) ::阅读:(75次) :: 评论 (0)
===========================================================
使用绑定变量的一点总结!
===========================================================
在oltp系统中提倡使用绑定变量,使用绑定变量可以减少hard parse,避免因解析sql而过渡消耗cpu时间以及引起latch争用等一系列问题。那么到底如何使用绑定变量?可能是困扰很多人的一个问题,下面列举了一些使用绑定变量的例子或者是场合 查看全文
warehouse 发表于:2008.04.04 00:13 ::分类: ( 内部结构 ) ::阅读:(59次) :: 评论 (0)
===========================================================
如何获得server端和client端ip address和host name!
===========================================================
如何获得server端和client端ip address和host name! 查看全文
warehouse 发表于:2008.04.03 22:28 ::分类: ( 内部结构 ) ::阅读:(122次) :: 评论 (0)
===========================================================
远程调用procedure可能会有一些缺陷!
===========================================================
看到pub上有人问如何远程调用过程,其实大部分人都会想到通过db link事实上也确实如此,不过我相信实际在使用的时候可能没有多少人这样用而是通常会使用另外的办法 查看全文
warehouse 发表于:2008.04.02 14:32 ::分类: ( sql/plsql ) ::阅读:(58次) :: 评论 (0)
===========================================================
DATA BLOCK内部结构图
===========================================================

DATA BLOCK内部结构图

一张不错的图,不过看起来有些累

 查看全文
warehouse 发表于:2008.04.01 15:22 ::分类: ( 内部结构 ) ::阅读:(67次) :: 评论 (0)
===========================================================
sqlplus中define定义的常量和variable定义的变量的区别!
===========================================================
前两天看到有人在pub上问在sqlplus中通过define和variable定义的变量的区别。其实define定义的我理解不是变量而是字符常量,通过define定义之后,在通过&或者&&引用的时候不需要输入了,仅此而已。oracle在执行的时候自动用值进行了替换;而variable定义的是绑定变量。 查看全文
warehouse 发表于:2008.04.01 14:06 ::分类: ( sqlplus ) ::阅读:(118次) :: 评论 (0)
===========================================================
口令中含@的问题!
===========================================================

当口令中包含@时不能通过sqlplus username/"password"连上数据库,但是可以通过sqlplus username(@tns)之后再输入password(切记password用双引号扩起来)正常连接数据库;也可以先进入sqlplus环境:sqlplus /nolog之后再connect username/"password"@tns连接数据库!

 查看全文
warehouse 发表于:2008.04.01 09:44 ::分类: ( network ) ::阅读:(445次) :: 评论 (1)
===========================================================
constraint=constraints?
===========================================================

偶然发现在为字段增加约束时使用constraint或者constraints都可以创建成功,查看oracle语法发现是constraint,不知道是否是bug?

 查看全文
warehouse 发表于:2008.03.26 21:15 ::分类: ( sql/plsql ) ::阅读:(77次) :: 评论 (0)
===========================================================
oracle把''当null来对待!
===========================================================
使用sql server和sybase时记得''表示空字符串,但是在oracle中却发现没有空字符串一说,oracle把''当null来对待! 查看全文
warehouse 发表于:2008.03.25 21:14 ::分类: ( 内部结构 ) ::阅读:(91次) :: 评论 (0)
===========================================================
rman中的catalog命令!
===========================================================

之前并不清楚catalog命令的意思,直到去年考ocp时有到题目提到catalog命令,题意已经记不清楚了,当然答案也是懵的。

网上无意中看到了ninoo的总结,转过来记录一下!

 查看全文
warehouse 发表于:2008.03.23 11:42 ::分类: ( 备份恢复 ) ::阅读:(211次) :: 评论 (0)
===========================================================
merge用法测试随手记!
===========================================================

matched之后的delete语法是10g之后才有的,使用起来更加灵活方便了;而且10g中还增加了where子句可以控制条件

 查看全文
warehouse 发表于:2008.03.22 14:16 ::分类: ( sql/plsql ) ::阅读:(65次) :: 评论 (0)
===========================================================
resumable特性以及系统触发器中的SUSPEND event测试!
===========================================================
之前一直没有搞清楚系统触发器中的suspend事件什么时候触发,正好看到一位puber问此问题,搜索一下doc,做了一个简单的测试。 查看全文
warehouse 发表于:2008.03.20 23:33 ::分类: ( sql/plsql ) ::阅读:(93次) :: 评论 (0)
===========================================================
Oracle如何精确计算row的大小
===========================================================

http://9host.cn/oracle/200742218395312855.html

 查看全文
warehouse 发表于:2008.03.11 10:38 ::分类: ( 内部结构 ) ::阅读:(93次) :: 评论 (0)
===========================================================
user和schema的区别
===========================================================

这两个概念确实不太好理解

说穿了其实user是控制权限的,而schema是个容器,非所有者要访问这个容器下的对象就需要在
对象前面写上schema(owner)的名字,如果不想写而又没有创建synonym,此时可以通过
alter session set current_schema=schema_name
来改变当前session的schema从而在访问对象时省去schema(owner);
最终能否访问对象还是要看是否有访问这个对象的权限而和schema无关。

 查看全文
warehouse 发表于:2008.02.28 22:17 ::分类: ( sql/plsql ) ::阅读:(132次) :: 评论 (0)