|
ORA-01000: maximum open cursors exceeded
JDBC ÄÚµù½Ã 'Ãִ뿱â Ä¿¼¼ö¸¦ ÃÊ°úÇß½À´Ï´Ù'
java.sql.SQLException: ORA-01000: ÃÖ´ë ¿±â Ä¿¼ ¼ö¸¦ ÃÊ°úÇß½À´Ï´Ù
(maximum open cursors exceeded)
°¡²û JDBCÇÁ·Î±×·¥½Ã À§ÀÇ ¿¡·¯°¡ ¹ß»ýÇÏ´Â °æ¿ì¸¦ °æÇèÇß½À´Ï´Ù.
À§ ¿¡·¯´Â PreparedStatement³ª Statement¸¦ »ç¿ëÇÏ°í close()¸¦ ÇÏÁö ¾Ê¾Æ¼ ..
¿À¶óŬ ÇÁ·Î¼¼½º´ç Ä¿¼¼ö°¡ Áõ°¡µÇ¾î¼ ¹ß»ýÇÏ´Â ¿¡·¯ÀÔ´Ï´Ù.
º¸Åë À§¿¡ ORA-01000 ¿¡·¯°¡ ¹ß»ýÇÏ¸é »ç¿ëÇÏ´Â Æ®·£Àè¼Ç Å×ÀÌºí¿¡ LockÀÌ °É¸± È®·üÀÌ ³ô½À´Ï´Ù.
¿À¶óŬ ÀÔÀå¿¡¼ ORA-01000 ¿¡·¯¸¦ ¸ð´ÏÅ͸µ ÇÏ´Â ¹æ¹ýÀ» ¼Ò°³ ÇÒ·Á°í ÇÕ´Ï´Ù.
# ¿À¶óŬ ÇÁ·Î¼¼½º´ç Ä¿¼¼ö¸¦ ¾Æ·¡¿Í °°ÀÌ È®ÀÎÇØ º¼ ¼ö ÀÖ½À´Ï´Ù.
SELECT sid, count(sid) "cursor"
FROM V$OPEN_CURSOR
WHERE user_name = 'SCOTT'
GROUP BY sid
ORDER BY cnt DESC
SID cursor
---------- ----------
70 379
42 307
67 172
88 19
48 15
46 7
87 7
18 6
60 6
86 6
77 6
Æ®·£Àè¼ÇÀ̳ª µ¿½Ã Á¢¼ÓÀÚ¿¡ µû¶ó ¸¹ÀÌ Æ²¸®Áö¸¸ ¿À¶óŬ cursor¼ö°¡ 100°³°¡ ³Ñ´Â ¼¼¼Ç¿¡¼
»ç¿ëÇÏ°í ÀÖ´Â SQL¹®ÀåÀº ÀǽÉÀ» ÇغÁ¾ß ÇÕ´Ï´Ù.
(ÀϹÝÀûÀÎ »çÀÌÆ®¿¡¼´Â 20°³¸¸ ³Ñ¾îµµ ÀǽÉÇØ ºÁ¾ß ÇÕ´Ï´Ù.)
±× SQL¹®ÀåÀ» ã¾Æ¼ JAVA¿¡¼ JDBC¸¦ ÀÌ¿ëÇؼ ÄÚµùÇÑ ºÎºÐÀ» ã¾Æ º¸¸é
PreparedStatement¸¦ »ç¿ëÇÏ°í close()¸¦ ÇØÁÖÁö ¾Ê´Â ºÎºÐÀÌ ÀÖ½À´Ï´Ù..
¾Æ·¡ÀÇ SQL¹®À¸·Î ÇöÀç ½ÇÇàÁßÀÎ SQL¹®ÀÌ »ç¿ëÇÏ´Â Ä¿¼¸¦ È®ÀÎÇØ º¼ ¼ö ÀÖ½À´Ï´Ù.
# SQL¹®´ç »ç¿ëÇÏ´Â Ä¿¼¼ö
SELECT sql_text, count(sid) cnt
FROM v$OPEN_CURSOR
GROUP BY sql_text
ORDER BY cnt DESC
SQL_TEXT CNT
------------------------------------------------------------ ----------
INSERT INTO ACCEPTANCELOG ( ACCEPTYEAR , ACCEPTL 90
SELECT INSTR(:b3, :b2,1, :b1) FROM DUAL 9
SELECT INSTR(:b3, :b2,1, :b1+1) FROM DUAL 9
SELECT companionname FROM accept_companion WHERE acceptyea 9
select count(*) seq from companion where passid = :1 an 7
SELECT a.appealname,a.appealpin, a.passid, a.passseq, 7
ÀÌ·¸°Ô Ä¿¼ÀÇ ¼ö°¡ ¸¹Àº ù¹ø° SQL¹®À» JAVA¿¡¼ ÄÚµùÇÑ ºÎºÐÀ» ã¾Æ º¸¸é
PreparedStatement°¡ close()µÇÁö ¾Ê¾ÒÀ» È®·üÀÌ ³ô½À´Ï´Ù.
ƯÈ÷ for¹®À̳ª while¹®µîÀÇ Loop¹®¿¡¼ PreparedStatement¸¦ »ç¿ëÇÏ´Â ºÎºÐÀ» À¯½ÉÈ÷ ºÁ¾ß ÇÕ´Ï´Ù.
# ¿À¶óŬ ÇÁ·Î¼¼½ºÀÇ Á¤º¸´Â ¾Æ·¡ÀÇ SQL¹®À¸·Î È®ÀÎÇØ º¼ ¼ö ÀÖ½À´Ï´Ù.
SELECT /*+ rule */
s.status "Status", s.serial# "Serial#", s.TYPE "Type",
s.username "DB User", s.osuser "Client User", s.server "Server",
s.machine "Machine", s.module "Module", s.terminal "Terminal",
s.program "Program", p.program "O.S. Program",
s.logon_time "Connect Time", lockwait "Lock Wait",
si.physical_reads "Physical Reads", si.block_gets "Block Gets",
si.consistent_gets "Consistent Gets",
si.block_changes "Block Changes",
si.consistent_changes "Consistent Changes", s.process "Process",
p.spid, p.pid, s.serial#, si.sid, s.sql_address "Address",
s.sql_hash_value "Sql Hash", s.action
FROM v$session s, v$process p, sys.v_$sess_io si
WHERE s.paddr = p.addr(+)
AND si.sid(+) = s.sid
AND s.username IS NOT NULL
AND NVL (s.osuser, 'x') <> 'SYSTEM'
AND s.TYPE <> 'BACKGROUND'
ORDER BY 3
# '¿À¶óŬ ÇÁ·Î¼¼½º ÃÊ°ú ¿¡·¯'
java.sql.SQLException: ORA-00020: maximum number of processes (100)
ÀÌ ¿¡·¯´Â JDBC¸¦ ÀÌ¿ëÇؼ ¿À¶óŬ°ú ¿¬°áÀ» ÇÒ ¶§ Ãʺ¸ÀÚµéÀÌ ÈçÈ÷ ¹üÇÒ¼ö ÀÖ´Â
¿À·ùÁß¿¡ Çϳª ÀÔ´Ï´Ù.
ÀÌ ¿¡·¯°¡ ¹ß»ýÇÏ´Â ¿øÀÎÀº JDBCÀÇ ConnectionÀ» »ç¿ëÇÏ°í close()¸¦ ÇØÁÖÁö ¾Ê¾Æ¼ ¹ß»ýÀ» ÇÕ´Ï´Ù.
close¸¦ ÇØÁÖÁö ¾Ê¾Æ ¿À¶óŬ ÇÁ·Î¼¼½º°¡ °è¼Ó Áõ°¡ÇÏ´Ù°¡ °á±¹¿£ init.oraÆÄÀÏÀÇ processesÆĶó¹ÌÅÍ¿¡¼
Á¤ÇÑ ÇÁ·Î¼¼½º °³¼ö¸¦ ÃÊ°úÇؼ ¹ß»ýÇÏ°Ô µË´Ï´Ù.
Oracle¿¡¼ µ¿½Ã¿¡ ÃÖ´ë·Î OpenÇÒ ¼ö ÀÖ´Â java.sql.Connection ¼ö´Â
$ORACLE_HOME/pfile/init.ora ¿¡¼ processes ÆĶó¹ÌÅÍ¿¡¼ ÁöÁ¤À» ÇÕ´Ï´Ù.
processes=150
¿¡·¯°¡ ¹ß»ýÇϸé processesÀÇ ÇÁ·Î¼¼½º ¼ö¸¦ Áõ°¡½ÃÅ°´Â °Íº¸´Ù´Â
JAVA¼Ò½º¿¡¼ ConnectionÀ» »ç¿ëÇÏ´Â ºÎºÐ¿¡¼ close()¸¦ Çß´ÂÁö È®ÀÎÇØ ºÁ¾ß ÇÕ´Ï´Ù.
from : http://www.oracleclub.com/
|