asdasvrrsdasd

Upload: bsrksg123

Post on 04-Jun-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/14/2019 ASDASVRRSDASD

    1/64

    Enqueue Waits : Locks

  • 8/14/2019 ASDASVRRSDASD

    2/64

    #.2

    Copyright 2006 Kyle Hailey

    Locks

    REDO Lib

    Cache

    Buffer

    Cache

    IO

    Locks

    Network

  • 8/14/2019 ASDASVRRSDASD

    3/64

    #.3

    Copyright 2006 Kyle Hailey

    Enqueues = Locks

    Waits

    Disk I/O

    Library Cache

    Enqueue

    Undo

    TX - row lock contention

    TX - allocate ITL entry

    HW

    Redo

    Buffer Cache

    SQL*Net

    TM

    STTS

    TX - index contention

    US

    CI

    SQ

    Locks

    Come in

    Many

    Types

  • 8/14/2019 ASDASVRRSDASD

    4/64

    #.4

    Copyright 2006 Kyle Hailey

    Locks Covered in this Section

    Part I

    TMtable modification

    TXTransaction locks

    ULuser lock

    Part II

    CICross Instance

    CUCursor Bind

    HWHigh Water ROReusable Object

    STSpace Transaction

    TSTemporary Space

  • 8/14/2019 ASDASVRRSDASD

    5/64

    #.5

    Copyright 2006 Kyle Hailey

    Locks Can be Intractable

    Lock seems easy compared to latches orother esoteric waits, but they can befrustratingly intractable

    Statspack & AWR lacks enough data to solve

    To Solve, you need eitherReal time

    ASH Insolvable: No dependable way to find the

    blocking SQL

  • 8/14/2019 ASDASVRRSDASD

    6/64

    #.6

    Copyright 2006 Kyle Hailey

    Solving Enqueues

    Need SQL and Object/row

    Statspack fails

    V$active_session_history succeeds

    In real time can also use

    v$lockv$session

    dba_blockers

    dba_waiters

    ?/rdbms/admin/utllockt.sql

    http://www.evdbt.com/enqwaits.sql

  • 8/14/2019 ASDASVRRSDASD

    7/64

    #.7

    Copyright 2006 Kyle Hailey

    Statspack 9iTop 5 Timed Events Avg %Total

    ~~~~~~~~~~~~~~~~~~ wait Call

    Event Waits Time (s) (ms) Time

    -------------------------- ------------ ----------- ------ ------

    Enqueue 42 126 3000 96.5CPU time 4 2.8

    db file sequential read 165 1 4 .4

    control file sequential read 214 0 1 .1

    log file switch completion 2 0 40 .1

    Statspack is INSUFFICIENT, missing

    Who is blocked

    Who Blocks

    What blocks

    How they are blocked

  • 8/14/2019 ASDASVRRSDASD

    8/64

    #.8

    9i Investigation

    Select * from v$event_name wherename=enqueue;

    Copyright 2006 Kyle Hailey

    Parameter1 parameter2 parameter3---------- ---------- ----------

    Name|mode id1 id2

  • 8/14/2019 ASDASVRRSDASD

    9/64

    #.9

    Copyright 2006 Kyle Hailey

    9i Enqueue P1: Type and Mode

    Type: 5458

    P1 P1RAW

    ---------- --------

    1415053318 54580006

    Hex Decimal ASCII

    54 = 84 = T

    58 = 88 = X

    Lock = TX 6

    Mode: 0006

  • 8/14/2019 ASDASVRRSDASD

    10/64

    #.10

    9i Translating Lock and Mode

    SELECT

    chr(bitand(p1,-16777216)/16777215)||

    chr(bitand(p1, 16711680)/65535) Type",mod(p1,16) as Mode"

    from v$session_wait

    Where event=enqueue/

    SELECTchr(bitand(p1,-16777216)/16777215)||

    chr(bitand(p1, 16711680)/65535) Type,

    mod(p1,16) lmode

    from v$session_waitwhere event=enqueue;

    TY LMODE-- ----------

    TX 6

  • 8/14/2019 ASDASVRRSDASD

    11/64

    #.11

    Copyright 2006 Kyle Hailey

    10g Translates all the Enquques

    9iOne Wait : enqueue

    10g

    208 enqueue waits

    Specific to each type of enqueueenq: HW - contention Configurationenq: SQ - contention Configurationenq: SS - contention Configurationenq: ST - contention Configuration

    enq: TM - contention Applicationenq: TW - contention Administrativeenq: TX - allocate ITL entry Configurationenq: TX - index contention Concurrencyenq: TX - row lock contention Applicationenq: TX contention Application

  • 8/14/2019 ASDASVRRSDASD

    12/64

  • 8/14/2019 ASDASVRRSDASD

    13/64

    #.13

    Copyright 2006 Kyle Hailey

    Common Lock Types

    Wait Event Parameter2 Parameter3enq: CI - contention opcode typeenq: CF - contention 0 operationenq: CU - contention handle handleenq: HW - contention table space # blockenq: IM - contention for blr pool # 0

    enq: RO - contention 2 0enq: RO - fast object reuse 2 0enq: SQ - contention object # 0enq: ST - contention 0 0enq: TM - contention object # table/partitionenq: TS - contention tablespace ID dbaenq: TX - allocate ITL entry usn

  • 8/14/2019 ASDASVRRSDASD

    14/64

    #.14

    Copyright 2006 Kyle Hailey

    Statspack 10g5 Timed Events Avg %Total

    ~~~~~~~~~~~~~~~~~~ wait CallEvent Waits Time (s) (ms) Time----------------------------- ------ -------- ------ ------

    enq: TX - row lock contention 42 126 3000 96.5

    CPU time 4 2.8

    db file sequential read 165 1 4 .4

    control file sequential read 214 0 1 .1

    log file switch completion 2 0 40 .1

    10g Better, tells what kind of lock

    But still notwho is blocked,

    who blocks them

    what they are blocked on

  • 8/14/2019 ASDASVRRSDASD

    15/64

    #.15

    Copyright 2006 Kyle Hailey

    V$active_session_history

    Succeeds Who is waiting

    SESSION_ID

    SESSION_SERIAL#

    USER_ID On what object

    CURRENT_OBJ#

    CURRENT_FILE#

    CURRENT_BLOCK#

    With what SQL SQL_ID

    Who is the blocker BLOCKING_SESSION

    BLOCKING_SESSION_STATUS

    BLOCKING_SESSION_SERIAL#

    What is the Blocker SQL not reliably possible

    Maybe by dumping REDO

    OEM externalize all of this

  • 8/14/2019 ASDASVRRSDASD

    16/64

    #.16

    Copyright 2006 Kyle Hailey

    OEM 10g

    if P1 = 1415053318then mode = 6

    Then it is a data block

    row lock

  • 8/14/2019 ASDASVRRSDASD

    17/64

    #.17

    Copyright 2006 Kyle Hailey

    10g: find the lock modeP1 (parameter1) same for all locks

    select distinct parameter1 from v$event_name

    where name like 'enq:%'

    PARAMETER1----------

    name|mode

    select distinct event, p1, to_char(p1,'XXXXXXXX') p1raw

    from v$active_session_history where event like 'enq:%;

    EVENT P1 P1RAW------------------------------ ---------- ---------enq: TX - row lock contention 1415053316 54580004

    enq: TX - row lock contention 1415053318 54580006

    enq: TX - allocate ITL entry 1415053316 54580004

  • 8/14/2019 ASDASVRRSDASD

    18/64

    #.18

    Copyright 2006 Kyle Hailey

    P1 = name | modeP1 (parameter1) same for all locks

    select distinct parameter1 from v$event_namewhere name like 'enq:%'

    select

    distinct event,p1,mod(p1,16) as "mode"

    from v$active_session_historywhere event like 'enq:%;

    EVENT P1 mode----------------------------- ---------- ----enq: TX - allocate ITL entry 1415053316 4enq: TX - row lock contention 1415053318 6enq: TX - row lock contention 1415053316 4

    PARAMETER1----------name|mode

  • 8/14/2019 ASDASVRRSDASD

    19/64

    #.19

    Copyright 2006 Kyle Hailey

    Mode Cheat Sheet

    TXif P1 = 1415053316

    then mode = 4

    if P1 = 1415053318then mode = 6

  • 8/14/2019 ASDASVRRSDASD

    20/64

    #.20

    Copyright 2006 Kyle Hailey

    Lock Modes

    # Type Name

    --- ------- ---------------------------

    1 Null Null

    2 SS Sub share

    3 SX Sub exclusive

    4 S Share

    5 SSX Share/sub exclusive

    6 X Exclusive

  • 8/14/2019 ASDASVRRSDASD

    21/64

    #.21

    Copyright 2006 Kyle Hailey

    Transaction Locks (TX)

    TX = Transaction = Wait on UNDOMode 6

    modification of a row lock

    Mode 4 Index block spiltUnique Index Key enforcementForeign key enforcement ITL space waits

    Bitmap chunk conflictsAlter tablespace read only;Free Lists slot waitsPossible with two phase commit

  • 8/14/2019 ASDASVRRSDASD

    22/64

  • 8/14/2019 ASDASVRRSDASD

    23/64

    #.23

    Copyright 2006 Kyle Hailey

    TX Lock

    update toto set name =SMITH where id = ;

    Undo

    Segment

    Session a

    Data BlockHeader

    Transaction 1

    Data Block

    Header

    Row 1

    Table Toto

    Undo

    SegmentHeader

    Session B

    update toto set name =ADAMS where id = ;

    Wait for TxTo commit

    Delete from toto where id = ;Delete from toto where id = 9;

  • 8/14/2019 ASDASVRRSDASD

    24/64

    #.24

    Copyright 2006 Kyle Hailey

    enq: TX - row lock contention

    User 1

    SQL> delete from toto

    where id = 1;

    User 2

    SQL> delete from toto

    where id =1;--hang

    Mode 6, row in data blockonly one reason

    SQL> Delete from titi

    Where id = 1;

  • 8/14/2019 ASDASVRRSDASD

    25/64

    #.25

    Copyright 2006 Kyle Hailey

    enq: TX - row lock contention

    if P1 = 1415053318

    then mode = 6

    Then it is a data blockrow lock

  • 8/14/2019 ASDASVRRSDASD

    26/64

    #.26

    Copyright 2006 Kyle Hailey

    enq: TX - row lock contention

    Table

    ValueID

    fooSession 1: delete where id = 1;no commit

    Session 2: delete where id = 1 ;

    Enqueue TX 6

    1

    TX Mode 6

  • 8/14/2019 ASDASVRRSDASD

    27/64

    #.27

    Copyright 2006 Kyle Hailey

    TXMode 4

    if P1 = 1415053316

    then mode = 4

    Not same data but conflicts

  • 8/14/2019 ASDASVRRSDASD

    28/64

    #.28

    enq: TX - row lock contention

    Mode 4, happens for 3 reasons

    1. Unique key contention

    2. Foreign Key contention3. Bitmap index contention

    (others?)

    Copyright 2006 Kyle Hailey

  • 8/14/2019 ASDASVRRSDASD

    29/64

    #.29

    Copyright 2006 Kyle Hailey

    1. enq: TX - row lock contention

    User 1

    create table p(n number);

    create unique index p_i

    on p(n);

    insert into p values(3);

    User 2

    insert into p values(3);

    --hang

    Mode 4 , unique index

  • 8/14/2019 ASDASVRRSDASD

    30/64

    # 31

  • 8/14/2019 ASDASVRRSDASD

    31/64

    #.31

    Copyright 2006 Kyle Hailey

    2. enq: TX - row lock contention

    User 8

    create table parent (id number primary key);

    create table child (id number references parent,name varchar2(20));

    insert into parent values (2);

    User 10

    insert into child values (2,88);

    -- hang

    Mode 4, foreign key

    # 32

  • 8/14/2019 ASDASVRRSDASD

    32/64

    #.32

    Copyright 2006 Kyle Hailey

    2. enq: TX - row lock contention

    Parent Child

    ID ID NameValueID

    PK

    Session 1: Insert key into parentno commit

    2 ? 2 ? 2

    Foreign Key

    Session 2: Insert into child same key :Enqueue TX 4

    TX 4 - Foreign Key

    # 33

  • 8/14/2019 ASDASVRRSDASD

    33/64

    #.33

    Copyright 2006 Kyle Hailey

    3. enq: TX - row lock contention

    Mode 4

    Bitmaps are compressed

    Changes to the same bitmap cause locks

    Value StartRowid

    EndRowid

    Bitmap

    1000.000.0000 000.000.000

    01010000111000011100001100

    2000.000.0000 000.000.000

    01010000111000011100001100

    # 34

  • 8/14/2019 ASDASVRRSDASD

    34/64

    #.34

    Copyright 2006 Kyle Hailey

    3. enq: TX - row lock contention

    update t1 set n1 = 2

    where n2 = 13;

    Session 2

    Different rows butsame key value

    create table t1 (n1 number(4),n2 number(4));

    insert into t1select 1, rownum

    from all_objectswhere rownum

  • 8/14/2019 ASDASVRRSDASD

    35/64

    #.35

    Copyright 2006 Kyle Hailey

    3. enq: TX - row lock contention

    Bitmaps are compressed

    Changes to the same bitmap chunk causelocks

    Value StartRowid

    EndRowid

    Bitmap

    1200.0 204.7

    01010000111000011100001100

    1205.0 210.3

    01010000111000011100001100

    2200.0 205.6

    01010000111000011100001100

    block row

    # 36

  • 8/14/2019 ASDASVRRSDASD

    36/64

    #.36

    Copyright 2006 Kyle Hailey

    Value StartRowid

    EndRowid

    Bitmap

    1200.0 204.7

    01010000111000011100001100

    2205.0 210.3

    01010000111000011100001100

    3200.0 205.6

    01010000111000011100001100

    3. enq: TX - row lock contention

    Session 1 Session 2Update id=800set value 2

    Update id=3

    set value 2

    # 37

  • 8/14/2019 ASDASVRRSDASD

    37/64

    #.37

    Summary: TX 4 from ASHuniq index

    ST EVENT SID LM P2 P3 OBJ OTYPE FN BLOCKN SQL_ID BSID----- ---------------------- --- --- ------ ---- ----- ----- --- ------ --

    10:39 enq: TX - row lock c 141 4 655406 6672 -1 0 0 bjvx94vnxtxgv 158

    10:39 enq: TX - row lock c 141 4 655406 6672 -1 0 0 bjvx94vnxtxgv 158

    10:39 enq: TX - row lock c 141 4 655406 6672 -1 0 0 bjvx94vnxtxgv 158

    10:39 enq: TX - row lock c 141 4 655406 6672 -1 0 0 bjvx94vnxtxgv 158

    FK (10.2.0.3)

    ST EVENT SID LM P2 P3 OBJ OTYPE FN BLOCKN SQL_ID BSID----- ---------------------- --- --- ------ ---- ----- ----- --- ------ --

    10:41 enq: TX - row lock c 144 4 179681 7074 CHILD TABLE 1 60954 ahm7c9rupbz9r 1

    10:41 enq: TX - row lock c 144 4 179681 7074 CHILD TABLE 1 60954 ahm7c9rupbz9r 1

    10:41 enq: TX - row lock c 144 4 179681 7074 CHILD TABLE 1 60954 ahm7c9rupbz9r 1

    bitmap

    ST EVENT SID LM P2 P3 OBJ OTYPE FN BLOCKN SQL_ID BSID

    ----- ---------------------- --- --- ------ ---- ----- ----- --- ------ --10:41 enq: TX - row lock c 143 4 966081 4598 I1 INDEX 0 0 azav296xxqcjx 144

    10:41 enq: TX - row lock c 143 4 966081 4598 I1 INDEX 0 0 azav296xxqcjx 144

    10:41 enq: TX - row lock c 143 4 966081 4598 I1 INDEX 0 0 azav296xxqcjx 144

    10:41 enq: TX - row lock c 143 4 966081 4598 I1 INDEX 0 0 azav296xxqcjx 144

    Copyright 2006 Kyle Hailey

    # 38

  • 8/14/2019 ASDASVRRSDASD

    38/64

    #.38

    Copyright 2006 Kyle Hailey

    enq: TX - allocate ITL entry

    Data Block

    Header

    ITL

    Data

    Data Block

    Header

    Transaction 1 Info

    Transaction 2 Info

    # 39

  • 8/14/2019 ASDASVRRSDASD

    39/64

    #.39

    Copyright 2006 Kyle Hailey

    enq: TX - allocate ITL entry

    Data Block

    Header

    Transaction 1

    Data

    Data Block

    Header

    Transaction 2

    Row 1

    Row 2

    Row 3

    Transaction 3

    # 40

  • 8/14/2019 ASDASVRRSDASD

    40/64

    #.40

    Copyright 2006 Kyle Hailey

    enq: TX - allocate ITL entry

    create table itl (id number,

    data varchar2(20)

    )

    pctfree 0initrans 1;

    insert into itl select rownum,'a' from all_objects

    where rownum < 2000;

    commit;

    session 1: update itl set data=data where id=1;session 2: update itl set data=data where id=2;

    session 3: update itl set data=data where id=3;

    session 4: update itl set data=data where id=4;

    session 5: update itl set data=data where id=5;

    # 41

  • 8/14/2019 ASDASVRRSDASD

    41/64

    #.41

    Copyright 2006 Kyle Hailey

    enq: TX - contention

    Example

    Session 1start transaction, dont commit

    Session 2alter tablespace read only

    ExampleData File Extensionwaiter waitng for another session to extend file

    Index Block Splitwaiter waiting for another session to split the block

    Others ?

    Free Lists Non-ASSM

    Sessions freeing block

    If no txs free lists available (min 16, grow up depending on block size) , pick one and wait TX4

    2PCtwo phase commit First does a prepare the commit

    Any read or write access in the intervening time waits TX 4

    # 42

  • 8/14/2019 ASDASVRRSDASD

    42/64

    #.42

    Copyright 2006 Kyle Hailey

    TX Further Investigation

    EVENT SQL_ID OBJ FILE# BLOCK#------------------------------ ------------- --------- --- ------enq: TX - row lock contention ahm7c9rupbz9r 53363 FOO 1 123586

    enq: TX - row lock contention bjvx94vnxtxgv 53363 FOO 1 123586

    enq: TX - row lock contention ahm7c9rupbz9r 53363 FOO 1 123586

    enq: TX - row lock contention bjvx94vnxtxgv 53363 FOO 1 123586

    enq: TX - row lock contention ahm7c9rupbz9r 53363 FOO 1 123586

    select event, sql_id,CURRENT_OBJ# || ' ' || name obj

    ,CURRENT_FILE# file#,CURRENT_BLOCK# block#

    from v$active_session_history ash,obj$ o

    whereevent like 'enq: TX%'

    and o.obj# (+)= ash.current_obj#order by sample_time

    # 43

  • 8/14/2019 ASDASVRRSDASD

    43/64

    #.43

    Copyright 2006 Kyle Hailey

    TX Further Investigation

    V$active_session_history :

    BLOCKING_SESSIONBLOCKING_SESSION_STATUSBLOCKING_SESSION_SERIAL#

    Who is the blocker:

    No Guarentee of finding blocker SQL

    # 44

  • 8/14/2019 ASDASVRRSDASD

    44/64

    #.44

    Copyright 2006 Kyle Hailey

    enq: TM - contention

    TX locks have a corresponding TM lock

    TM locks the structure from change

    LOCK Parmeter1 Parmeter2(ID1) Parameter3(ID2)

    ------- --------- ------------- ---------------enq: TM name|mode object # table/partition

    Parameter1 = object id

    # 45

  • 8/14/2019 ASDASVRRSDASD

    45/64

    #.45

    Copyright 2006 Kyle Hailey

    enq: TM - contention

    User 1

    create table parent (id number primary key);

    create table child (id number references parent,name varchar2(20));

    insert into parent values (1);

    insert into parent values (2);commit;

    delete from parent where id=2;

    User 2

    insert into child values (1,2);

    Exclusive Row Level Lock

    #.46

  • 8/14/2019 ASDASVRRSDASD

    46/64

    #.46

    Copyright 2006 Kyle Hailey

    enq: TM - contentionParent

    ChildID ID NameValueID

    PK

    Delete from Parent where ID=2 :

    1 1 1

    Insert into Child ID=1

    Enqueue TM 4

    Session 2 doesnt know the value Session 1 inserted

    Session 2 only knows there is an outstanding change

    X X

    Session 1

    Session 2

    2 2

    #.47

  • 8/14/2019 ASDASVRRSDASD

    47/64

    #.47

    Copyright 2006 Kyle Hailey

    enq: TMcontentionSolution

    Parent Child

    ID ID NameValueID

    PK

    Session 1: Insert into Child ID=1

    Session 2: Delete from Parent ID=2

    OKcan verify quickly in the child index

    ID

    Index

    Foreign Key

    121

    #.48

    TM F th I ti ti

  • 8/14/2019 ASDASVRRSDASD

    48/64

    # 8

    Copyright 2006 Kyle Hailey

    TM Further Investigation

    EVENT SQL_ID mode OBJ

    ------------------------------ ------------- ---- ---------------enq: TM - contention 8zw36yw3fq4yy 4 53372 CHILDenq: TM - contention 8zw36yw3fq4yy 4 53372 CHILDenq: TM - contention 8zw36yw3fq4yy 4 53372 CHILDenq: TM - contention 8zw36yw3fq4yy 4 53372 CHILDenq: TM - contention 8zw36yw3fq4yy 4 53372 CHILDenq: TM - contention 8zw36yw3fq4yy 4 53372 CHILD

    select

    event,

    sql_id,mod(p1,16) as "mode",p2|| ' ' || o.name obj

    from v$active_session_history ash,obj$ o

    whereevent like 'enq: TM%'and o.obj# (+)= ash.p2

    order by sample_time;

    #.49

  • 8/14/2019 ASDASVRRSDASD

    49/64

    Copyright 2006 Kyle Hailey

    UL Locks

    User-defined Locks

    dbms_lock

    Wait Event Parameter2 Parameter3enq: UL - contention id 0

    dbms_lock.allocate_unique(v_lockname, v_lockhandle);

    dbms_lock.request(v_lockhandle, p_ltype);dbms_lock.release(v_lockhandle);

    #.50

    I t l L k

  • 8/14/2019 ASDASVRRSDASD

    50/64

    Copyright 2006 Kyle Hailey

    Internal Locks

    CICross Instance

    CUCursor Bind

    HWHigh Water

    ROReuse Object

    STSpace Transaction

    #.51

  • 8/14/2019 ASDASVRRSDASD

    51/64

    Copyright 2006 Kyle Hailey

    enq: CI - contention

    Cross Instance

    not OPS lock.

    invoke actions in background processes checkpoints

    log switches

    instance is shut down

    #.52

  • 8/14/2019 ASDASVRRSDASD

    52/64

    Copyright 2006 Kyle Hailey

    CICross InstanceId2 Meaning (parameter3)1 Pass in Parameters

    2 Invoke the call in background process

    3 Foreground has not returned yet

    4 Used to allocate the CI call

    5 Used to queue up interested clients

    Id1 Meaning (parameter2)

    0 Flush buffers for reuse as new class

    1 LGWR checkpointing and Hot Backup

    2 DBWR synchronization of SGA with control file

    3 Log file add/drop/rename notification

    4 Write buffer for CR read

    5 Test Call

    6 Invalidate KCK cache in all instances

    7 Alter rollback segment optimal

    8 Signal Query Servers/coordinator

    9 Create Remote Parallel Query Server

    10 Set Global Partitions

    11 Stop Disk Writes

    12 Drop Sort Segments

    13 Release unused space from Sort Segments

    14 Instance Recovery for Parallel operation Group

    15 Validate parallel slave Lock Value

    16 Check Transaction State Objects

    #.53

    CI L k

  • 8/14/2019 ASDASVRRSDASD

    53/64

    Copyright 2006 Kyle Hailey

    CI Locks

    select

    substr(sql_text,0,20) sql_text,p2,p3,CURRENT_OBJ# || ' ' || name obj,CURRENT_FILE# file#,CURRENT_BLOCK# block#

    from v$active_session_history ash,

    obj$ o,v$sqltext sql

    whereevent like 'enq: CI%'

    and o.obj# (+)= ash.current_obj#and sql.sql_id (+)= ash.sql_id

    order by sample_time;

    SQL_TEXT P2 P3 OBJ FILE# BLOCK#-------------------- ----- ------- ------------ ------ -------

    INSERT INTO TOTO1 VA 1 5 54225 TOTO1 6 682721

    #.54

    CI L k

  • 8/14/2019 ASDASVRRSDASD

    54/64

    Copyright 2006 Kyle Hailey

    CI Locks

    SQL_TEXT P2 P3---------------------------------------- --- --alter table XXXXX drop partition YYYYY 1 5

    ID1 = 2 " LGWR checkpointing and Hot Backup "

    ID2 = 5. "Used to queue up interested clients"

    If p2=1 and p3=5, then contention on blocks being

    checkpointed, try raising fast_start_mttr_target

    alter system set fast_start_mttr_target=600 scope=both;

    #.55

  • 8/14/2019 ASDASVRRSDASD

    55/64

    Copyright 2006 Kyle Hailey

    enq: CU - contention

    cursor bind

    From Jonathan Lewis:

    Protects the variable definitions while thecursor is being optimized.

    8i one CU per bind

    9i one CU per cursor

    #.56enq: HW - contention

  • 8/14/2019 ASDASVRRSDASD

    56/64

    Copyright 2006 Kyle Hailey

    enq: HW contention

    Data

    Empty

    High Water Mark

    Header

    Table

    Wait Event Parameter2 Parameter3

    enq: HW - contention table space # block

    Session 1

    Session 2

    Session 3

    #.57

    HW

  • 8/14/2019 ASDASVRRSDASD

    57/64

    Copyright 2006 Kyle Hailey

    HW

    Use Freelists Cause multiple jumps in High Water Mark

    Pre-Allocate ExtentsAlter table XXXX allocate extent;

    Hidden Parameter_bump_highwater_mark_count

    alter session set "_bump_highwater_mark_count"=100;

    Not supported

    ASSM

    Automatic segment space management

    Partition Object

    #.58HW Further Investigation

  • 8/14/2019 ASDASVRRSDASD

    58/64

    Copyright 2006 Kyle Hailey

    HW Further Investigation

    EVENT SQL_ID OBJ FILE# BLOCK#-------------------- ------------- ----------- ----- ------enq: HW - contention 49ch3jfkncnsp 53410 T1_I1 13 29734

    select

    event,

    sql_id,CURRENT_OBJ# || ' ' || name obj,CURRENT_FILE# file#,CURRENT_BLOCK# block#

    from v$active_session_history ash,obj$ o

    whereevent like 'enq: HW%'

    and o.obj# (+)= ash.current_obj#

    order by sample_time;

    #.59

  • 8/14/2019 ASDASVRRSDASD

    59/64

    Copyright 2006 Kyle Hailey

    enq: KO - fast object checkpoint

    Used when checking the cache for blocksfrom a table for PQO direct read

    #.60

    enq: RO fast object reuse

  • 8/14/2019 ASDASVRRSDASD

    60/64

    Copyright 2006 Kyle Hailey

    enq: RO - fast object reuse

    Drop or Truncate a tableWait for DBWR to clean cache

    Solution

    Smaller cache

    Tune DBWR using smaller MTTRUse GTT

    Truncate/drop less often

    SELECT TARGET_MTTR, ESTIMATED_MTTR,

    CKPT_BLOCK_WRITES

    FROM V$INSTANCE_RECOVERY

    alter system set fast_start_mttr_target=17 scope=both;

    #.61

  • 8/14/2019 ASDASVRRSDASD

    61/64

    Copyright 2006 Kyle Hailey

    enq: ST - contention

    Space Transaction management lock

    Space Transaction Lock

    Allocating/deallocating extentsDictionary Managed Tablespaces

    Id1, Id2 Combinations:Always 0, Always 0.

    SolutionGot to Locally Managed Tablespaces

    #.62

    Other Resources

  • 8/14/2019 ASDASVRRSDASD

    62/64

    Copyright 2006 Kyle Hailey

    Other Resources

    @?/rdbms/admin/utllockt

    WAITING_SESSION LOCK_TYPE MODE_REQUESTED MODE_HELD LOCK_ID1 LOCK_ID2

    --------------- ----------- -------------- --------- --------- --------

    144 None

    139 Transaction Share Exclusive 131113 7507

    #.63

    Blocking Sessions

  • 8/14/2019 ASDASVRRSDASD

    63/64

    Copyright 2006 Kyle Hailey

    Blocking Sessions

  • 8/14/2019 ASDASVRRSDASD

    64/64