转载

ORA-01000

今天我也遇见了这个问题
有个概念一定要记牢,就是show parameter open_cursors这个参数是指每个session,包含递归的cursor能打开的最大游标数

按照session 查看打开游标数,跟open_cursor对比

点击(此处)折叠或打开

  1. SELECT SID, COUNT(*) FROM V$OPEN_CURSOR GROUP BY SID ORDER BY 2 DESC


按用户查看打开游标的情况

点击(此处)折叠或打开

  1. SELECT S.USERNAME, O.SID, O.CURSOR_CNT
  2.   FROM (SELECT SID, COUNT(*) AS CURSOR_CNT FROM V$OPEN_CURSOR GROUP BY SID) O,
  3.        V$SESSION S
  4.  WHERE S.SID = O.SID
  5.    AND S.USERNAME IS NOT NULL ORDER BY 1
按照SQL id打开游标排序

点击(此处)折叠或打开

  1. SELECT O.*, S.USERNAME
  2.   FROM (SELECT SQL_ID,
  3.                SQL_TEXT,
  4.                SID,
  5.                COUNT(1) OVER(PARTITION BY SQL_ID) AS CURSOR_CNT
  6.           FROM V$OPEN_CURSOR) O,
  7.        V$SESSION S
  8.  WHERE O.SID = S.SID
  9.    AND USERNAME IS NOT NULL ORDER BY 4 DESC
使用比例

点击(此处)折叠或打开

  1. SELECT 'session_cached_cursors' PARAMETER,
  2.        LPAD(VALUE, 5) VALUE,
  3.        DECODE(VALUE, 0, ' n/a', TO_CHAR(100 * USED / VALUE, '990') || '%') USAGE
  4.   FROM (SELECT MAX(S.VALUE) USED
  5.           FROM V$STATNAME N, V$SESSTAT S
  6.          WHERE N.NAME = 'session cursor cache count'
  7.            AND S.STATISTIC# = N.STATISTIC#),
  8.        (SELECT VALUE FROM V$PARAMETER WHERE NAME = 'session_cached_cursors')
  9. UNION ALL
  10. SELECT 'open_cursors',
  11.        LPAD(VALUE, 5),
  12.        TO_CHAR(100 * USED / VALUE, '990') || '%'
  13.   FROM (SELECT MAX(SUM(S.VALUE)) USED
  14.           FROM V$STATNAME N, V$SESSTAT S
  15.          WHERE N.NAME IN
  16.                ('opened cursors current', 'session cursor cache count')
  17.            AND S.STATISTIC# = N.STATISTIC#
  18.          GROUP BY S.SID),
  19.        (SELECT VALUE FROM V$PARAMETER WHERE NAME = 'open_cursors')
session_cached_cursor是与ora 01000没有什么直接关系,出现ora 01000你就别想了


正文到此结束
Loading...