ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 验证数据库支持db_file_multiblock_read_count参数的最大值

验证数据库支持db_file_multiblock_read_count参数的最大值

Linux操作系统 作者:minxuan2013 时间:2014-12-30 11:47:02 0 删除 编辑

        首先需要明确“db file sequential read”和“db file scattered read”两种等待事件之间的区别,前者是单块的顺序读,后者是多块的一起读,块的个数受到db_file_multiblock_read_count的限制,一般是表或索引全扫描的时候会出现大量的“db file scattered read”等待事件,同时还需要关注以下两点:
        1).这两种等待事件会相伴出现,这是由于区中块的个数,SGA中已包含部分块,链接和迁移行,索引条目的维护(INSERT时)导致的。
        2).“db file scattered read”等待事件每次读取块的个数可能小于db_file_multiblock_read_count的限制值,这是主要是由于区间包含的块个数和SGA已包含部分块的原因造成的。
       对于全表或全索引扫描来说,总是希望都出现“db file scattered read”等待事件,这样可以一定程度提高I/O读的性能,db_file_multiblock_read_count默认的值可能过小,db_file_multiblock_read_count可调整的值受较多因素的影响,通过下面的方法可以检查当前数据库环境支持的db_file_multiblock_read_count最大值。

1.创建测试表(会话A)。
C:\Users\LIUBINGLIN>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on 星期三 11月 14 12:32:03 2012

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options

SQL> create table db_file_multi (id number primary key,name char(2000));

表已创建。

SQL> begin
  2  for i in 1..10000 loop
  3  insert into db_file_multi values(i,'db_file_multi'||i);
  4  end loop;
  5  end;
  6  /

PL/SQL 过程已成功完成。

SQL> commit;

提交完成。

2.确定会话A的ORA PID和SPID。
SQL> select pid,spid from v$process where addr=(
  2  select paddr from v$session where sid=(
  3  select sid from v$mystat where rownum=1));

       PID SPID
---------- ------------------------
        30 700

3.启动10046工具跟踪会话A(会话B)。
C:\Users\LIUBINGLIN>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on 星期三 11月 14 12:37:42 2012

Copyright (c) 1982, 2011, Oracle.  All rights reserved.


连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options

SQL> oradebug setorapid 30
Oracle pid: 30, Windows thread id: 700, image: ORACLE.EXE (SHAD)
SQL> oradebug event 10046 trace name context forever,level 8
已处理的语句
SQL> oradebug tracefile_name
F:\APP\ORACLE\diag\rdbms\orcl\orcl\trace\orcl_ora_700.trc

4.执行测试过程(会话A)。
SQL> alter session set db_file_multiblock_read_count=1000;

会话已更改。

SQL> select /*+full(a)*/ count(1) from db_file_multi a;

  COUNT(1)
----------
     10000

5.查看测试结果。

数据库参数
db_file_multiblock_read_count的默认值:
SQL> show parameter db_file_multi

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_file_multiblock_read_count        integer     28

查看F:\APP\ORACLE\diag\rdbms\orcl\orcl\trace\orcl_ora_700.trc文件的内容:
......
WAIT #264101320: nam='db file scattered read' ela= 8221 file#=1 block#=90981 blocks=4 obj#=75753 tim=184163648833
WAIT #264101320: nam='db file scattered read' ela= 9623 file#=1 block#=90992 blocks=16 obj#=75753 tim=184163659036
WAIT #264101320: nam='db file scattered read' ela= 46159 file#=1 block#=91008 blocks=70 obj#=75753 tim=184163706503
WAIT #264101320: nam='db file sequential read' ela= 4815 file#=1 block#=91091 blocks=1 obj#=75753 tim=184163714982
......
       从上面的输出看出,'db file scattered read'读的块数已经达到了70,但显然这不是最大的,可以通过加入db_file_multi测试表更多的数据来查看测试效果。


--end--

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29615408/viewspace-1384764/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-12-30

  • 博文量
    112
  • 访问量
    95872