-
Notifications
You must be signed in to change notification settings - Fork 312
/
bhcls.sql
50 lines (47 loc) · 1.55 KB
/
bhcls.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
-- Copyright 2018 Tanel Poder. All rights reserved. More info at http://tanelpoder.com
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions.
--------------------------------------------------------------------------------
--
-- File name: bhla.sql (Buffer Headers by Latch Address)
-- Purpose: Report which blocks are in buffer cache, protected by a cache
-- buffers chains child latch
--
-- Author: Tanel Poder
-- Copyright: (c) http://www.tanelpoder.com
--
-- Usage: @bhla <child latch address>
-- @bhla 27E5A780
--
--
-- Other: This script reports all buffers "under" the given cache buffers
-- chains child latch, their corresponding segment names and
-- touch counts (TCH).
--
--------------------------------------------------------------------------------
col bhla_object head object for a40 truncate
col bhla_DBA head DBA for a20
col bhla_obj head OBJ for 99999999999
WITH bclass AS (SELECT class, ROWNUM id from v$waitstat)
select /*+ LEADING(bh) */
bh.obj bhla_obj,
o.object_type,
o.owner||'.'||o.object_name bhla_object,
bclass.class,
bh.tch,
file# ||' '||dbablk bhla_DBA,
bh.state,
bh.mode_held,
bh.dirty_queue DQ,
trim(to_char(bh.flag, 'XXXXXXXX')) ||':'||trim(to_char(bh.lru_flag, 'XXXXXXXX')) flg_lruflg
from
x$bh bh,
dba_objects o,
bclass
where
bh.obj = o.data_object_id
and bh.class = bclass.id (+)
and bh.class = &1
--and hladdr = hextoraw(lpad('&1', vsize(hladdr)*2 , '0'))
order by
tch desc
/