- 最后登录
- 2023-8-16
- 在线时间
- 1686 小时
- 威望
- 2135
- 金钱
- 50532
- 注册时间
- 2011-10-12
- 阅读权限
- 200
- 帖子
- 5207
- 精华
- 39
- 积分
- 2135
- UID
- 2
|
5#
发表于 2012-5-9 16:59:08
回复 3# 的帖子
我们修改 隐藏参数 _db_block_hash_buckets , 将hash buckets 的数量减少到 最少(256);
这会导致大量的 BH 将不得不存放在少数的hash buckets中, 再观察相邻块的 表现;- SQL> alter system set "_db_block_hash_buckets"=256 scope=spfile;
- System altered.
- SQL> startup force;
- ORACLE instance started.
- Total System Global Area 939495424 bytes
- Fixed Size 2233960 bytes
- Variable Size 708839832 bytes
- Database Buffers 222298112 bytes
- Redo Buffers 6123520 bytes
- Database mounted.
- Database opened.
- SQL> show parameter hash
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- _db_block_hash_buckets integer 256
- hash_area_size integer 131072
- SQL>
- SQL>
- SQL> create table test_buffer_bucket tablespace users pctfree 99 as select * from dba_objects ;
- Table created.
- SQL> select object_id,data_object_id from dba_objects where object_name='TEST_BUFFER_BUCKET';
- OBJECT_ID DATA_OBJECT_ID
- ---------- --------------
- 81261 81261
-
- SQL> select count(*) from test_buffer_bucket;
- COUNT(*)
- ----------
- 75315
- SQL> select count(*) from test_buffer_bucket;
- COUNT(*)
- ----------
- 75315
-
- SQL> select file#,block#,class# from v$bh where OBJD=81261 order by block#
- 2 ;
- FILE# BLOCK# CLASS#
- ---------- ---------- ----------
- 4 162816 8
- 4 162817 8
- 4 162944 8
- 4 162945 8
- 4 163072 8
- 4 163073 8
- 4 163200 8
- 4 163201 8
- 4 163328 8
- 4 163329 8
- 4 163456 8
- .............
- FILE# BLOCK# CLASS#
- ---------- ---------- ----------
- 4 237489 1
- 4 237568 8
- 4 237569 8
- 4 237570 8
- 4 237571 8
- 4 238254 1
- 4 238592 8
- 4 238593 8
- 4 238594 8
- 4 238595 8
- 593 rows selected.
- SQL> select count(*) ,HLADDR from x$bh group by HLADDR;
- COUNT(*) HLADDR
- ---------- ----------------
- 58 00000000973997B8
- 44 0000000097399890
- 52 0000000097399968
- 47 0000000097399BF0
- 52 0000000097399CC8
- 47 0000000097399E78
- 45 000000009739A028
- 46 000000009739A100
- 45 000000009739A460
- 49 000000009739A538
- 44 000000009739A610
- COUNT(*) HLADDR
- ---------- ----------------
- 42 000000009739A7C0
- 53 000000009739A898
- 33 000000009739A970
- 49 000000009739AA48
- 53 000000009739ADA8
- 51 000000009739AE80
- 54 000000009739B1E0
- 41 000000009739B2B8
- 50 000000009739B468
- 44 000000009739B6F0
- 42 000000009739B8A0
- COUNT(*) HLADDR
- ---------- ----------------
- 46 000000009739BA50
- 39 000000009739BCD8
- 51 000000009739C038
- 49 000000009739C110
- 46 000000009739C2C0
- 53 000000009739C620
- 43 000000009739C6F8
- 44 000000009739CE90
- 41 000000009739CF68
- 46 000000009739D118
- 47 000000009739D2C8
- COUNT(*) HLADDR
- ---------- ----------------
- 46 000000009739D3A0
- 51 000000009739D550
- 37 000000009739D7D8
- 46 000000009739D8B0
- 36 000000009739DA60
- 44 000000009739DB38
- 36 000000009739DC10
- 41 000000009739DCE8
- 51 000000009739DDC0
- 52 000000009739E048
- 45 000000009739E2D0
- COUNT(*) HLADDR
- ---------- ----------------
- 57 000000009739E480
- 45 000000009739E558
- 44 000000009739E630
- 41 000000009739E708
- 50 000000009739E990
- 43 000000009739EC18
- 44 000000009739ECF0
- 56 000000009739EEA0
- 39 000000009739EF78
- 52 000000009739F200
- 40 000000009739F2D8
- COUNT(*) HLADDR
- ---------- ----------------
- 35 000000009739F560
- 50 000000009739F638
- 55 000000009739F7E8
- 47 000000009739F8C0
- 39 000000009739F998
- 32 000000009739FC20
- 58 000000009739FCF8
- 45 000000009739FEA8
- 43 00000000973A0130
- 53 00000000973A0490
- 48 00000000973A0568
- COUNT(*) HLADDR
- ---------- ----------------
- 40 00000000973A0640
- 53 00000000973A0718
- 41 00000000973A07F0
- 40 00000000973A08C8
- 43 00000000973A0A78
- 49 00000000973A0B50
- 45 00000000973A0DD8
- 54 00000000973A0EB0
- 42 00000000973A1060
- 43 00000000973A1138
- 50 00000000973A1210
- COUNT(*) HLADDR
- ---------- ----------------
- 54 00000000973A12E8
- 45 00000000973A13C0
- 44 00000000973A1498
- 49 00000000973A1648
- 52 00000000973A1720
- 45 00000000973A17F8
- 52 00000000973A18D0
- 35 00000000973A19A8
- 38 00000000973A1C30
- 52 00000000973A1EB8
- 39 00000000973A2068
- COUNT(*) HLADDR
- ---------- ----------------
- 48 00000000973A23C8
- 51 00000000973A24A0
- 48 00000000973A2578
- 42 00000000973A2728
- 42 00000000973A2800
- 41 00000000973A28D8
- 41 00000000973A2A88
- 52 00000000973A2B60
- 42 00000000973A2C38
- 41 00000000973A2EC0
- 48 00000000973A2F98
- COUNT(*) HLADDR
- ---------- ----------------
- 52 00000000973A32F8
- 38 00000000973A34A8
- 48 00000000973A3580
- 42 00000000973A38E0
- 49 00000000973A3B68
- 52 00000000973A3D18
- 40 00000000973A3DF0
- 40 00000000973A3FA0
- 52 00000000973A4300
- 44 00000000973A43D8
- 44 00000000973A44B0
- COUNT(*) HLADDR
- ---------- ----------------
- 51 00000000973A49C0
- 51 00000000973A4A98
- 49 00000000973A4B70
- 30 00000000973A4C48
- 44 00000000973A4D20
- 50 00000000973A4DF8
- 56 00000000973A4FA8
- 49 00000000973A5230
- 45 00000000973A5308
- 43 00000000973A53E0
- 39 00000000973A5590
- COUNT(*) HLADDR
- ---------- ----------------
- 54 00000000973A5668
- 47 00000000973A5740
- 39 00000000973A58F0
- 51 00000000973A59C8
- 35 00000000973A5D28
- 41 00000000973A6238
- 46 00000000973A6310
- 41 00000000973A64C0
- 48 00000000973A6820
- 38 00000000973A68F8
- 47 00000000973A6AA8
- COUNT(*) HLADDR
- ---------- ----------------
- 59 00000000973A6D30
- 42 0000000097399A40
- 42 0000000097399B18
- 51 0000000097399DA0
- 46 0000000097399F50
- 54 000000009739A1D8
- 42 000000009739A2B0
- 38 000000009739A388
- 47 000000009739A6E8
- 53 000000009739AB20
- 51 000000009739ABF8
- COUNT(*) HLADDR
- ---------- ----------------
- 42 000000009739ACD0
- 51 000000009739AF58
- 50 000000009739B030
- 39 000000009739B108
- 41 000000009739B390
- 42 000000009739B540
- 46 000000009739B618
- 53 000000009739B7C8
- 55 000000009739B978
- 45 000000009739BB28
- 45 000000009739BC00
- COUNT(*) HLADDR
- ---------- ----------------
- 43 000000009739BDB0
- 46 000000009739BE88
- 49 000000009739BF60
- 44 000000009739C1E8
- 53 000000009739C398
- 39 000000009739C470
- 50 000000009739C548
- 49 000000009739C7D0
- 40 000000009739C8A8
- 51 000000009739C980
- 61 000000009739CA58
- COUNT(*) HLADDR
- ---------- ----------------
- 55 000000009739CB30
- 39 000000009739CC08
- 52 000000009739CCE0
- 32 000000009739CDB8
- 43 000000009739D040
- 47 000000009739D1F0
- 53 000000009739D478
- 40 000000009739D628
- 44 000000009739D700
- 44 000000009739D988
- 60 000000009739DE98
- COUNT(*) HLADDR
- ---------- ----------------
- 37 000000009739DF70
- 35 000000009739E120
- 42 000000009739E1F8
- 41 000000009739E3A8
- 56 000000009739E7E0
- 42 000000009739E8B8
- 57 000000009739EA68
- 36 000000009739EB40
- 38 000000009739EDC8
- 46 000000009739F050
- 42 000000009739F128
- COUNT(*) HLADDR
- ---------- ----------------
- 56 000000009739F3B0
- 42 000000009739F488
- 42 000000009739F710
- 45 000000009739FA70
- 50 000000009739FB48
- 58 000000009739FDD0
- 47 000000009739FF80
- 53 00000000973A0058
- 44 00000000973A0208
- 49 00000000973A02E0
- 44 00000000973A03B8
- COUNT(*) HLADDR
- ---------- ----------------
- 46 00000000973A09A0
- 46 00000000973A0C28
- 56 00000000973A0D00
- 36 00000000973A0F88
- 43 00000000973A1570
- 53 00000000973A1A80
- 45 00000000973A1B58
- 58 00000000973A1D08
- 43 00000000973A1DE0
- 45 00000000973A1F90
- 40 00000000973A2140
- COUNT(*) HLADDR
- ---------- ----------------
- 54 00000000973A2218
- 39 00000000973A22F0
- 54 00000000973A2650
- 50 00000000973A29B0
- 46 00000000973A2D10
- 46 00000000973A2DE8
- 56 00000000973A3070
- 50 00000000973A3148
- 41 00000000973A3220
- 43 00000000973A33D0
- 40 00000000973A3658
- COUNT(*) HLADDR
- ---------- ----------------
- 45 00000000973A3730
- 49 00000000973A3808
- 51 00000000973A39B8
- 49 00000000973A3A90
- 41 00000000973A3C40
- 56 00000000973A3EC8
- 43 00000000973A4078
- 46 00000000973A4150
- 40 00000000973A4228
- 47 00000000973A4588
- 57 00000000973A4660
- COUNT(*) HLADDR
- ---------- ----------------
- 39 00000000973A4738
- 39 00000000973A4810
- 50 00000000973A48E8
- 43 00000000973A4ED0
- 61 00000000973A5080
- 36 00000000973A5158
- 50 00000000973A54B8
- 49 00000000973A5818
- 35 00000000973A5AA0
- 39 00000000973A5B78
- 45 00000000973A5C50
- COUNT(*) HLADDR
- ---------- ----------------
- 48 00000000973A5E00
- 44 00000000973A5ED8
- 42 00000000973A5FB0
- 42 00000000973A6088
- 53 00000000973A6160
- 54 00000000973A63E8
- 47 00000000973A6598
- 51 00000000973A6670
- 36 00000000973A6748
- 51 00000000973A69D0
- 53 00000000973A6B80
- COUNT(*) HLADDR
- ---------- ----------------
- 29 00000000973A6C58
- 41 00000000973A6E08
- 47 00000000973A6EE0
- 256 rows selected.
- SQL> oradebug setmypid;
- Statement processed.
- SQL> oradebug dump buffers 4;
- Statement processed.
- SQL> oradebug tracefile_name;
- /s01/orabase/diag/rdbms/g11r23/G11R23/trace/G11R23_ora_27444.trc
- CHAIN: 165 LOC: 0x973a23b8 HEAD: [0x7bbd9c18,0x817faa28]
- BH (0x7bfeedd8) file#: 4 rdba: 0x01027c00 (4/162816) class: 8 ba: 0x7be6a000
- set: 6 pool: 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 78,22
- dbwrid: 0 obj: 81261 objn: 81261 tsn: 4 afn: 4 hint: f
- hash: [0x7bfeff28,0x7bbf29e8] lru: [0x7e7f2430,0x7bfeed90]
- lru-flags: debug_dump
- ckptq: [NULL] fileq: [NULL] objq: [0x7e7f1ad8,0x9207cbc0] objaq: [0x7bfef158,0x7bfeedc8]
- st: XCURRENT md: NULL fpin: 'ktspfwh6: ktspffbmb' tch: 2
- flags: block_written_once redo_since_read
- LRBA: [0x0.0.0] LSCN: [0x0.0] HSCN: [0xffff.ffffffff] HSUB: [74]
-
-
-
- CHAIN: 67 LOC: 0x9739d108 HEAD: [0x7bbdc218,0x817fb018]
- BH (0x7bfd8f88) file#: 4 rdba: 0x01027c01 (4/162817) class: 8 ba: 0x7bc1c000
- set: 5 pool: 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 77,22
- dbwrid: 0 obj: 81261 objn: 81261 tsn: 4 afn: 4 hint: f
- hash: [0x7bff87b8,0x7bbf6a08] lru: [0x7bfd91a0,0x7bfd8f40]
- lru-flags: debug_dump
- ckptq: [NULL] fileq: [NULL] objq: [0x7bfda398,0x9207ba40] objaq: [0x7bfd9b58,0x7bfd8f78]
- st: XCURRENT md: NULL fpin: 'ktspfwh6: ktspffbmb' tch: 2
- flags: block_written_once redo_since_read
- LRBA: [0x0.0.0] LSCN: [0x0.0] HSCN: [0xffff.ffffffff] HSUB: [75]
-
-
- CHAIN: 192 LOC: 0x973a3a80 HEAD: [0x7bbdee08,0x813fa8f8]
- BH (0x7e7f19c8) file#: 4 rdba: 0x01027c80 (4/162944) class: 8 ba: 0x7e6b4000
- set: 6 pool: 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 78,22
- dbwrid: 0 obj: 81261 objn: 81261 tsn: 4 afn: 4 hint: f
- hash: [0x7c3fb3a8,0x7bfd99b8] lru: [0x7bfefaa0,0x7bfef840]
- lru-flags: debug_dump
- ckptq: [NULL] fileq: [NULL] objq: [0x7bfef868,0x7bfeeee8] objaq: [0x7bff0588,0x7bfef878]
- st: XCURRENT md: NULL fpin: 'ktspfwh6: ktspffbmb' tch: 2
- flags: block_written_once redo_since_read
- LRBA: [0x0.0.0] LSCN: [0x0.0] HSCN: [0xffff.ffffffff] HSUB: [58]
- CHAIN: 94 LOC: 0x9739e7d0 HEAD: [0x7bbf0b08,0x813eec28]
- BH (0x7bfda288) file#: 4 rdba: 0x01027c81 (4/162945) class: 8 ba: 0x7bc3c000
- set: 5 pool: 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 77,22
- dbwrid: 0 obj: 81261 objn: 81261 tsn: 4 afn: 4 hint: f
- hash: [0x7bff6088,0x7bbf0b08] lru: [0x7bfda4a0,0x7bfda240]
- lru-flags: debug_dump
- ckptq: [NULL] fileq: [NULL] objq: [0x7bfda268,0x7bfd9098] objaq: [0x7bfdb448,0x7bfda278]
- st: XCURRENT md: NULL fpin: 'ktspfwh6: ktspffbmb' tch: 2
- flags: block_written_once redo_since_read
- LRBA: [0x0.0.0] LSCN: [0x0.0] HSCN: [0xffff.ffffffff] HSUB: [59]
-
复制代码 以上可以看到 在hash bucket 非常有限的情况下 , 一个bucket 中会存放比 平时多得多的 BH buffer header,
block# 162816 在CHAIN: 165
block# 162817 在CHAIN: 67
block# 162944 在CHAIN: 192
block# 162945 在CHAIN: 94
block# 237568 CHAIN: 97
block# 237569 CHAIN: 255
block# 237570 CHAIN: 157
block# 237571 CHAIN: 59
但是 因为 HASH algorithm 对于 Block的RDBA+CLASS 的散列作用, 相邻的数据块(neighborhood block)会尽可能分在 不同的bucket内。
可以看一下 同一个 table object的 buffer header在 同一个 hash bucket中的情况, 可以看到 这些同一个hash bucket 中的BH 总是在物理上 那样疏远:
CHAIN 245 :(4/233129) (4/203462) (4/185178)
CHAIN 247: (4/223233) (4/196739) (4/163200)
- CHAIN: 245 LOC: 0x973a6738 HEAD: [0x7b7ea028,0x817f2fd8]
- BH (0x7b7e9f78) file#: 4 rdba: 0x01038ea9 (4/233129) class: 1 ba: 0x7b5e6000
- set: 5 pool: 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 77,22
- dbwrid: 0 obj: 81261 objn: 81261 tsn: 4 afn: 4 hint: f
- hash: [0x7bbddd68,0x973a6738] lru: [0x7b7ea190,0x7b7e9e00]
- lru-flags: debug_dump
- ckptq: [NULL] fileq: [NULL] objq: [0x7b7ea1b8,0x7b7e9f58] objaq: [0x7b7ea1c8,0x7b7e9f68]
- st: XCURRENT md: NULL fpin: 'kdswh01: kdstgr' tch: 0
- flags: only_sequential_access prefetched_block
- LRBA: [0x0.0.0] LSCN: [0x0.0] HSCN: [0xffff.ffffffff] HSUB: [65535]
- BH (0x7bbddcb8) file#: 4 rdba: 0x01031ac6 (4/203462) class: 1 ba: 0x7b89e000
- set: 6 pool: 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 78,22
- dbwrid: 0 obj: 81261 objn: 81261 tsn: 4 afn: 4 hint: f
- hash: [0x7bbdfd78,0x7b7ea028] lru: [0x7bbdded0,0x7bbddc70]
- lru-flags: debug_dump
- ckptq: [NULL] fileq: [NULL] objq: [0x7bbddef8,0x7bbddc98] objaq: [0x7bbddf08,0x7bbddca8]
- st: XCURRENT md: NULL fpin: 'kdswh01: kdstgr' tch: 0
- flags: only_sequential_access prefetched_block
- LRBA: [0x0.0.0] LSCN: [0x0.0] HSCN: [0xffff.ffffffff] HSUB: [65535]
- BH (0x7bbdfcc8) file#: 4 rdba: 0x0102d35a (4/185178) class: 1 ba: 0x7b8d4000
- set: 6 pool: 3 bsz: 8192 bsi: 0 sflg: 2 pwc: 78,22
- dbwrid: 0 obj: 81261 objn: 81261 tsn: 4 afn: 4 hint: f
- hash: [0x7c3e0238,0x7bbddd68] lru: [0x7bbdfc80,0x7bbe03a0]
- lru-flags: debug_dump moved_to_tail
- ckptq: [NULL] fileq: [NULL] objq: [0x7bbdff08,0x7bbdfca8] objaq: [0x7bbdff18,0x7bbdfcb8]
- st: XCURRENT md: NULL fpin: 'kdswh01: kdstgr' tch: 0
- flags: only_sequential_access
- LRBA: [0x0.0.0] LSCN: [0x0.0] HSCN: [0xffff.ffffffff] HSUB: [65535]
-
-
复制代码 |
|