비

오라클 lock 체크 스크립트

· 2007-06-29 (금) 17:54:54 · 4945
오라클에서 lock체크 스크립트 입니다.
작업 시간이 오래걸리는 spid 찾아주는 쿼리문 입니다.
 

select /*+ ordered / distinct /* 속도를 위해 v$sql을 조인할 경우 중복되는 레코드 제거 */
           s.sid SID, s.username, s.program, p.spid "OS-Pid",w.seconds_in_wait as "W_time(Sec)",
          decode(w.wait_time,0,'Wai-ting', 'Waited') Status, w.ename event,
--              p1text || ':' || decode(event,'latch free',p1raw, to_char(p1)) ||','||
--              p2text || ':' || to_char(p2) ||','|| p3text || ':' || to_char(p3) "Additional Info",
           q.sql_text
from ( select a.*, decode(a.event,'latch free', 'latch free (' ||b.name||')',
                                         'row cache lock', 'row cache lock (' || c.parameter || ')',
                                         'enqueue', 'enqueue ('||chr(bitand(p1, -16777216)/16777215)||
                                                                             chr(bitand(p1,16711680)/65535)||':'||
                                                decode(bitand(p1,65535), 1, 'N', 2, 'SS',3,'SX',4,'S',5,'SSX',6,'X') ||')',
                              a.event ) ename
           from v$session_wait a, v$latchname b, v$rowcache c
         where a.p2 = b.latch#(+) and a.p1 = c.cache#(+) and c.type(+) = 'PARENT'
           and a.event not in ('rdbms ipc message','smon timer','pmon timer','slave wait','pipe get','null event',
                                     'SQL*Net message from client', 'SQL*Net message to client','PX Idle Wait',
                                      'PX Deq: Execution Msg', 'KXFQ: kxfqdeq - normal deqeue',
                                         'ges remote message', 'wakeup time manager', /* idle event 적절히 수정 */
                                         'lock manager wait for remote message', 'single-task message')
        ) w, v$session s, v$process p, v$sql q
where w.sid = s.sid and s.paddr = p.addr
and s.sql_hash_value = q.hash_value(+) and s.sql_address = q.address(+)
order by w.ename;
[이 게시물은 관리자님에 의해 2011-10-31 16:47:36 Oracle에서 이동 됨]
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,187건
+
제목 글쓴이 날짜 조회
08-11-25 조회 3,763
08-11-25 조회 2,956
08-11-25 조회 4,531
08-11-25 조회 4,405
08-11-21 조회 4,385
08-11-21 조회 5,313
08-11-20 조회 3,941
08-11-20 조회 3,754
08-11-19 조회 4,021
08-11-19 조회 4,261
08-11-18 조회 4,044
08-11-15 조회 2,921
08-11-14 조회 3,224
08-11-14 조회 2,890
08-11-14 조회 3,283
08-11-13 조회 3,909
08-11-12 조회 1만
08-11-07 조회 4,610
08-11-07 조회 5,595
08-11-03 조회 3,362
08-11-01 조회 5,076
08-11-01 조회 3,029
08-10-30 조회 2,738
08-10-30 조회 3,669
08-10-30 조회 2,764
08-10-30 조회 3,000
08-10-30 조회 2,864
08-10-29 조회 3,945
08-10-29 조회 2,926
08-10-29 조회 2,459
08-10-20 조회 2,590
08-10-18 조회 4,538
08-10-16 조회 3,594
08-10-16 조회 3,397
08-10-14 조회 2,599
08-10-11 조회 3,900
08-10-11 조회 2,495
08-10-09 조회 2,592
08-10-09 조회 2,749
08-10-09 조회 4,215
08-10-08 조회 3,911
08-10-02 조회 3,851
08-10-02 조회 2,598
08-10-02 조회 2,746
08-09-29 조회 4,677
08-09-29 조회 4,306
08-09-26 조회 5,619
08-09-26 조회 3,592
08-09-26 조회 3,659
08-09-26 조회 2,806
08-09-26 조회 3,844
08-09-26 조회 3,582
08-09-26 조회 4,344
08-09-22 조회 3,905
08-09-22 조회 3,090
08-09-22 조회 4,057
08-09-22 조회 3,018
08-09-22 조회 2,666
08-09-21 조회 3,654
08-09-20 조회 4,236
08-09-20 조회 5,507
08-09-20 조회 4,602
08-09-20 조회 2,927
08-09-20 조회 3,324
08-09-20 조회 3,690
08-09-20 조회 3,066
08-09-20 조회 3,256
08-09-20 조회 4,241
08-09-20 조회 3,741
08-09-20 조회 3,322
08-09-19 조회 5,718
08-09-19 조회 4,493
08-09-19 조회 2,807
08-09-18 조회 5,158
08-09-18 조회 4,238
08-09-18 조회 3,613
08-09-18 조회 2,809
08-09-18 조회 3,724
08-09-18 조회 3,516
08-09-17 조회 3,384
08-09-16 조회 3,331
08-09-10 조회 2,544
08-09-09 조회 3,342
08-09-06 조회 4,233
08-09-06 조회 2,795
08-09-06 조회 3,163
08-09-06 조회 2,825
08-09-06 조회 3,055
08-09-06 조회 2,943
08-09-06 조회 2,915
08-09-05 조회 3,913
08-09-05 조회 3,740
08-09-05 조회 3,567
08-09-05 조회 2,787
08-09-05 조회 3,813
08-09-05 조회 5,775
08-09-05 조회 4,233
08-09-05 조회 3,120
08-09-05 조회 3,275
08-09-05 조회 4,702