(article best formated at link:http://tinyurl.com/ybyjazq)
selectcount(*),sql_id,nvl(o.object_name,ash.current_obj#) objn,substr(o.object_type,0,10) otype,CURRENT_FILE# fn,CURRENT_BLOCK# blocknfrom v$active_session_history ash, all_objects owhere event like 'latch: cache buffers chains'and o.object_id (+)= ash.CURRENT_OBJ#group by sql_id, current_obj#, current_file#,current_block#, o.object_name,o.object_typeorder by count(*)/
CNT SQL_ID OBJN OTYPE FN BLOCKN---- ------------- -------- ------ --- ------84 a09r4dwjpv01q MYDUAL TABLE 1 93170
select * from v$event_namewhere name = 'latch: cache buffers chains'
EVENT# NAME PARAMETER1 PARAMETER2 PARAMETER3---------- ---------------------------- ---------- ---------- ----------58 latch: cache buffers chains address number tries
So P1 is the address of the latch for the cbc latch wait.
selectcount(*),lpad(replace(to_char(p1,'XXXXXXXXX'),' ','0'),16,0) laddrfrom v$active_session_historywhere event='latch: cache buffers chains'group by p1order by count(*);
COUNT(*) LADDR---------- ----------------4933 00000004D8108330
select o.name, bh.dbarfil, bh.dbablk, bh.tchfrom x$bh bh, obj$ owhere tch > 100and hladdr='00000004D8108330'and o.obj#=bh.objorder by tch
NAME DBARFIL DBABLK TCH----------- ------- ------ ----EMP_CLUSTER 4 394 120
selectname, file#, dbablk, obj, tch, hladdrfrom x$bh bh, obj$ owhereo.obj#(+)=bh.obj andhladdr in(select ltrim(to_char(p1,'XXXXXXXXXX') )from v$active_session_historywhere event like 'latch: cache buffers chains'group by p1having count(*) > 5)and tch > 5order by tch
NAME FILE# DBABLK OBJ TCH HLADDR------------- ----- ------ ------ --- --------BBW_INDEX 1 110997 66051 17 6BD91180IDL_UB1$ 1 54837 73 18 6BDB8A80VIEW$ 1 6885 63 20 6BD91180VIEW$ 1 6886 63 24 6BDB8A80DUAL 1 2082 258 32 6BDB8A80DUAL 1 2081 258 32 6BD91180MGMT_EMD_PING 3 26479 50312 272 6BDB8A80
col object_name for a35col cnt for 99999SELECTcnt, object_name, object_type,file#, dbablk, obj, tch, hladdrFROM (select count(*) cnt, rfile, block from (SELECT /*+ ORDERED USE_NL(l.x$ksuprlat) */--l.laddr, u.laddr, u.laddrx, u.laddrr,dbms_utility.data_block_address_file(to_number(object,'XXXXXXXX')) rfile,dbms_utility.data_block_address_block(to_number(object,'XXXXXXXX')) blockFROM(SELECT /*+ NO_MERGE */ 1 FROM DUAL CONNECT BY LEVEL <= 100000) s,(SELECT ksuprlnm LNAME, ksuprsid sid, ksuprlat laddr,TO_CHAR(ksulawhy,'XXXXXXXXXXXXXXXX') objectFROM x$ksuprlat) l,(select indx, kslednam from x$ksled ) e,(SELECTindx, ksusesqh sqlhash, ksuseopc, ksusep1r laddrFROM x$ksuse) uWHERE LOWER(l.Lname) LIKE LOWER('%cache buffers chains%')AND u.laddr=l.laddrAND u.ksuseopc=e.indxAND e.kslednam like '%cache buffers chains%')group by rfile, block) objs,x$bh bh,dba_objects oWHEREbh.file#=objs.rfileand bh.dbablk=objs.blockand o.object_id=bh.objorder by cnt;
CNT OBJECT_NAME TYPE FILE# DBABLK OBJ TCH HLADDR---- ----------------- ----- ----- ------- ------ ----- --------1 WB_RETROPAY_EARNS TABLE 4 18427 52701 1129 335F7C001 WB_RETROPAY_EARNS TABLE 4 18194 52701 1130 335F7C003 PS_RETROPAY_RQST TABLE 4 13253 52689 1143 33656D003 PS_RETROPAY_RQST INDEX 4 13486 52692 997 33656D003 WB_JOB TABLE 4 14443 52698 338 335B90805 PS_RETROPAY_RQST TABLE 4 13020 52689 997 33656D005 WB_JOB TABLE 4 14676 52698 338 335B90805 WB_JOB TABLE 4 13856 52698 338 335F7C006 WB_JOB TABLE 4 13623 52698 338 335F7C007 WB_JOB TABLE 4 14909 52698 338 335B9080141 WB_JOB TABLE 4 15142 52698 338 335B90802513 WB_JOB INDEX 4 13719 52699 997 33656D00
1 mod 4 = 1
2 mod 4 = 23 mod 4 = 34 mod 4 = 05 mod 4 = 16 mod 4 = 27 mod 4 = 38 mod 4 = 0
How many copies of a block are in the cache?
selectcount(*), name, file#, dbablk, hladdrfrom x$bh bh, obj$ owhereo.obj#(+)=bh.obj andhladdr in(select ltrim(to_char(p1,'XXXXXXXXXX') )from v$active_session_historywhere event like 'latch: cache%'group by p1)group by name,file#, dbablk, hladdrhaving count(*) > 1order by count(*);
CNT NAME FILE# DBABLK HLADDR--- ---------- ------ ------- --------14 MYDUAL 1 93170 2C9F4B20
Find SQL ( Why is application hitting the block so hard? )
Possibly change application logicEliminate hot spots
Nested loops, possibly
Hash Partition
Uses Hash JoinHash clusters
Look up tables (“select language from lang_table where ...”)
Change application
Use plsql function
Spread data out to reduce contention
Select from dual
Possibly use x$dual
Updates, inserts , select for update on blocks while reading those blocks
Cause multiple copies and make things worse
Recent comments
17 weeks 7 hours ago
26 weeks 5 days ago
28 weeks 3 days ago
31 weeks 5 days ago
33 weeks 6 days ago
43 weeks 3 days ago
45 weeks 9 hours ago
46 weeks 11 hours ago
46 weeks 1 day ago
48 weeks 6 days ago