符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
继续验证使用索引时,cbc latch相关情况,使用solaris中的dtrace
创新互联专注于武城企业网站建设,自适应网站建设,商城网站开发。武城网站建设公司,为武城等地区提供建站服务。全流程按需设计,专业设计,全程项目跟踪,创新互联专业和态度为您提供的服务
编写dtrace脚本
more cbc.d #!/usr/sbin/dtrace -s -n char *memnr; int latchaddr; dtrace:::BEGIN { i=1; latchaddr=0; } pid$1::sskgslcas:entry { memnr=copyin(arg0,12); latchaddr=arg0; printf("[%2x%2x%2x%2x|%2x%2x%2x%2x|%2x%2x%2x%2x]",memnr[3],memnr[2],memnr[1],memnr[0],memnr[7],memnr[6],memnr[5],memnr[4],memnr [11],memnr[10],memnr[9],memnr[8]); printf("i=%d PID::entry:==%s:%s:%s:%s %x %x %x %x %x %x",i, probeprov, probemod, probefunc, probename,arg0,arg1,arg2,arg3,arg4,arg5); i=i+1; } pid$1::sskgslcas:return { memnr=copyin(latchaddr,12); printf("[%2x%2x%2x%2x|%2x%2x%2x%2x|%2x%2x%2x%2x]",memnr[3],memnr[2],memnr[1],memnr[0],memnr[7],memnr[6],memnr[5],memnr[4],memnr [11],memnr[10],memnr[9],memnr[8]); printf("i=%d PID::entry:==%s:%s:%s:%s %x %x %x",i, probeprov, probemod, probefunc, probename,latchaddr,arg0,arg1); i=i+1; }
先测试非唯一索引:
session1:创建相应对象,并多次执行查询语句
create table a as select * from dba_objects; create index idx_a on a(object_id); select owner from a where object_id='30000'; SQL> select c.sid,spid,pid,a.SERIAL# from (select sid from v$mystat where rownum<=1) c,v$session a,v$process b where c.sid=a.sid and a.paddr=b.addr; SID SPID PID SERIAL# ---------- ------------ ---------- ---------- 159 1355 15 9
session2:查询出block
set pagesize 50000 set linesize 10000 select file#,dbablk,tch,ba,HLADDR from x$bh a,dba_objects b where a.obj=b.data_object_id and object_name='IDX_A' order by FILE#,DBABLK; FILE# DBABLK TCH BA HLADDR ---------- ---------- ---------- -------- -------- 1 60641 0 5A4A8000 5F13949C 1 60642 0 5A350000 5F0FC938 1 60642 4 595EA000 5F0FC938 1 62091 0 58116000 5F14F564 1 62091 4 58468000 5F14F564 SQL> select segment_name,header_file,header_block from dba_segments where segment_name=upper('IDX_A'); SEGMENT_NAME HEADER_FILE HEADER_BLOCK --------------------------------------------------------------------------------- ----------- ------------ IDX_A 1 60641
60641对段头块,60642为索引的root块,62091为leaf块
执行dtrace脚本,做跟踪,然后回到session1中再次执行查询语句
./cbc.d 1355 > logic_read.log
bash-3.2# cat logic_read.log|wc -l
25
session1:60642对应5F0FC938,在索引扫描时,对root块是共享cbc latch
SQL> oradebug call sskgslcas 0x5f0fc938 0 1 Function returned 1 SQL> select owner from a where object_id='30000'; OWNER ------------------------------ PUBLIC PUBLIC SQL> oradebug call sskgsldecr 0x5f0fc938 1 Function returned 1
62091为leaf块,在索引扫描时,对leaf块是一次共享cbc latch,三次独占cbc latch
bash-3.2# cat logic_read.log|grep -i 5F14F564 1 53243 sskgslcas:entry [ 0 0 0 0| 0 0 6 8| 0 0 07a]i=5 PID::entry:==pid1355:oracle:sskgslcas:entry 5f14f564 0 1 fdc4d278 fdc4d270 fdc4d134 1 53244 sskgslcas:return [ 0 0 0 1| 0 0 6 8| 0 0 07a]i=6 PID::entry:==pid1355:oracle:sskgslcas:return 5f14f564 16 1 1 53243 sskgslcas:entry [ 0 0 0 0| 0 0 6 9| 0 0 07a]i=11 PID::entry:==pid1355:oracle:sskgslcas:entry 5f14f564 0 2000000f ffffffff fdc4d278 fdc4d130 1 53244 sskgslcas:return [20 0 0 f| 0 0 6 9| 0 0 07a]i=12 PID::entry:==pid1355:oracle:sskgslcas:return 5f14f564 16 1 1 53243 sskgslcas:entry [ 0 0 0 0| 0 0 6 a| 0 0 07a]i=13 PID::entry:==pid1355:oracle:sskgslcas:entry 5f14f564 0 2000000f c4a89cc fdc4d134 fdc4d270 1 53244 sskgslcas:return [20 0 0 f| 0 0 6 a| 0 0 07a]i=14 PID::entry:==pid1355:oracle:sskgslcas:return 5f14f564 16 1 1 53243 sskgslcas:entry [ 0 0 0 0| 0 0 6 b| 0 0 07a]i=15 PID::entry:==pid1355:oracle:sskgslcas:entry 5f14f564 0 2000000f 0 fdc4d278 fdc4d26c 1 53244 sskgslcas:return [20 0 0 f| 0 0 6 b| 0 0 07a]i=16 PID::entry:==pid1355:oracle:sskgslcas:return 5f14f564 16 1
上面是索引为非唯一索引时,cbc latch相关情况下面过程为测试
再测试唯一索引:
create table a as select * from dba_objects; create unique index idx_a on a(object_id); SQL> select c.sid,spid,pid,a.SERIAL# from (select sid from v$mystat where rownum<=1) c,v$session a,v$process b where c.sid=a.sid and a.paddr=b.addr; SID SPID PID SERIAL# ---------- ------------ ---------- ---------- 147 1374 16 12 select owner from a where object_id='30000'; SQL> select file#,dbablk,tch,ba,HLADDR from x$bh a,dba_objects b where a.obj=b.data_object_id and object_name='IDX_A' order by FILE#,DBABLK; FILE# DBABLK TCH BA HLADDR ---------- ---------- ---------- -------- -------- 1 60641 1 595EA000 5F13949C 1 60642 4 5A752000 5F0FC938 1 61343 3 584A0000 5F122270 SQL> / FILE# DBABLK TCH BA HLADDR ---------- ---------- ---------- -------- -------- 1 60641 1 595EA000 5F13949C 1 60642 6 5A752000 5F0FC938 1 61343 5 584A0000 5F122270 SQL> select segment_name,header_file,header_block from dba_segments where segment_name=upper('IDX_A'); SEGMENT_NAME -------------------------------------------------------------------------------- HEADER_FILE HEADER_BLOCK ----------- ------------ IDX_A 1 60641 60642为root块,61343为leaf块 bash-3.2# cat logic_read1.log CPU ID FUNCTION:NAME 0 53243 sskgslcas:entry [ 0 0 0 0| 0 0 074| 0 0 0 0]i=1 PID::entry:==pid1374:oracle:sskgslcas:entry 5ceb6fe8 0 930001 5d76abac 5ceb6fe8 5f8c4c6c 0 53244 sskgslcas:return [ 093 0 1| 0 0 074| 0 0 0 0]i=2 PID::entry:==pid1374:oracle:sskgslcas:return 5ceb6fe8 16 1 0 53243 sskgslcas:entry [ 0 0 0 0| 0 0 5db| 0 0 07a]i=3 PID::entry:==pid1374:oracle:sskgslcas:entry 5f0fc938 0 1 804510c 8045104 fdc18bf8 0 53244 sskgslcas:return [ 0 0 0 1| 0 0 5db| 0 0 07a]i=4 PID::entry:==pid1374:oracle:sskgslcas:return 5f0fc938 16 1 0 53243 sskgslcas:entry [ 0 0 0 0| 0 0 5 2| 0 0 07a]i=5 PID::entry:==pid1374:oracle:sskgslcas:entry 5f122270 0 1 804510c 8045104 fdc18bf8 0 53244 sskgslcas:return [ 0 0 0 1| 0 0 5 2| 0 0 07a]i=6 PID::entry:==pid1374:oracle:sskgslcas:return 5f122270 16 1 0 53243 sskgslcas:entry [ 0 0 0 0| 0 0 698| 0 0 07a]i=7 PID::entry:==pid1374:oracle:sskgslcas:entry 5f106340 0 1 fdc18f60 fdc18f58 fdc18f00 0 53244 sskgslcas:return [ 0 0 0 1| 0 0 698| 0 0 07a]i=8 PID::entry:==pid1374:oracle:sskgslcas:return 5f106340 16 1 0 53243 sskgslcas:entry [ 0 0 0 1| 0 0 075| 0 0 0 0]i=9 PID::entry:==pid1374:oracle:sskgslcas:entry 5ceb6fe8 1 930000 c4a88d0 5ceb6fe8 5f8c4c6c 0 53244 sskgslcas:return [ 093 0 0| 0 0 075| 0 0 0 0]i=10 PID::entry:==pid1374:oracle:sskgslcas:return 5ceb6fe8 16 1 bash-3.2# cat logic_read1.log|grep -i 5F0FC938 0 53243 sskgslcas:entry [ 0 0 0 0| 0 0 5db| 0 0 07a]i=3 PID::entry:==pid1374:oracle:sskgslcas:entry 5f0fc938 0 1 804510c 8045104 fdc18bf8 0 53244 sskgslcas:return [ 0 0 0 1| 0 0 5db| 0 0 07a]i=4 PID::entry:==pid1374:oracle:sskgslcas:return 5f0fc938 16 1 bash-3.2# cat logic_read1.log|grep -i 5F122270 0 53243 sskgslcas:entry [ 0 0 0 0| 0 0 5 2| 0 0 07a]i=5 PID::entry:==pid1374:oracle:sskgslcas:entry 5f122270 0 1 804510c 8045104 fdc18bf8 0 53244 sskgslcas:return [ 0 0 0 1| 0 0 5 2| 0 0 07a]i=6 PID::entry:==pid1374:oracle:sskgslcas:return 5f122270 16 1 bash-3.2# cat logic_read1.log|grep -i 5F106340 0 53243 sskgslcas:entry [ 0 0 0 0| 0 0 698| 0 0 07a]i=7 PID::entry:==pid1374:oracle:sskgslcas:entry 5f106340 0 1 fdc18f60 fdc18f58 fdc18f00 0 53244 sskgslcas:return [ 0 0 0 1| 0 0 698| 0 0 07a]i=8 PID::entry:==pid1374:oracle:sskgslcas:return 5f106340 16 1 唯一索引扫描时,对root块与leaf块都是一次共享cbc latch,对表块也是一次共享cbc latch
逻辑读时的cbc latch(一):http://qhd2004.blog.51cto.com/629417/1576554
逻辑读时的cbc latch(二):http://qhd2004.blog.51cto.com/629417/1576579
参考:http://blog.itpub.net/321157/viewspace-730936/