Top SQL's vs. Longops

I'm trying to understand the difference vs TOP SQL statement vs. what is showing up in the longops table. I pull a report showing my top 25 SQL statements but yet when I look at the long ops table the statements taking more this 1 minute are different then what shows up as my top SQL.
What should I be spending my time tuning whats in the long ops or my top SQL statements?

Top sql shows in the statspack or AWR report shows the top sql during the time period for which you run the report.
e.g if you run report for 4-5 pm,it will show the sql which consumes most resources(CPU,gets,reads etc)
V$session_longops This view displays the status of various operations that run for longer than 6 seconds (in absolute time). These operations currently include many backup and recovery functions, statistics gathering, and query execution, and more
operations are added for every Oracle release."You can also set rows in this view using the procedure dbms_application_info.set_session_longops"
By Jonatan Lewis
sqlexecprogression_cost with the description: "sql execution progression monitoring cost threshold" and the default value of 1,000
cost = 1000 equates to elapsed time = 6 seconds

Similar Messages

  • Top SQL by DB user in Oracle 10g DB Console

    Is there a way to filter Top SQLs on 10g DB Console by a specific DB User? I know you can get all the SQLs by a specific user from Search Sessions, but it doesn't rank them by CPU usage. Any help is greatly appreciated.

    nice idea, because SQL itself doesn't contain info about session executing it.
    See Top SQL/Consumers
    in OEM 10: goto Perfomance - Top Activity - here you can see Top SQLs (left side) and Top Sessions (right side) and ! if click on SQL ID from Top SQL you can see sessions executing it on Activity page.

  • Bug running Report 'Top SQL by Waits'

    When I open Report 'Top SQL by Waits' in 'All Reports', 'Database Administration', 'Top SQL' I get an error message:
    *'No query found for version of the selected database'*
    After clicking OK and entering e.g. '30' for the bind variable 'minutes' I get
    'ORA-00904': "SQL_ID": invalid identifier ....
    It seems that there is no such report defined for Oracle 9.
    I tried to start the report using versions 1.5.5 and 2.1.0.63 getting the same error message
    Versions:
    SQL Developer: Version 2.1.1.64
    Build MAIN-64.39
    I am on WIN XP SP3
    Database is:
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    PL/SQL Release 9.2.0.8.0 - Production
    "CORE     9.2.0.8.0     Production"
    TNS for IBM/AIX RISC System/6000: Version 9.2.0.8.0 - Production
    NLSRTL Version 9.2.0.8.0 - Production

    When I open Report 'Top SQL by Waits' in 'All Reports', 'Database Administration', 'Top SQL' I get an error message:
    *'No query found for version of the selected database'*
    After clicking OK and entering e.g. '30' for the bind variable 'minutes' I get
    'ORA-00904': "SQL_ID": invalid identifier ....
    It seems that there is no such report defined for Oracle 9.
    I tried to start the report using versions 1.5.5 and 2.1.0.63 getting the same error message
    Versions:
    SQL Developer: Version 2.1.1.64
    Build MAIN-64.39
    I am on WIN XP SP3
    Database is:
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    PL/SQL Release 9.2.0.8.0 - Production
    "CORE     9.2.0.8.0     Production"
    TNS for IBM/AIX RISC System/6000: Version 9.2.0.8.0 - Production
    NLSRTL Version 9.2.0.8.0 - Production

  • Top sql in java enterprise manager 10G

    i,
    in the java enterprise manager 9i, I could use 'top sql', 'top sessions' from the java applications.
    I recently installed 10G enterprise manager client, and I now miss the top sql and top sessions apps.
    I know that they are available in the web interface for enterprise manager 10G, but I can't use the webinterface right now. I would like to use the standalone java enterprise manager. How can I get the top sql in there?
    Greetings,
    Ivo

    anybody?

  • Sql for top sql

    Dear DBAs
    Application team has asked me to provide TOP Sql statements in testing database which can help them to improve code. Developer gave OEM top sql example from his last job.
    Currently I do not have OEM installed. I am on 10.2.0.1.0 . I was thinking
    to create a job to run sql and email everyday.
    What sql can I use to generate that report ? What does OEM reports on when it show TOP Sql ?
    Thanks

    OEM will show you TOP sql by different catogories (each of which can be sorted) such as:
    Disk Reads Per Execution
    Buffer Gets Per Execution
    Executions
    Disk Reads
    Buffer Gets
    Buffer Gets Per Row
    Buffer Cache Hit Ration
    Sorts
    Shareable memory
    Rows Processed
    CPU Time
    Elapsed Time
    Now having said that....just because the TOP sql statement is the TOP sql statement does not mean that anything needs tuned. Your developers should be examining their SQL using insite gained from reading articles and documentation.
    Tuning use explain plan:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:231814117467
    SQL Tuning
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/sql_1016.htm#sthref1061
    Automatic SQL Tuning
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/sql_tune.htm#g42443
    In particular:
    12.2.4 Using SQL Tuning Advisor with Oracle Enterprise Manager
    These links should point you in the right direction:
    Of course there are books and Oracle classes that concentrate on these issues as well.
    Regards
    Tim Boles

  • ADDM Findings Top SQL Statements

    Hi,
    I have run addmrpt.sql for 1 month of time using snapshots and every ADDM report says that sql statement having id **** listed under top sql statements findings and recommendation is to tune using sql tunning advisor. It has 2-4 seconds elapsed time.But when i go through AWR report  instance efficiency report and all are normal.
    Can anyone please confirm whether I should recommend to tune this SQL statement to my vendor ?
    Thanks,
    TK

    below is the sql I found in ADDM. As I understood it is an intername SQL not an application SQL. When i searched it in internet found that it is related with check_oracle_health plugin. can you please help me to understand this nagios concept and the relationship it has with oracle software. And also how should I identify which methods we are using to monitor database internally?
    SELECT
    a.tablespace_name "Tablespace",
             b.status                  "Status",
             b.contents                "Type",
    b.extent_management "Extent Mgmt",
             a.bytes                   bytes,
             a.maxbytes                bytes_max,
             c.bytes_free + NVL(d.bytes_expired,0) bytes_free
             FROM
             -- belegter und maximal verfuegbarer platz pro datafile
             -- nach tablespacenamen zusammengefasst
             -- => bytes
             -- => maxbytes
             SELECT
             a.tablespace_name,
             SUM(a.bytes)          bytes,
    SUM(DECODE(a.autoextensible, 'YES', a.maxbytes, 'NO', a.bytes))
             maxbytes
             FROM
             dba_data_files a
             GROUP BY
             tablespace_name
             ) a,
             sys.dba_tablespaces b,
             -- freier platz pro tablespace
             -- => bytes_free
             SELECT
             a.tablespace_name,
             SUM(a.bytes) bytes_free
             FROM
             dba_free_space a
             GROUP BY
             tablespace_name
             ) c,
             -- freier platz durch expired extents
             -- speziell fuer undo tablespaces
             -- => bytes_expired
             SELECT
             a.tablespace_name,
             SUM(a.bytes) bytes_expired
             FROM
             dba_undo_extents a
             WHERE
             status = 'EXPIRED'
             GROUP BY
             tablespace_name
             ) d
             WHERE
             a.tablespace_name = c.tablespace_name
             AND a.tablespace_name = b.tablespace_name@@@@@@@@
             AND a.tablespace_name = d.tablespace_name
             UNION ALL
             SELECT
             d.tablespace_name "Tablespace",
             b.status "Status",
             b.contents "Type",
             b.extent_management "Extent Mgmt",
             sum(a.bytes_free + a.bytes_used) bytes,   -- allocated
    SUM(DECODE(d.autoextensible, 'YES', d.maxbytes, 'NO', d.bytes))
             bytes_max,
             SUM(a.bytes_free + a.bytes_used - NVL(c.bytes_used, 0)) bytes_free
             FROM
    sys.v_$TEMP_SPACE_HEADER a,
             sys.dba_tablespaces b,
    sys.v_$Temp_extent_pool c,
             dba_temp_files d
             WHERE
             c.file_id(+)             = a.file_id
             and c.tablespace_name(+) = a.tablespace_name
             and d.file_id            = a.file_id
             and d.tablespace_name    = a.tablespace_name
             and b.tablespace_name    = a.tablespace_name
             GROUP BY
             b.status,
             b.contents,
             b.extent_management,
             d.tablespace_name
             ORDER BY
             1

  • Emailing Top SQL report metrics

    I have performance monitoring configured on a database using 10g Em grid control. Is there a mechanism through which I could email the 'Top SQL' page that we get to see using EM? Ideally I would like to come up with the sql that EM uses to get the top SQL for a particular 24 hour period. Based on what I found, most of the information is in perfstat.stats$sql_summary. Has anyone done this before, and if so, could you share the sql script.?
    Thanks,
    Sunil.

    Hello Alan,
    Thank you very much for your answer. I implemented you solution as follows: I programmed a job exactly as you said and then I created a custom report which diplayed the 'output' column from mgmt$job_step_history. Unfortunately, although the 'output' column is CLOB and displays very nicely in any sql developing tool, when included in a report it seems that Information Publisher takes all the end-of-line out of it and thus it is displayed horribly, with no "enters"... Maybe if i used some pl/sql i would somehow manage to trick Information Publisher into displaying end-of-line characters...
    In the end, i will use one of the two workarounds:
    - program a job just like you said and set Grid control to notify me by email when succeded; this also includes the job's output, and so I can get the Top SQL reports via email. If more than one people would have to be notified by this, an email group would have to be set up by the email administrators in the company, and also a new user in grid control (a simple administrator with view privileges on the target, no super-user is necesary) with a notification rule that would send emails on succeed for the programmed job(s).
    - send the output of the ADDM report per email from the target db - the grid control is no longer involved; the steps are:
    select task_name tname from dba_advisor_tasks where created = (select max(created) from dba_advisor_tasks);
    SELECT dbms_advisor.get_task_report('&addm_task_name', 'TEXT', 'TYPICAL') FROM dual;
    Send the result by email. See Note 730746.1.
    Thanks a lot,
    Ana.

  • Top sql elasped time, how true is that

    hi guys,
    i am viewing an addm report and is concern about a top sql activity.
    i have an sql having top elasped time.
    <i>
    2,372      2,275      128,690,535      0.00      4.28      fphtjnquzzpud      [email protected] (TNS V1-V3)      SELECT USER_ID FROM SUBSCRIBER...
    </i>
    q1) what is the meaning of elasped time ?
    the time taken per execution of an sql statement ?
    q2) is the elasped time in the report shown above = sum of all the the elapsed time per execution of the sql ?
    if that the case, the most/frequently i run a SQL statement, the higher the elasped time it will be and thus higher db time.
    but how can we say that it is an inefficient sql since it has the most elasped time just because it is run way too frequently then other sqls ?
    Please advise
    Regards,
    Noob

    Hi,
    It is
    in the below addmrpt.sql the time which show 20393 is the elapsed time of the sql..
    SQL statements consuming significant database time were found.
       RECOMMENDATION 1: SQL Tuning, 24% benefit (20393 seconds)
          ACTION: Run SQL Tuning Advisor on the SQL statement with SQL_ID
             "9tkc7559d5drs".
             RELEVANT OBJECT: SQL statement with SQL_ID 9tkc7559d5drs and
             PLAN_HASH 1303522576But in awrrrpt.sql the elapsed time showing is for the total number of times the sql is executed in the DB.
    ^LSQL ordered by Elapsed Time       DB/Inst: STEELP/STEELP1  Snaps: 13011-13012
    -> Resources reported for PL/SQL code includes the resources used by all SQL
       statements called by the code.
    -> % Total DB Time is the Elapsed Time of the SQL statement divided
       into the Total Database Time multiplied by 100
      Elapsed      CPU                  Elap per  % Total
      Time (s)   Time (s)  Executions   Exec (s)  DB Time    SQL Id
         6,761      1,869            1     6761.3    11.2 4hsz1t5dsmhy4
    Module: XXLOTDETSo check the addmrpt report.
    thanks.
    baskar.l

  • How to Get TOP Sql

    Hi All,
    I need to get TOP sql query in 11g Database.
    I dont know about PT.
    User will carry on some testing activity on the Database, i need to get the top sql from the database.
    There is no access to AWR, ADDM and Entriprise console.
    I need to get the output of the queries by executing some sql.
    Can some body help me in this regards.
    Thanking You
    Pramodh

    >
    Whether it is possible to get the full set of sql, i tried executing this it is gives the report part by part.
    >
    I am not sure what the problem is.
    You get the top 5 SQL statements because of the "<6" part of the code. Would be top 10 if "<11" and so on.
    Maybe you have got to format the output a little in SQL*Plus to get it better readable - I leave that up to you :-)
    Kind regards
    Uwe
    http://uhesse.wordpress.com

  • How to get top SQLs in a time period

    HI, How can identify top SQL over a period of 1-month. Top SQL tab only displays top SQLs in last 24 hours in grid control.
    Neeraj

    AWR is your answer. Find the snapshots from Month old to current or what ever time you want and create a preserved snapshot set. and then create a report.
    That will give you the top 10 sql with in that range.
    AWR can be found under Adminstration tab.
    Naren

  • Top SQL: Application

    Hi,
    on 10g R2, in OEM (DB control) For Top SQL: Application I have :
    Data for the chosen interval is not available.
    Why ? Should I enable something or set a parameter ?
    I have this setting :
    SQL> show parameter STATISTICS_LEVEL
    NAME                                 TYPE        VALUE
    statistics_level                     string      TYPICALThank you.

    What database version are you using, what interval you asked the sql's for ?
    Oded
    [www.dbsnaps.com]
    [www.orbiumsoftware.com]

  • Lock monitor, top sql and trace data viewer

    can any one please tell me how can i access lock monitor, top sql and trace data viewer
    i am also not sure whether these tools are installed on my machine or not, if they are please tell me how can i access them, if not please tell me how can i install them
    thanks a lot

    Hey,
    You can launch OEM from a client machine and then:
    - Log in as system for example;
    - go to tools,
    - then - Diagnostics Packs, then you will have:
    a) Lock Monitor
    b) Perfomance Manager
    c) Performance Overview
    d) Top Sessions
    e) Top SQL.
    I hope this can help you a little.
    Regards,
    Marcello

  • Top Sqls by Execution time

    Hi,
    Can you please provide a query which gives top 5 SQLs ordered by Execution time ( i.e Elapsed Time/No of Executions), for one day.
    Appreciate your help.
    Thanks
    Sravan

    Hi,
    welcome to the forum!
    Here is the query:
    select sql_id, sum(elapsed_time_delta)/1e6 total_elapsed_seconds, sum(executions_delta) total_executions
    from dba_hist_sqlstat st,
            dba_hist_snapshot sn
    where st.snap_id = sn.snap_id
    and sn.begin_interval_time between sysdate-1 and sysdate
    group by sql_id
    order by 2 desc;Keep in mind that in order to use it you need the diagnostic pack license.
    Best regards,
    Nikolay
    Edited by: Nikolay Savvinov on Aug 24, 2012 8:40 AM (changed from microseconds to seconds)

  • Help for identifing top sql statements

    Hi all,
    We are doing load testing on oracle 9i with 500 concurent users. At some point of
    time the database was hang. I would like to know which query is taking more time/
    which resource occuping more. Can any body help in this regard.
    Thanks in advance

    Some useful information can be found in V$SQLAREA, for example :
    SQL> select SQL_TEXT, EXECUTIONS, DISK_READS, BUFFER_GETS, ROWS_PROCESSED, CPU_TIME, ELAPSED_TIME
      2  from v$sqlarea
      3* order by CPU_TIME desc;

  • Top sql..

    hi guys,
    Is there any view to help us find how many SQL statements are executed how many times against the database today.
    see this for example
    select distinct name from shares; executed 1000times
    select price from shares where name like '%CLE'; executed 10000 times
    thanks

    Hi, those querys will help you.
    But must have AWR enabled in your database.
    Setting STATISTICS_LEVEL parameter to TYPICAL or ALL
    CLEAR COLUMNS
    COLUMN "Snap Id" FORMAT 99999
    COLUMN "Schema" FORMAT A20
    COLUMN "Sharable Mem (K)" FORMAT 999,990.09
    COLUMN "Begin Time" FORMAT A25
    COLUMN "End Time" FORMAT A25
    SELECT DISTINCT sn.snap_id "Snap Id", sq.parsing_schema_name "Schema",
                    sq.sql_id "Sql Id", sq.executions_total "Executions",
                    sq.cpu_time_total "Cpu Time", sq.elapsed_time_total "Elapsed Time",
                    sq.disk_reads_total "Disk Reads",
                    sq.parse_calls_total "Parse Calls",
                    ROUND (sq.sharable_mem / 1024, 2) "Sharable Mem (K)",
                    sn.begin_interval_time "Begin Time",
                    sn.end_interval_time "End Time"
               FROM dba_hist_sqlstat sq, dba_hist_snapshot sn
              WHERE TO_CHAR (sn.begin_interval_time, 'YYYY-MM-DD HH24:MI')
                       BETWEEN '2011-01-24 04:00' --begin date
                           AND '2011-01-24 05:00' --end date
                AND sq.snap_id = sn.snap_id
                   --AND sq.iql_id = '&sql_id'
           ORDER BY 4 DESC NULLS LAST
    SELECT sq.sql_text
      FROM dba_hist_sqltext sq
    WHERE sq.sql_id = '&sql_id'
    /Regards,
    johnxjean

Maybe you are looking for

  • ISA 570 Web filtering: can't configure

    Hi I have the latest firmware installed but for some reason I don't get the pencil icon when I try to edit a policy profile in Web URL filtering under Security Services. Any help would be appreciated

  • Tomcat (newbie to Mac) how to install and run?

    Hi, I wonder if anyone knows any good tutorial of how to install tomcat on MAC? Also, I'm not really sure what type of tomcat I should use for mac (Tomcat specifically and explicitly offer the window's package) any DIRECT url will be GREAT...I'm look

  • Form based on org_id not displaying data in oracle apps R12

    Hi All, I am new to oracle apps R12. I have to develop a form which is based on views which are org_id specific. My data block is based on view which is org_id specific. Can anyone tell me what all settings i need to do in my form so that i can get t

  • Can't  upgrade I tunes because of problems with Windows Service Pack 2

    My daughter and I got shuffles for Christmas. I am unable to upgrade to the necessary version of I tunes because I do not have SP2. When I try to download the windows service pack 2 my computer crashes. Any suggestions? Are there any ways around this

  • Business Rules and Dates

    I have many Java POJOs imported as facts. In each of these POJOs there is at least 1 date property. How am I to use these dates in my rules. for example: pojo.date > '08/22/06' pojo.date < today println(pojo.date) Although I have imported the java da