SQL statement for querying the active cursor count of an ORACLE Database

Source: Internet
Author: User

The number of active cursor cursqueries SQL [SQL] www.2cto.com select allcursor all cursors, MYALLCURSOR my cursnumber, myopencursor I open cursnumber, MYCACHECURSOR my SESSION cache cursnumber, (MYALLCURSOR-MYOPENCURSOR-MYCACHECURSOR) Number of my other cursfrom (select count (*) from v $ OPEN_CURSOR A) ALLCURSOR, (select count (*) from v $ OPEN_CURSOR a where. USER_NAME = 'telsoft _ R_01 ') MYALLCURSOR, (select sum (AA. VALUE) FROM (select. value from v $ sesstat a, V $ statname B, V $ SESSION S WHERE. STATISTIC # = B. STATISTIC # and s. SID =. sid and B. NAME = 'session cursor cache count' and s. USERNAME = 'telsoft _ R_01 ') AA) MYCACHECURSOR, (select sum (AA. VALUE) FROM (select. value from v $ sesstat a, V $ statname B, V $ SESSION S WHERE. STATISTIC # = B. STATISTIC # and s. SID =. sid and B. NAME = 'opened cursors current 'and s. USERNAME = 'telsoft _ R_01 ') AA) myopencursor from dual); -- query the total number of open cursors of each user (including cache cursors) select. USER_NAME, COUNT (*) Total number of open cursors for each user from v $ OPEN_CURSOR a group by. USER_NAME; -- query the number of cache cursors of each database user terminal. select aa. USERNAME, AA. MACHINE, SUM (AA. VALUE) Number of cached cursors FROM (select. VALUE, S. MACHINE, S. username from v $ sesstat a, V $ statname B, V $ SESSION S WHERE. STATISTIC # = B. STATISTIC # and s. SID =. sid and B. NAME = 'session cursor cache count') aa group by aa. USERNAME, AA. machine order by aa. USERNAME, AA. MACHINE; -- find the number of open cursors for each terminal of the database user select aa. USERNAME, AA. MACHINE, SUM (AA. VALUE) Open the number of cursors FROM (select. VALUE, S. MACHINE, S. username from v $ sesstat a, V $ statname B, V $ SESSION S WHERE. STATISTIC # = B. STATISTIC # and s. SID =. sid and B. NAME = 'opened cursors current ') aa group by aa. USERNAME, AA. machine order by aa. USERNAME, AA. MACHINE;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.