SQL> show parameter writer NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_writer_processes integer 1 SQL> alter system set db_writer_processes = 2 scope=spfile; --DBWn数量一般设定是服务器核心数/8.
alter system set db_cache_size=200m scope=both; 设置顺序: sga_max_size sga_target db_cache_size 在OLTP系统中,buffer cache的大小一般设置为sga_max_size的2/3. DB_CACHE_SIZE = SGA_MAX_SIZE/2 ~ SGA_MAX_SIZE*2/3 使用advice来确认buffer cache的大小 根据语句查询buffer cache该设置多大合适。减少I/O(物理读次数) 平日注意收集积累一些常用的语句》。
buffer header: SQL> desc x$bh state:0~8 0,free 1,XCUR 2,SCUR 3,CR 4,READ 从block写入buffer的那个过程 5,MREC 6,IREC 7,write 8,pi SQL> select distinct state from x$bh; 非RAC环境下,current永远等于xcur。 RAC下,有scur
cr块被构造后被读出,就马上没意义了。。马上就可以被覆盖了。。 要修改一个块,只能修改current块。
Q:查看一个对象占用了多少不同状态的buffer?
select o.object_name, decode(state,0,‘free‘,1,‘xcur‘,2,‘scur‘,3,‘cr‘,4,‘read‘,5,‘mrec‘, 6,‘irec‘,7,‘write‘,8,‘pi‘) state, count(*) blocks from x$bh b, dba_objects o where b.obj = o.data_object_id and o.object_name = ‘T2‘ group by o.object_name, state order by blocks desc
alter system flush buffer_cache;
select distinct object_name, dbarfil, dbablk from x$bh a, dba_objects b where a.obj=b.object_id and object_name=‘T2‘;
select object_name, dbarfil, dbablk from x$bh a, dba_objects b where a.obj=b.object_id and object_name=‘T2‘;
select o.object_name, decode(state,0,‘free‘,1,‘xcur‘,2,‘scur‘,3,‘cr‘,4,‘read‘,5,‘mrec‘, 6,‘irec‘,7,‘write‘,8,‘pi‘) state, count(*) blocks from x$bh b, dba_objects o where b.obj = o.data_object_id and state<>0 group by o.object_name, state order by blocks asc;
select obj object, dbarfil file#, dbablk block#, tch touches from x$bh where tch>10 order by tch asc;
select object_name, dbarfil, dbablk from x$bh a, dba_objects b where a.obj=b.object_id and dbarfil=1 and dbablk=287
select sum(blocks) from dba_data_files;
select decode(state,0,‘FREE‘,1,decode(lrba_seq,0,‘AVAILABLE‘,‘BEING USED‘),3,‘BEING USED‘, state) "BLOCK STATUS",count(*) from x$bh group by decode(state,0,‘FREE‘,1,decode(lrba_seq,0,‘AVAILABLE‘,‘BEING USED‘),3,‘BEING USED‘,state);
BLOCK STATUS COUNT(*)
select sum(pct_bufgets) "Percent" from (select rank() over (order by buffer_gets desc) as rank_bufgets, to_char(100 * ratio_to_report(buffer_gets) over(),‘999.99‘)pct_bufgets from v$sqlarea) where rank_bufgets < 11;
select disk_reads, substr(sql_text,1,4000) from v$sqlarea order by disk_reads asc;
iostat 1 10 vmstat 1 10 mpstat 1 10 mpstat -P 0 1 mpstat -P 1 1 top free
相克军_Oracle体系_随堂笔记005-Database buffer cache,布布扣,bubuko.com
相克军_Oracle体系_随堂笔记005-Database buffer cache
原文:http://www.cnblogs.com/jyzhao/p/3819369.html