|
¾÷¹«½Ã°£´ë¿¡ ½Ã½ºÅÛÀÌ °©Àڱ⠴À·ÁÁ³´Ù¸é¼ ¿ì¼± ¾Æ·¡ÀÇ SQLÀ» ¼öÇà½ÃÄѺ»´Ù.
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;
SQLÀÇ ±¸Ã¼ÀûÀÎ ³»¿ëÀÌ¾ß ÇÊ¿äÇÑ Á¤º¸¿Í °³ÀÎÀû ÃëÇâ¿¡ µû¶ó ´Þ¶óÁö°ÚÁö¸¸, Áß¿äÇÑ °ÍÀº ÀÏ´Ü V$SESSION_WAIT ºä·ÎºÎÅÍ ½Ç½Ã°£ Wait Event Á¤º¸¸¦ ¾ò¾î³½´Ù´Â °ÍÀÌ´Ù. À§ SQLÀ» ¼öÇàÇßÀ» ¶§ ³ªÅ¸³ª´Â °á°ú°¡ ¾ø´Ù¸é ÀÏ´Ü ¿À¶óŬ Ãø¸é¿¡¼ ¾÷¹«¼º´ÉÀ» ½É°¢ÇÏ°Ô ¸¶ºñ½ÃÅ°´Â WaitingÀÌ ¹ß»ýÇÏ°í ÀÖÁö ¾Ê´Ù°í ºÁµµ Å« ¹«¸®°¡ ¾øÀ» °ÍÀÌ´Ù.
ÀϹÝÀûÀÎ »óÅ¿¡¼´Â ÁÖ·Î 'db file sequential read'³ª 'db file scattered read' °¡ ³ªÅ¸³¯ ÅÙµ¥, ÀÌ·¯ÇÑ Wait Event´Â º¸Åë ªÀº ½Ã°£ µ¿¾È Áö¼ÓµÇ¸ç ´ë»ó ÀÚ¿ø(ºí·Ï)À» ¹Ù²ã°¡¸ç Wait°¡ ¹Ýº¹µÇ´Â ÇüÅ·Π³ªÅ¸³¯ °ÍÀÌ´Ù. ÀÌ´Â ÀÛ¾÷ 󸮷®ÀÌ ¸¹À» ¶§ ÀÏ»óÀûÀ¸·Î ¹ß»ýÇÏ´Â IO°ü·Ã Wait EventÀ̹ǷΠÇØ´ç ¼¼¼Ç¿¡¼ IO¸¦ Á¦¹ý ¸¹ÀÌ À¯¹ßÇÏ°í ÀÖ´Ù´Â Á¤µµ·Î ÀÌÇØÇÏ°í ³Ñ¾î°¡¸é µÉ °ÍÀÌ´Ù. ¹°·Ð, WaitÀÇ Áö¼Ó½Ã°£ÀÌ ±æ°Å³ª Áö³ªÄ¡°Ô ºó¹øÈ÷ ³ªÅ¸³ª´Â SQL¿¡ ´ëÇؼ´Â ºñÈ¿À²ÀûÀÎ ½ÇÇà°èȹÀ» ¼ö¸³ÇÏ°í ÀÖÁö ¾ÊÀºÁö °ËÅäÇؼ Æ©´×ÇØ ÁÖ¾î¾ß ÇÑ´Ù.
¼º´ÉÀúÇÏÀÇ ¿øÀÎÀÌ ¿À¶óŬ ÂÊ¿¡ ÀÖ´Â °æ¿ì¿¡´Â ƯÁ¤ ÀÚ¿ø¿¡ ´ëÇÑ WaitingÀÌ »ó´çÈ÷ ¿À·§µ¿¾È Áö¼ÓµÇ¾î ÇöÀç±îÁö WaitingÀÌ ÁøÇà ÁßÀÎ ¼¼¼Çµé(STATUS°¡ 'Wai-ting' (wait_time=0)À̸ç 'W_time(sec)' (seconds_in_wait) °ªÀÌ »ó´çÈ÷ Å« ¼¼¼Ç)ÀÌ Á¸ÀçÇÒ °¡´É¼ºÀÌ ³ô´Ù. ¿À¶óŬÀÇ ³»ºÎÀûÀÎ ÀÛ¾÷µéÀº ¸Å¿ì ªÀº ±â°£¿¡ 󸮵Ǿî¾ß ÇϹǷÎ, Idle event(whereÀý¿¡¼ not inÀ¸·Î ó¸®ÇÑ ºÎºÐ, ¹öÀü¿¡ µû¶ó ´Þ¶óÁú ¼ö ÀÖ´Ù.) ÀÌ¿ÜÀÇ Æ¯Á¤ Wait Event°¡ ´«¿¡ ¶é Á¤µµ·Î °ËÃâµÈ´Ù´Â °ÍÀº ¿À¶óŬ ³»ºÎÀûÀ¸·Î´Â ÈξÀ ´õ ¸¹Àº WaitingÀÌ ¹ß»ýÇÏ°í ÀÖ´Ù°í »ý°¢ÇØ¾ß ÇÑ´Ù. ¹Ù·Î ÀÌ·± ¼¼¼ÇµéÀÌ ¹®Á¦ÀÇ ¹üÀεéÀ̸ç ÀÌÁ¦ºÎÅÍ DBA´Â À̵é Wait Event¿¡ ´ëÇÑ ¿øÀÎÀ» ÆľÇÇÏ¿© Á¶Ä¡ÇÏ´Â ÀÛ¾÷À» ÇØÁÖ¾î¾ß ÇÑ´Ù. °¢°¢ÀÇ Wait Event¿¡ µû¶ó ¿øÀÎÀ» ÃßÀûÇÏ°í Á¶Ä¡ÇÏ´Â ¹æ¹ýÀº ´Þ¶óÁú °ÍÀÌ´Ù.
|