Rain 2019-05-28
当我们接触一个新的数据库时,怎么去了解数据库游标的使用情况呢?下面分享几个脚本帮助我们获取这些信息。
SELECT MAX(A.VALUE) AS HIGHEST_OPEN_CUR, P.VALUE AS MAX_OPEN_CUR FROM V$SESSTAT A, V$STATNAME B, V$PARAMETER P WHERE A.STATISTIC# = B.STATISTIC# AND B.NAME = 'opened cursors current' AND P.NAME = 'open_cursors' GROUP BY P.VALUE;
select SID, sql_id, sql_text, cursor_type, count(*) from v$open_cursor O where o.user_name = 'GZCSS_GZBH_APP' GROUP BY O.SID, O.SQL_ID, O.CURSOR_TYPE, O.SQL_TEXT ORDER BY 5 DESC;
select o.sid, q.sql_text from v$open_cursor o, v$sql q where q.hash_value = o.hash_value and o.sid = 214;
后面会分享更多devops和DBA方面的内容,感兴趣的朋友可以关注下!