Top 10 queries in oracle 9i

Hi,
how to get top 10 queries.. then which query is cosuming more cpu.

I would suggest using statspack (free of cost ! ) and using SQL ordered by gets section to find the top queries consuming maximum CPu. To read about it more refer to performance tuning guide in 9i docs or check spdoc.txt in oracle-home/rdbms/admin
Regards
Amit

Similar Messages

  • Is rank() really better than rownum for top-n-queries?

    Several sources say that for Oracle databases rank() should be used instead of 'rownum <= n' for top-n-queries. But here we have an application, where we a lot of top-n queries are executed on a big table with several million rows and rank() has a quite bad performance. I get much better results when I use a query with rownum <= n but the programmer of the application doesn't want to change it in the software because of those articles about rank() and rownum. I wonder, whether it is possible, to find a better form of the rank()-query or an additional index, that gives me the same performance.
    To explain my case I created the following example (if you try it, be aware that depending on the size of your dba_objects view you might need up to half a gig free space in your tablespace for this example).
    create table big_objects
    as
    select
    ascii(m.alpha)*100000+o.object_id object_id,
    o.owner owner,
    o.object_type,
    m.alpha||'_'||o.object_name object_name,
    sysdate-400+mod(100*object_id+99*ascii(m.alpha),365)+24/(o.object_id+ascii(m.alpha)) created,
    o.status
    from
    (select distinct
    upper(substr(object_name,1,1)) alpha
    from
    sys.dba_objects
    where
    upper(substr(object_name,1,1)) between 'A' and 'Z') m,
    sys.dba_objects o
    order by
    object_name;
    create index bigindex_1 on big_objects (owner, object_type, created);
    analyze table big_objects compute statistics;
    So my table looks a bit like dba_objects but with much more rows and I made a synthetic "created" date which is more similar to my real case, where top-n means a date selection of the newest records from a certain type.
    Here is the size of the segments on an nearly empty 11gR2 database:
    select segment_name, bytes, blocks from sys.dba_segments where segment_name like 'BIG%'
    SEGMENT_NAME BYTES BLOCKS
    BIGINDEX_1 75497472 9216
    BIG_OBJECTS 142606336 17408
    On my database the example table has approx. 1,9 Mio rows:
    select count(*) from big_objects;
    COUNT(*)
    1884246
    and some 1,4% of those rows have owner = 'SYS' and object_type = 'INDEX'
    select
    count(*)
    from big_objects
    where owner = 'SYS'
    and object_type = 'INDEX';
    COUNT(*)
    25896
    But I want to find only the 10 newest indexes for the owner SYS. I think the typical rank() approach would be:
    select
    owner,
    object_type,
    object_name,
    object_id,
    status,
    created
    from
    ( select
    owner,
    object_type,
    object_name,
    object_id,
    status,
    created,
    rank() over (order by created desc) rnk
    from
    big_objects
    where
    owner = 'SYS'
    and object_type = 'INDEX')
    where rnk <= 10
    order by created asc;
    OWNER OBJECT_TYPE OBJECT_NAME OBJECT_ID STATUS CREATED
    SYS INDEX B_COLLELEMIND 6600515 VALID 15.04.2010 19:05:55
    SYS INDEX V_I_WRI$_OPTSTAT_IND_OBJ#_ST 8600466 VALID 15.04.2010 19:09:03
    SYS INDEX G_I_RLS 7100375 VALID 15.04.2010 19:23:55
    SYS INDEX V_I_DIR$SERVICE_UI 8600320 VALID 15.04.2010 19:31:33
    SYS INDEX L_I_TSM_DST2$ 7600308 VALID 15.04.2010 19:36:26
    SYS INDEX L_I_IDL_UB11 7600235 VALID 15.04.2010 19:57:34
    SYS INDEX V_I_VIEWTRCOL1 8600174 VALID 15.04.2010 20:19:21
    SYS INDEX L_I_TRIGGER2 7600162 VALID 15.04.2010 20:31:39
    SYS INDEX L_I_NTAB1 7600089 VALID 15.04.2010 21:35:53
    SYS INDEX B_I_SYN1 6600077 VALID 15.04.2010 22:08:07
    10 rows selected.
    Elapsed: 00:00:00.22
    Execution Plan
    Plan hash value: 2911012437
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1427 | 188K| 1400 (1)| 00:00:17 |
    | 1 | SORT ORDER BY | | 1427 | 188K| 1400 (1)| 00:00:17 |
    |* 2 | VIEW | | 1427 | 188K| 1399 (1)| 00:00:17 |
    |* 3 | WINDOW SORT PUSHED RANK | | 1427 | 79912 | 1399 (1)| 00:00:17 |
    | 4 | TABLE ACCESS BY INDEX ROWID| BIG_OBJECTS | 1427 | 79912 | 1398 (0)| 00:00:17 |
    |* 5 | INDEX RANGE SCAN | BIGINDEX_1 | 1427 | | 9 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - filter("RNK"<=10)
    3 - filter(RANK() OVER ( ORDER BY INTERNAL_FUNCTION("CREATED") DESC )<=10)
    5 - access("OWNER"='SYS' AND "OBJECT_TYPE"='INDEX')
    Statistics
    1 recursive calls
    0 db block gets
    25870 consistent gets
    0 physical reads
    0 redo size
    1281 bytes sent via SQL*Net to client
    524 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    2 sorts (memory)
    0 sorts (disk)
    10 rows processed
    As from the index only the first two columns are used, all the 25896 records that I found above are read and sorted just to find the ten newest ones. Many unnecessary blocks are read and luckily all needed database blocks were in memory already. In our real case quite often a lot of physical reads are performed, which makes the performance of the application even worse.
    In my following example with a "rownum <= 10" all three columns of the index are used and the number of block gets is much, much smaller than in the rank() example.
    select
    owner,
    object_type,
    object_name,
    object_id,
    status,
    created
    from
    big_objects
    where
    (owner, object_type, created)
    in
    ( select
    owner,
    object_type,
    created
    from
    ( select /*+ first_rows(10) */
    owner,
    object_type,
    created
    from
    big_objects
    where
    owner = 'SYS'
    and object_type = 'INDEX'
    order by
    owner,
    object_type,
    created desc
    where rownum <= 10
    order by created asc;
    OWNER OBJECT_TYPE OBJECT_NAME OBJECT_ID STATUS CREATED
    SYS INDEX B_COLLELEMIND 6600515 VALID 15.04.2010 19:05:55
    SYS INDEX V_I_WRI$_OPTSTAT_IND_OBJ#_ST 8600466 VALID 15.04.2010 19:09:03
    SYS INDEX G_I_RLS 7100375 VALID 15.04.2010 19:23:55
    SYS INDEX V_I_DIR$SERVICE_UI 8600320 VALID 15.04.2010 19:31:33
    SYS INDEX L_I_TSM_DST2$ 7600308 VALID 15.04.2010 19:36:26
    SYS INDEX L_I_IDL_UB11 7600235 VALID 15.04.2010 19:57:34
    SYS INDEX V_I_VIEWTRCOL1 8600174 VALID 15.04.2010 20:19:21
    SYS INDEX L_I_TRIGGER2 7600162 VALID 15.04.2010 20:31:39
    SYS INDEX L_I_NTAB1 7600089 VALID 15.04.2010 21:35:53
    SYS INDEX B_I_SYN1 6600077 VALID 15.04.2010 22:08:07
    10 rows selected.
    Elapsed: 00:00:00.03
    Execution Plan
    Plan hash value: 3360237620
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 10 | 760 | 17 (0)| 00:00:01 |
    | 1 | SORT ORDER BY | | 10 | 760 | 17 (0)| 00:00:01 |
    | 2 | NESTED LOOPS | | | | | |
    | 3 | NESTED LOOPS | | 10 | 760 | 17 (0)| 00:00:01 |
    | 4 | VIEW | VW_NSO_1 | 10 | 200 | 2 (50)| 00:00:01 |
    | 5 | HASH UNIQUE | | 10 | 200 | 4 (25)| 00:00:01 |
    |* 6 | COUNT STOPKEY | | | | | |
    | 7 | VIEW | | 11 | 220 | 3 (0)| 00:00:01 |
    |* 8 | INDEX RANGE SCAN DESCENDING| BIGINDEX_1 | 1427 | 28540 | 3 (0)| 00:00:01 |
    |* 9 | INDEX RANGE SCAN | BIGINDEX_1 | 3 | | 2 (0)| 00:00:01 |
    | 10 | TABLE ACCESS BY INDEX ROWID | BIG_OBJECTS | 3 | 168 | 6 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    6 - filter(ROWNUM<=10)
    8 - access("OWNER"='SYS' AND "OBJECT_TYPE"='INDEX')
    9 - access("OWNER"="OWNER" AND "OBJECT_TYPE"="OBJECT_TYPE" AND "CREATED"="CREATED")
    Statistics
    1 recursive calls
    0 db block gets
    26 consistent gets
    0 physical reads
    0 redo size
    1281 bytes sent via SQL*Net to client
    524 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    1 sorts (memory)
    0 sorts (disk)
    10 rows processed
    I made this comparison with the Oracle versions 10.2 and 11.2 and the result was more or less the same. How can I change the rank() query in a way that only the small number of really needed blocks are read from the database?

    this was exactly the hint, I was looking for. Generally speaking hints are not the preferred way to go to tune queries. They can have nasty side-effects when data changes.
    Now the rank()-query is similar fast and much better to read than my fast one with three nested SELECTs.
    Your rownum query was needlessly complicated, and could be simplified to:
    select owner, object_type, object_name, object_id, status, created
    from (select owner, object_type, created
          from big_objects
          where owner = 'SYS' and
                object_type = 'INDEX'
          order by created desc)
    where rownum <= 10
    order by created ascand very likely get the same speed.
    One more question. How did you format those sql queries and results. When I copy/paste them into the editor of forums.oracle.com the format allways gets lost.To preserve formatting use {noformat}{noformat} before and after the section you want ot keep formatted.  In general, if you want to see how someone generated an effect, reply to the post and hit the quote original icon.  You will see all the formatting codes used in the original.
    John                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Top 10 Queries in Database...

    Hello Guys,
    My boss wants to know the database queries ran in last 10 days. What is the best way to get this informatiom.
    He also wants to know the top 10 heavy quries that took the most cpu resources and time.
    We have database 10g release 2 and OEM is working.
    Please help.
    Regards, Imran

    This information is not available. Oracle does not keep a log of queries. Perhaps it would have been good if you boss had come to you and asked for all of the queries that run over the next 10 days -- that would be more doable.
    Some of the info may be available from grid control. To get the top 10 queries, you can use statspack to take a snapshot, then some time later, take another and run the report. The top 10 queries for that time interval, by various measures, will be in the report.

  • How to Find out what are the top 20 queries executed in the system

    Hi Guru's,
    I would like to know how to gather the information regarding the Top 20 queries used in the system per week, by a multicube.
    Note: I am using BI 7.0 and also Statistics are turned on.
    People have provided me the Cube name and table name last time but nothing seems to work.
    I do not have the query names and I just have my multiprovider name and with the help of that, I want to find out what are all the queries which were executed related to that multiprovider.
    Thanks and regards,

    Hi,
    Here is an idea for your request.
    Basically you can create a simple query on multiprovider 0TCT_MC01.
    Filter: you can use a variable for restriction of time ( calday, or calmonth) since you should be interested for a time period.
    Choose following characters into your objects:
    InfoProvider ( 0TCTIFPROV )  - you can create a variable for choosing infoprovider before query runs.
    *Tp.[Type of BI Application Object] 0TCTBISOTYP  = filter this with 'QUERY' or whatever your need is.
    *BI Application Object 0TCTBISBOBJ,  ( this will give you the name of the queries)
    In key figures choose,  Count for BI Appl. (0TCTWTCOUNT).
    (number for query run)
    Create a condition , for top 20.
    Hope this helps.
    Derya

  • How to find out the top 20 queries used in a week

    Hi Guru's,
    I would like to know how to gather the information regarding the Top 20 queries used in the system per week, by a multicube.
    Note: I am using BI 7.0 and also Statistics are turned on.
    The aim is to pre-calculate these queries at night to help with the user experience.
    Thanks and regards,

    Hi
    U can check in RSZCOMPDIR if u did not find the info then go to se11 and give RSZ* and press F4 u will get all the tables which relates to reports
    Assign points if it helps
    Khaja

  • Top-n analysis in oracle 8i

    How to use top-n analysis in oracle 8i?
    I mean,take a example.
    I am maintaining a database of a 1000 employees.I want to display the names of the employees who are getting top 10 salaries(more further top 100 salaries) using a SQL query in oracle 8i only.Please answer my problem.

    Sorry, my suggestion will return 10 emp with highest salaries, not all employees with 10 highest salaries. To get all employees with 10 highest salaries in 8i:
    SQL> SELECT  ename,
      2          sal
      3    FROM  emp
      4    WHERE sal IN (
      5                  SELECT  sal
      6                    FROM  (
      7                           SELECT  sal
      8                             FROM  emp
      9                             GROUP BY sal
    10                             ORDER BY sal DESC
    11                          )
    12                    WHERE rownum <= 10
    13                 )
    14  /
    ENAME             SAL
    KING             5000
    FORD             3000
    SCOTT            3000
    JONES            2975
    BLAKE            2850
    CLARK            2450
    ALLEN            1600
    TURNER           1500
    MILLER           1300
    MARTIN           1250
    WARD             1250
    ENAME             SAL
    ADAMS            1100
    12 rows selected.
    SQL> SY.

  • JDBC issue while calling queries in oracle- urgent

    Hi !
    Theres a peculiar problem being faced while calling queries(SQL statements having join of more than 2 tables) in oracle database. We are using JDBC thin driver.
    We are calling SQL statements from stateless session EJBs deployed in weblogic app server and using connection pool facility to connect to oracle database.
    Now, the issue is that select queries having more then 2 tables run fine & give proper result in java but when we see trace in oracle by setting sql_trace to true.. we see some column rowid added as first column selected in such queries and oracle shows such queries to be failed.
    Can anyone tell why & how & who adds this rowid ?
    Has anyone faces such a problem ?
    regards'

    Am I right in you saying that the data is returned to the app server, but the database is saying it's not???
    Veeeeeerrrry strange.
    ...I mean, if I understand you right, then I have to ask if you're sure that's what's actually happening.
    Can anyone tell why & how & who adds this rowid?...and that you're sure you're not adding this yourself in the join?
    ...since (you imply) you're not using entities, just sql queries against the datasource connection, did you try running that query direct against the database?
    ...and... oh never mind.
    hth
    /k1

  • Running Stacked Queries in Oracle SQL Developer

    Is it possible to run stacked queries in Oracle SQL Developer???
    Something like this...
    SELECT *
    FROM TABLE_1
    SELECT *
    FROM TABLE_2
    SELECT *
    FROM TABLE_3
    And give my 3 different result sets in my Query Result window
    I tried "BEGIN" and "END" and Oracle SQL Developer did not seem to like it.
    Can someone let me know if this is possible and what the syntax might be???
    Thanks in advance for your review and am hopeful for a reply.
    PSULionRP

    Wrong forum!
    Please post this in the sql developer forum.
    SQL Developer
    You can run multiple queries exactly the way you posted them but you need to use F5 - the run script toolbar button.

  • Doubt's regarding the Hierarchial Queries in Oracle

    Hi,
    i have a doubt regarding the Hierarchial Queries in Oracle.
    SELECT * FROM TMP_TEST;
    ID     NUMVAL     STRVAL
    1     100     Hello
    1     -100     World
    2     1     Concatenate
    2     2     In String
    2     3     using Connect By
    2     4     Using SYS_CONNECT_BY_PATH
    i am clear with my execution of IN_Line view (mechanism how it work's) .
    But i have also read about the Hierarchial queries in the Oracle product documentation's. i am also aware of the
    SYS_CONNECT_BY_PATH , LEVEL & START WITH , CONNECT BY Keywords.
    But i couldnot able to Manually work out as how this below Query works.
    Can you please explain me how this Hieracial query works ?
    SELECT ID, (SYS_CONNECT_BY_PATH(STRVAL,',')),LEVEL
    FROM
    SELECT ID,STRVAL,ROW_NUMBER() OVER(PARTITION BY ID ORDER BY ID) RNUM,
    COUNT(*) OVER(PARTITION BY ID ORDER BY ID) CNT,NUMVAL
    FROM TMP_TEST
    START WITH RNUM = 1
    CONNECT BY PRIOR RNUM = RNUM - 1
    Many Thanks,
    Rajesh.

    Hi, Rajesh,
    My first message was in response to your first message.
    In your latest message, the query is:
    SELECT  ID, (SYS_CONNECT_BY_PATH(STRVAL,',')),LEVEL
    FROM    (
            SELECT  ID,STRVAL,ROW_NUMBER() OVER(PARTITION BY ID ORDER BY ID) RNUM,
                    COUNT(*) OVER(PARTITION BY ID ORDER BY ID) CNT,NUMVAL
            FROM TMP_TEST
    WHERE   RNUM = CNT
    START WITH  RNUM = 1
    CONNECT BY  PRIOR RNUM = RNUM - 1;It looks like you lost the second CONNECT BY condition:
    AND PRIOR ID = IDPut it back: it's important.
    Now you're confused about the output row:
    2    ,Hello,World,using Connect By,Using SYS_CONNECT_BY_PATH   4It doesn't seem to correspond to anything results that you got when you ran the sub-query alone.
    That's because the resutls from your sub-query may change every time you run it, even though the data doesn't change. The ORDER BY clauses in both of the analytic functions do not result in a complete ordering. In fact, they're completely meaningless. It never makes any sense to PARTITON BY and ORDER BY the same value; "PARTITION BY id" means that only rows with the same id will be compared to each other; you might as well say "ORDER BY 0" or "ORDER BY dmbs_random.value".
    The ORDER BY clause of ROW_NUMBER whould reflect that way in which you want the results to appear within each id, for example:
    ROW_NUMBER () OVER (PARTITION BY id ORDER BY UPPER (strval))Note that this is very similar to what was in my first reply.
    In the COUNT function, why do you want an ORDER BY clause at all? Just say:
    COUNT (*) OVER (PARTITION BY id)

  • Longrunning jobs/Queries in oracle

    Hi ,
    How to find long running jobs/queries which are executing less than 6 seconds.
    The primary criterion for any operation to appear in v$session_longops is to run more than 6 seconds. I want to find out the queries which are executing more than 1 seconds.
    Please suggest.
    Thanks in advance.
    -Surya

    884629 wrote:
    I agree with you but still at any point of time if we want to find out the queries which are running more than 4 secs(may be because lot of resources issue) then how we can find out? I hope we can not say 'Its meaningless'.It is totally meaningless. You even originally said you want to look at queries running longer than 1 second for problem queries. Now you want to look at queries running more than 4 seconds for problems.
    So are 1 sec queries okay now? And 4+ sec queries not? What made you decide that?
    You do not know where to draw the line as you do not where the problem is. A sub-second query can be non-optimally written. A 1 hour query can be optimally written.
    So what does the query's time tell you? How can you look at the time and say "+Yep, this 2 second query is okay and this 4 second query needs further investigation+".?
    What about the SAME query that gives DIFFERENT execution times? You have very conveniently chosen to ignore this basic behaviour of queries in Oracle. For example:
    SQL> select count(*) from all_objects;
      COUNT(*)
         69465
    Elapsed: 00:00:04.96
    SQL> select count(*) from all_objects;
      COUNT(*)
         69465
    Elapsed: 00:00:02.88So is the 1st query bad as it is almost 5 seconds? And the 2nd query good as it just over 2 seconds? Where do you draw the line using execution time? And what about the same query falling in falling into both good and bad query time regions?
    In Oracle® Database Performance Tuning Guide, section 1.1.2.1 Performance Principles, it says:
    +"Tuning is driven by *identifying the most significant bottleneck* and making the appropriate changes to reduce or eliminate the effect of that bottleneck."+
    So how do you identify the most significant bottleneck? By looking at something as variable and inconsistent as query time? You are wrong if you think that.

  • Standard Query for Top 10 queries and Users

    Hi Experts,
    Is there any query which gives the details like ,
    1. Top 10 queries executed in a month
    2. Top 10 users ( By no of queries executed )
    Regards,
    Bhadri M.

    1. Top 10 queries executed in a month
    Use Query 0TCT_MCA1_Q0142.
    In this report you will have to filter variable BI Object to Queries and also it gives stats for the last 30 days, you have have to remove the SAP User exit variable in case you do not want to use the 30 days option. And then you will have to define Condition for Top 10.
    2. Top 10 users ( By no of queries executed )
    Use Query 0TCT_MCA1_Q0141.
    Similarly you have to modify this query.
    -Neelesh

  • Top 5 queries  - One of them is sequence.nextval from dual !!!!!

    Hi All,
    I am using ORACLE DATABASE 11g and Oracle Linux 5.
    My intentions are to get the top resource consuming or time consuming queries from database in the particular time frame. I formed the below query to get the same :-
    select a.SQL_FULLTEXT,
                 s.module,
                 s.cpu_time_total / 1000000,
                 s.iowait_total / 1000000,
                 s.fetches_total,
                 s.sorts_total,
                 s.executions_total,
                 s.loads_total,
                 s.disk_reads_total /
                 DECODE(s.executions_total, 0, 1, s.executions_total) reads_per_execution,
                 s.disk_reads_total,
                 s.direct_writes_total / 1024,
                 s.buffer_gets_total / 1204,
                 s.rows_processed_total,
                 s.elapsed_time_total / 1000000,
                 s.apwait_total / 1000000,
                 s.ccwait_total / 1000000,
                 s.plsexec_time_total / 1000000,
                 s.javexec_time_total / 1000000
            from DBA_HIST_SQLSTAT S, DBA_HIST_SNAPSHOT h, v$sqlarea a
           where s.parsing_schema_name = 'ST'
             and s.executions_total != 0
             and s.snap_id = h.snap_id
             and a.SQL_ID = s.sql_id
             and h.begin_interval_time > '03-NOV-11 09.30.00.000 AM'
             and h.end_interval_time < ''03-NOV-11 12.30.59.999 PM'
             and rownum <= 5
           order by 15 desc;I assume that above query will give me top 5 sql or pl/sql queries which are consuming most resource or time. Please correct me if am wrong with the query.
    The surprising fact is that I got the below query as the top most resource consuming query :-
    SELECT REF_SEQ.NEXTVAL AS VAL FROM DUALI searched for all the code in the database and I was not able to find this line in any code. The fact is that this query should not take more than 1 second as we know that sequence nextval from dual table is very fast so, how can i get this as resource consuming query.
    The output is as follows :- ( I have modified the output to show all the facts in detail. Here you can see that it shows the execution time as 10.002467 Seconds. In real this will get execute in less than a second.)
    MODULE NAME := Banking
    TOTAL CPU TIME := 8.299744 Seconds.
    TOTAL IO WAIT TIME := .915287 Seconds.
    TOTAL RECORDS FETCHED := 41128 Rows.
    SORT OPERATION(S) := 0
    TOTAL NO. OF EXECUTION(s) := 41128 Times.
    TOTAL NO. OF TIME(S) OBJECT/QUERY LOADED/RELOADED := 5
    DATA READ PER EXECUTION := .002139661544446605718731764248200739155806 KB.
    TOTAL DISK READS := 88 KB.
    TOTAL DISK WRITES := 0 KB.
    TOTAL BUFFER READS := 4.92441860465116279069767441860465116279 KB.
    TOTAL NO. OF ROW(S) PROCESSED := 41128
    TOTAL EXECUTION TIME FOR ONE TRANSACTION := 10.002467 Seconds.
    APPLICATION WAIT TIME := 0 Seconds.
    CONCURRENCY WAIT TIME := .344575 Seconds.
    PL/SQL EXECUTION TIME := 0 Seconds.
    JAVA EXECUTION TIME := 0 Seconds.Please guide me for this method. How to understand the presence of this sequence.nextval query here.
    The base requirement is I want a query which will give me top 5 resource/time consuming queries. I have took the help of AWR views in my logic. If you have any better idea let me know.
    Thanks in advance.

    Try this
    select *
    from
    select a.SQL_FULLTEXT,
                 s.module,
                 s.cpu_time_total / 1000000,
                 s.iowait_total / 1000000,
                 s.fetches_total,
                 s.sorts_total,
                 s.executions_total,
                 s.loads_total,
                 s.disk_reads_total /
                 DECODE(s.executions_total, 0, 1, s.executions_total) reads_per_execution,
                 s.disk_reads_total,
                 s.direct_writes_total / 1024,
                 s.buffer_gets_total / 1204,
                 s.rows_processed_total,
                 s.elapsed_time_total / 1000000,
                 s.apwait_total / 1000000,
                 s.ccwait_total / 1000000,
                 s.plsexec_time_total / 1000000,
                 s.javexec_time_total / 1000000
            from DBA_HIST_SQLSTAT S, DBA_HIST_SNAPSHOT h, v$sqlarea a
           where s.parsing_schema_name = 'ST'
             and s.executions_total != 0
             and s.snap_id = h.snap_id
             and a.SQL_ID = s.sql_id
             and h.begin_interval_time > '03-NOV-11 09.30.00.000 AM'
             and h.end_interval_time < '03-NOV-11 12.30.59.999 PM'
             order by 15 desc
    )where rownum <= 5

  • Running Multiple queries in Oracle 10g Express Edition! Help Me!

    I am new to Oracle 10g Express Edition.
    I used my browser to navigated to http://127.0.0.1:8080/apex
    I saw the database page.. logged in.. went into the SQL section.. now am not able to run two or more queries at the same time.. i have given a screenshot too. Plz.. check it and reply me quickly..
    http://i71.photobucket.com/albums/i149/prasanna7287/546895215.jpg
    Help me plz..
    Prasanna.

    There are two possibilities:
    1) Run the SQL commands, one command at a time;
    2) Create a script of multiple commands, and run the script.
    These are discussed in some detail in the online documentation at http://www.oracle.com/pls/xe102/homepage
    In particular, look at
    http://download-east.oracle.com/docs/cd/B25329_01/doc/appdev.102/b25108/xedev_sql.htm#BJEIEIFJ
    Message was edited by:
    Hans Forbrich
    No ... wait ... please do not read the documentation! <g>

  • Can join queries in Oracle 8i and above span multiple databases

    Hi,
    In Oracle 8i and above, can join queries span multiple databases??
    For eg., I have two databases A and B, and say database A has table A_T and
    database B has table B_T. Assume that both the databases are on the same
    server.
    Can I run a join query from my application using OCI calls that spans across
    tables from multiple databases, namely, A_T and B_T?
    My query probably looks like this - Select * from A.A_T, B.B_T;
    Thank you,
    Sashi

    In Oracle 8i and above, can join queries span multiple databases??
    For eg., I have two databases A and B, and say database A has table A_T and
    database B has table B_T. Assume that both the databases are on the same
    server.
    Can I run a join query from my application using OCI calls that spans across
    tables from multiple databases, namely, A_T and B_T?
    My query probably looks like this - Select * from A.A_T, B.B_T;If you create a database link from database A to B your SQL would look something like this:
    select * from A.A_T, B.B_T@dbB where A.A_T.PK = B.B_T.PK@dbB
    The Oracle manuals should have the information you need on creating a database link.

  • XML queries in ORACLE 10gR1 vs ORACLE 10gR2

    Hi
    in the research project where I'm involved in, we have two databases. One is the test database, upgraded recently in ORACLE 10gR2 and the production database in ORACLE 10gR1.
    We have the same table with the same data in both test and production database.
    I can run successfully the query and get result in test db ORACLE 10gR2:
    SELECT XMLQuery('declare namespace
    mpeg7="urn:mpeg:mpeg7:schema:2001";for $i in /mpeg7:Mpeg7
    return $i' PASSING xmlcolumn RETURNING CONTENT) FROM
    XMLTable WHERE existsNode(xmlcolumn,
    '//@id="2005"',
    'xmlns="urn:mpeg:mpeg7:schema:2001"') = 1;
    but if I try the same query in production db ORACLE 10gR1, I get the error
    return $i' PASSING xml_column RETURNING CONTENT) FROM
    FEHLER in Zeile 3:
    ORA-00907: missing right parenthesis
    Is there any difference in the queries syntax between R1 and R2?
    What should I change in my query?
    Please help. I’m really facing with some problems with XML storage and retrieve.
    Any kind of help will be appreciable
    Best regards,
    Evanela

    Hi Evanela,
    XQuery is available from 10gR2 and higher - the XQuery functionality
    is just not available in 10gR1 ...
    Does this help ...?
    -Carsten

Maybe you are looking for

  • Mail won't open after software update

    I just did a software update (I think it was itunes update) and now mail won't open. Mail is still located in the apps folder. Message says to reinstall mail. Any ideas? Thx!

  • Oracle hangs on query with multiple joins

    To test the sotftware from the LMS-vendor that are out partners we use virtual machines where we install Windows 2003 servers and Oracle XE While we were testing the software I've found that a particular query with multiple unions causes the CPU of t

  • Indesign CC 9 - blocage d'un fichier

    J'étais en train de faire une brochure....bien avancée Il y a eu un bug Quand je rappelle ce fichier, il apparaît à l'endroit de ma dernière action (création d'un cadre) puis Indesign se ferme avec un message d'erreur habitiel 'indesign a cessé de fo

  • Unique identifier for a query

    Hi, Two queries existed with the same definition, technical name and description in our dev. box. Please let me know a unique identifier so that I can differentiate between these two queries. Regards Mukul

  • I am trying to reset my network settings.  I have been asked for my passcode, but I didn't know I had one?

    How do I reset my network settings on my iPad air.  I have been asked for my password.  I didn't know I had one.  Where do I find it?