Top 30 I/Os on your SAP System

Top 30 I/Os on your SAP System

Sometimes it is worth identifying the top few SQL statements working on your SAP system. Fine-tuning these SQL statement have done wonders for the performance of our systems. Try executing the attached script on your development system with Oracle before taking it to your productive system.
To be executed under SQLPLUS with user INTERNAL:
SQL Code :
==========
-- Top 30 I/o Intesive SQL Statements Identification : top30IO.sql
set linesize 80
set pagesize 58
set heading  on
set serveroutput on

spool top30iosql.txt

declare
        cursor curs1 is
              from v$sqlarea order by disk_reads / decode(executions,0,1,executions) desc;
        stmnt_ctr number(3);
        wrt1 number(3);

begin
        dbms_output.enable(50000);
              exit;
           end if;

:q!
ie0107:oraipd> cat top30iosql.sql
-- Top 30 I/o Intesive SQL Statements Identification : top30iosql.sql
set linesize 80
set pagesize 58
set heading  on
set serveroutput on

spool top30iosql.txt

declare
        cursor curs1 is
              select executions, disk_reads, buffer_gets, first_load_time, sql_text
              from v$sqlarea order by disk_reads / decode(executions,0,1,executions) desc;
        stmnt_ctr number(3);
        wrt1 number(3);

begin
        dbms_output.enable(50000);
        stmnt_ctr := 0;

        for inrec in curs1 loop
           stmnt_ctr := stmnt_ctr + 1;
           if stmnt_ctr >= 31 then
              exit;
           end if;

           dbms_output.put_line('--------------------------------------'

    Requires Free Membership to View

    When you register, you will start receiving targeted emails from my award-winning team of editorial writers. Our goal is to keep you informed on the hottest topics and biggest challenges faced by SAP professionals today.

    Hannah Smalltree, Editorial Director

    By submitting your registration information to SearchSAP.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchSAP.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

|| '--------------------------------------'); dbms_output.put_line('SQL Stmnt Number: ' || to_char(stmnt_ctr)); dbms_output.put_line('--------------------------------------' || '--------------------------------------'); dbms_output.put_line('Executions : ' || to_char(inrec.executions)); dbms_output.put_line('Disk Reads : ' || to_char(inrec.disk_reads) || ' Buffer Gets : ' || to_char(inrec.buffer_gets)); dbms_output.put_line('First Load Time: ' || inrec.first_load_time); dbms_output.put_line('SQL Statement-------->'); wrt1 := 1; while wrt1 <= ceil(length(inrec.sql_text) / 72) loop dbms_output.put_line('.....' || substr(inrec.sql_text,((wrt1-1)*72)+1,72)); wrt1 := wrt1 + 1; end loop; dbms_output.put_line('--------------------------------------' || '--------------------------------------'); dbms_output.put_line(' '); end loop; end; / spool off set serveroutput off set termout on
Now edit/view the output file top30iosql.txt in suitable viewer of your O/S and do the fine tuning from there. Good luck!

This was first published in September 2003

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.