Tag Archives: 技术备忘

Oracle 的 MBRC 与 SSTIOMAX

Oracle 初始化参数 DB_FILE_MULTIBLOCK_READ_COUNT (MBRC) 默认值一般是比较低的,在进行一些比较大的数据操作的时候,恰当的调整当前 Session 的 MBRC 的值可能会在 IO 上节省一点时间。
DB_FILE_MULTIBLOCK_READ 这个参数的值并不是可以无限大, 大多数平台下的 Oracle 都是 128。一般 Oracle 的 Block Size 是 8K 。128*8K=1M 。 这个 1M 是大多数操作系统一次最大 I/O 的限制。前面的限制要从这个 1M 推回去,初始化参数 DB_FILE_MULTIBLOCK_READ_COUNT 的最大值之所以定为 128 ,也是一个比较保守的策略。
Oracle 的 Metalink Note:291239.1 有一小段说明:

Each version of Oracle on each port, is shipped with a preset maximum of how much data can be transferred in a single read (which of course is equivalent to the db_file_multiblock_read_count
since the block size is fixed). For 8i and above (on most platforms) this is 1Mb and is referred to as SSTIOMAX.
To determine it for your port and Oracle version, simply set db_file_multiblock_read_count to a nonsensical value and Oracle will size it down for you.

SSTIOMAX 中的 SST 代表什么意思不为人知:

SSTIOMAX is an internal parameter/constant used by oracle, which limits the maximum amount of data transfer in a single IO of a read or write operation. This parameter is fixed and cannot be tuned/changed

要查看当前系统上的 SSTIOMAX 限制,可以通过如下做法简单的得到(trace 10046 的方法似乎麻烦了一些):

foo@DEMO> show parameters db_file_multiblock_read_count
NAME TYPE VALUE ------------------------------------ ----------- ------- db_file_multiblock_read_count integer 16
foo@DEMO> ALTER SESSION SET db_file_multiblock_read_count =256;
Session altered.
foo@DEMO> SELECT VALUE FROM v$parameter WHERE NAME = 'db_file_multiblock_read_count';
VALUE -------------------- 128

正常运行的库,MBRC 并非越大越好(除了 IO 效率有降低的可能,也会有可能影响 CBO 的运行)。后者是我的猜测,因为在 10gR2 上,’db_file_multiblock_read_count’ 参数引入了两个相关的隐含参数(Refer):

_db_file_exec_read_count
_db_file_optimizer_read_count

距离上一次写技术备忘似乎有好久了…这几天比较累
EOF