Oracle Redo并行机制解析(三)

2014-11-24 12:39:04 · 作者: · 浏览: 1
BYTES
----------
52428800
HELLODBA.COM>select trunc(((select bytes from v$log where status = 'CURRENT') - (select to_number(value) from v$parameter where name = 'log_buffer'))*
2 (select to_number(val.KSPPSTVL)
3 from sys.x$ksppi nam, sys.x$ksppsv val
4 where nam.indx = val.indx
5 AND nam.ksppinm = '_log_private_mul') / 100 / 66560)
6 as "calculated private strands"
7 from dual; www.2cto.com
calculated private strands
--------------------------
5
HELLODBA.COM>select count(1) "actual private strands" from x$kcrfstrand where last_buf_kcrfa = '00';
actual private strands
----------------------
5
当logfile切换后(和checkpoint一样,切换之前必须要将所有Private strand的内容flush到logfile中,因此我们在alert log中可能会发现日志切换信息之前会有这样的信息:"Private strand flush not complete",这是可以被忽略的),会重新根据切换后的logfile的大小计算对Private strand的限制:
SQL代码
HELLODBA.COM>alter system switch logfile;
System altered.
HELLODBA.COM>select bytes from v$log where status = 'CURRENT';
BYTES
----------
104857600
HELLODBA.COM>select trunc(((select bytes from v$log where status = 'CURRENT') - (select to_number(value) from v$parameter where name = 'log_buffer'))*
2 (select to_number(val.KSPPSTVL)
3 from sys.x$ksppi nam, sys.x$ksppsv val
4 where nam.indx = val.indx
5 AND nam.ksppinm = '_log_private_mul') / 100 / 66560)
6 as "calculated private strands"
7 from dual; www.2cto.com
calculated private strands
--------------------------
13
HELLODBA.COM>select count(1) "actual private strands" from x$kcrfstrand where last_buf_kcrfa = '00';
actual private strands
----------------------
13
参数_log_private_parallelism_mul用于推算活跃事务数量在最大事务数量中的百分比,默认为10。Private strand的数量不能大于活跃事务的数量。
SQL代码
HELLODBA.COM>show parameter transactions
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
transactions integer 222
transactions_per_rollback_segment integer 5
HELLODBA.COM>select trunc((select to_number(value) from v$parameter where name = 'transactions') *
2 (select to_number(val.KSPPSTVL)
3 from sys.x$ksppi nam, sys.x$ksppsv val
4 where nam.indx = val.indx
5 AND nam.ksppinm = '_log_private_parallelism_mul') / 100 )
6 as "calculated private strands"
7 from dual; www.2cto.com
calculated private strands
--------------------------
22
HELLODBA.COM>select count(1) "actual private strands" from x$kcrfstrand where last_buf_kcrfa = '00';
actual private strands
----------------------
22
注:在预分配Private strand时,会选择上述2个条件限制下最小一个数量。但相应的shared pool的内存分配和redo allocation latch的数量是按照活跃事务数预分配的。
因此,如果logfile足够大,_log_private_parallelism_mul与实际活跃进程百分比基本相符的话,Private strand的引入基本可以消除redo allocation latch的争用问题。
本文来自于无忧网客联盟