1 ¿´ÏÖÔÚµÄÁ¬½ÓÊý
select count(*) from gv$session;
2.1 Ö´ÐеÄsql
select gs.inst_id,
gs.SID,
gvs.sql_text,
gs.SERIAL#,
gs.STATUS,
gs.EVENT,
gs.WAIT_CLASS,
gs.WAIT_TIME,
gs.SECONDS_IN_WAIT,
p.spid,
gs.logon_time
from gv$process p, gv$session gs
left join gv$sql gvs
on gs.sql_id = gvs.sql_id
where gs.PROGRAM = 'JDBC Thin Client'
and gs.paddr = p.ADDR;
˵Ã÷£º
1)State×Ö¶ÎÓÐËÄÖÖº¬Òå©s
(1)Waiting£ºSESSIONÕýµÈ´ýÕâ¸öʼþ¡£
(2)Waited unknown time£ºÓÉÓÚÉèÖÃÁËtimed_statistics值Ϊfalse£¬µ¼Ö²»Äܵõ½Ê±¼äÐÅÏ¢¡£±íʾ·¢ÉúÁ˵ȴý£¬µ«Ê±¼äºÜ¶Ì¡£
(3)Wait short time£º±íʾ·¢ÉúÁ˵ȴý£¬µ«ÓÉÓÚʱ¼ä·Ç³£¶Ì²»³¬¹ýÒ»¸öʱ¼äµ¥Î»£¬ËùÒÔûÓмǼ¡£
(4)Waited knnow time£ºÈç¹ûsessionµÈ´ýÈ»ºóµÃµ½ÁËËùÐè×ÊÔ´£¬ÄÇô½«´Ówaiting½øÈ뱾״̬¡£
2).Wait_time值Ò²ÓÐËÄÖÖº¬Ò壺
(1)值>0£º×îºóÒ»´ÎµÈ´ýʱ¼ä(µ¥Î»£º10ms)£¬µ±Ç°Î´Ôڵȴý״̬¡£
(2)值=0£ºsessionÕýÔڵȴýµ±Ç°µÄʼþ¡£
(3)值=-1£º×îºóÒ»´ÎµÈ´ýʱ¼äСÓÚ1¸öͳ¼Æµ¥Î»£¬µ±Ç°Î´Ôڵȴý״̬¡£
(4)值=-2£ºÊ±¼äͳ¼Æ״̬δÖÃΪ¿ÉÓ㬵±Ç°Î´Ôڵȴý״̬¡£
3).Wait_timeºÍSecond_in_wait×Ö¶Î值ÓëstateÏà¹Ø:
(1)Èç¹ûstate值ΪWaiting£¬ÄÇôwait_time值ÎÞÓá£Second_in_wait值ÊÇʵ¼ÊµÄµÈ´ýʱ¼ä(µ¥Î»£ºÃë)¡£
(2)Èç¹ûstate值ΪWait unknow time£¬ÄÇôwait_time值ºÍSecond_in_wait值¶¼ÎÞÓá£
(3)Èç¹ûstate值ΪWait short time£¬ÄÇôwait_time值ºÍSecond_in_wait值¶¼ÎÞÓá£
(4)Èç¹ûstate值ΪWaiting known time£¬ÄÇôwait_time值¾ÍÊÇʵ¼ÊµÈ´ýʱ¼ä(µ¥Î»£ºÃë)£¬Second_in_wait值ÎÞÓá£