Skip to content

Instantly share code, notes, and snippets.

@ryaz
Last active August 29, 2015 14:16
Show Gist options
  • Select an option

  • Save ryaz/035a17732996567c9fc0 to your computer and use it in GitHub Desktop.

Select an option

Save ryaz/035a17732996567c9fc0 to your computer and use it in GitHub Desktop.
oracle sys_dba stuff
### Open cursors
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;
### Find out the session that is causing the error by using the following SQL statement:
select a.value, s.username, s.sid, s.serial#
from v$sesstat a, v$statname b, v$session s
where a.statistic# = b.statistic# and s.sid=a.sid
and b.name = 'opened cursors current'
and s.username is not null;
### To display which queries are causing maxing out of open cursors, run the following SQL statement:
select sid, sql_text, USER_NAME from v$open_cursor where sid in ($SID);
### set max cursors
alter system set open_cursors = 1000 scope=both;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment