Oracle displays the SQL statements in which logical and physical read resources are ranked

Source: Internet
Author: User

Oracle displays the SQL statements in which logical and physical read resources are ranked

View the SQL statements before the first 10 logical reads:

Copy codeThe Code is as follows:
Set linesize 300;
Set pagesize 300;
Set long 50000;
SELECT *
FROM (
SELECT SQL _fulltext AS SQL, SQL _ID, buffer_gets/executions AS "Gets/Exec", buffer_gets, executions
From v $ SQLAREA
WHERE buffer_gets> 10000
Order by "Gets/Exec" DESC
)
WHERE rownum <= 10;

View the top 10 SQL statements for physical reads:

Copy codeThe Code is as follows:
Set linesize 300;
Set pagesize 300;
Set long 50000;
SELECT *
FROM (
SELECT SQL _fulltext AS SQL, SQL _ID, disk_reads/executions AS "Reads/Exec", disk_reads, executions
From v $ SQLAREA
WHERE disk_reads> 1000
Order by "Reads/Exec" DESC
)
WHERE rownum <= 10;


Oracle often needs to count the logical read and physical read information of each session. It is inconvenient to directly use SQL. It is necessary to design a program to simplify viewing a session.

Select t. SID, n. NAME, t. VALUE
From v $ sesstat t, v $ statname n
Where t. STATISTIC # = n. STATISTIC #
And n. STATISTIC # in (9, 54)
And t. SID = & sid
 
How to find SQL statements that occupy a large amount of resources in oracle

Find the top 10 SQL statements with poor performance.
SELECT * FROM
(
SELECT PARSING_USER_ID
EXECUTIONS,
SORTS,
COMMAND_TYPE,
DISK_READS,
SQL _text
FROM v $ sqlarea
Order by disk_reads DESC
)
Where rownum <10;

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.