手動模擬獲取latch

手動模擬獲取latch

隨意dump一個latches結構文件:
SQL> oradebug dump latches 10
ORA-00074: no process has been specified
SQL> oradebug setmypid
Statement processed.
SQL> oradebug dump latches 10
Statement processed.
SQL> oradebug tracefile_name
/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_5564.trc

找到文件並隨便找一個latch地址查看:
我們這裏找的是地址爲0x60019d98的一個active checkpoint queue,當前狀態爲free:
60019d98  active checkpoint queue latch level=5
        Location from where latch is held: kcbk.h LINE:2222 ID:kcbbacq: scan active checkpoints:
        Context saved from call: 0
        state=free [value=0] wlstate=free [value=0]
    gotten 2345 times wait, failed first 0 sleeps 0
    gotten 0 times nowait, failed: 0

通過oradebug驗證:
SQL> oradebug peek 0x60019d98 8
[060019D98, 060019DA0) = 00000000 00000000   
該latch的當前值爲0,確爲free狀態,我將它值修改爲1:
SQL> oradebug poke 0x60019d98 2 1
BEFORE: [060019D98, 060019D9C) = 00000000
AFTER:  [060019D98, 060019D9C) = 00000001
再次dump一個latches結構文件,並找到上述latch的信息:
60019d98  active checkpoint queue latch level=5
        Location from where latch is held: kcbk.h LINE:2222 ID:kcbbacq: scan active checkpoints:
        Context saved from call: 0
        state=busy [holder orapid=1] wlstate=free [value=0]
    waiters [orapid (seconds since: put on list, posted, alive check)]:
     10 (30, 1402142587, 30)
     waiter count=1
    gotten 2607 times wait, failed first 0 sleeps 0
    gotten 0 times nowait, failed: 0
此時狀態爲busy。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章