"Rows" statistics from STAT in trace event 10046, Oracle 11g.

Hi, all!
Why "Rows" statistics in STAT are different for 10g and 11g?
I have two database with version 10g and 11g, with the same data.
I executed some pl/sql code with tracing 10046 level 8.
And I have different result when obtain raw trace.
In 10g I obtain rows statistics for all executions - Rows= 7.
In 11g I obtain rows statistics for first executions - Rows= 1. Why?
See my example:
declare
     type t_name_tbl is table of varchar2(30) index by binary_integer;
     v_name_tbl t_name_tbl;
     v_len      number := 10;
begin
     execute immediate 'alter session set timed_statistics = true ';
     execute immediate 'alter session set statistics_level=all ';
     execute immediate 'alter session set max_dump_file_size = unlimited ';
     execute immediate 'alter session set events ''10046 trace name context forever,level 8'' ';
     loop
       select cour_name bulk collect
            into v_name_tbl
           from country t
          where length(t.cour_name) = v_len;
       exit when v_len = 0;
       v_len := v_len - 1;
       for i in 1 .. v_name_tbl.count loop
         dbms_output.put_line(v_name_tbl(i));
       end loop;
     end loop;
end;Result Tkprof for Oracle 10g:
SELECT COUR_NAME
FROM
COUNTRY T WHERE LENGTH(T.COUR_NAME) = :B1
call     count       cpu    elapsed       disk      query    current        rows
Parse        1      0.00       0.00          0          0          0           0
Execute     11      0.00       0.00          0          0          0           0
Fetch       11      0.01       0.00          0         44          0           7
total       23      0.01       0.00          0         44          0           7
Misses in library cache during parse: 0
Optimizer mode: ALL_ROWS
Parsing user id: 649     (recursive depth: 1)
Rows     Row Source Operation
      7  TABLE ACCESS FULL COUNTRY (cr=44 pr=0 pw=0 time=1576 us)Result Tkprof for Oracle 11g:
SQL ID: 3kqmkg8jp5nwk
Plan Hash: 1371235632
SELECT COUR_NAME
FROM
COUNTRY T WHERE LENGTH(T.COUR_NAME) = :B1
call     count       cpu    elapsed       disk      query    current        rows
Parse        1      0.01       0.00          0          0          0           0
Execute     11      0.02       0.01          0          0          0           0
Fetch       11      0.00       0.01          3         44          0           7
total       23      0.03       0.02          3         44          0           7
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 82     (recursive depth: 1)
Rows     Row Source Operation
      1  TABLE ACCESS FULL COUNTRY (cr=4 pr=3 pw=0 time=0 us cost=2 size=44 card=2)Were can I read about it?

Oracle 11g by default writes the execution plan (the STAT lines in the raw trace file) after the first execution of the SQL statement, while prior to 11g the execution plan is written only when the cursor is closed.
The behavior in 11g can be controlled by changing the PLAN_STAT parameter of the call that enables the trace from the default value of FIRST_EXECUTION to ALL_EXECUTIONS:
http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_sessio.htm#i1010518
Charles Hooper
Co-author of "Expert Oracle Practices: Oracle Database Administration from the Oak Table"
http://hoopercharles.wordpress.com/
IT Manager/Oracle DBA
K&M Machine-Fabricating, Inc.
Edited by: Charles Hooper on Aug 9, 2010 3:33 PM
Default value on 11g is FIRST_EXECUTION, while the behavior prior to 11g is ALL_EXECUTIONS - corrected the incomplete sentence.

Similar Messages

  • Ask result sql trace events 10046 level 8 and 12

    hi all, i read result of sql trace events 10046 level 8 on
    http://www.oracle-base.com/articles/10g/SQLTrace10046TrcsessAndTkprof10g.php#trace_example
    and I do sql trace event 10046 level 8 or 12. But the results did not same, execution plan does not appear
    how to have execution plan appears??

    We use level 12 and we have both RSO (row source operation) and execution plan. Remember, execution plan is just the preditive estimate execution path by the opimizer. RSO is actually how the optimizer executes.
    ALTER SESSION SET EVENTS '10046 trace name context forever, level 12'
    call count cpu elapsed disk query current rows
    Parse 1 0.01 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.01 0.00 0 66 1 1
    total 3 0.02 0.01 0 66 1 1
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 1767 (DELTEK) (recursive depth: 2)
    Rows Row Source Operation
    1 SORT AGGREGATE (cr=66 pr=0 pw=0 time=8793 us)
    4732 TABLE ACCESS SAMPLE Z_PJPCOMPR_UPSUM47 (cr=66 pr=0 pw=0 time=74 us)
    Rows Execution Plan
    0 SELECT STATEMENT MODE: HINT: ALL_ROWS
    1 SORT (AGGREGATE)
    4732 TABLE ACCESS (SAMPLE) OF 'Z_PJPCOMPR_UPSUM47' (TABLE)

  • What happens 2 old trace files in Oracle 11g?Is there any automatic handlin

    Hi,I dont see old trace files in my trace directory in oracle 11g 11.1.0.7 database thats in /diag/rdbms/DB_NAME/trace directory.I dont have any auto delete procedure for trace files.
    Just wanted to know if theres any autodelete/autoarchive procedure in 11g which I dont know ?
    Thanks in advance
    Gagan

    gaganahuja wrote:
    Hi,I dont see old trace files in my trace directory in oracle 11g 11.1.0.7 database thats in /diag/rdbms/DB_NAME/trace directory.I dont have any auto >delete procedure for trace files.Read this and this
    You can also do :
    SELECT * FROM V$DIAG_INFO;to see informations about diagnostic locations of that instance.
    Just wanted to know if theres any autodelete/autoarchive procedure in 11g which I dont know ?No

  • Occurance of trace event in oracle

    Hi ,
    Wishing all a happy Eid ....
    I have question on  trace enabling of Oracle database .
    Suppose I have enabled a trace event  "alter system set events '1031 trace name errorstack level 3';"
    Qusetion-1 : - Will this trace event able to create a trace file in udump dest for the users who are already logged in before the trace event  enabled .,
                   Meaning - Suppose I am enabling the trace event (ex-1031) on 9 AM , will this event able to create a trace file for the users
                   who have logged in at 7AM and at 9:30 AM ora-1031 will raise from their session. 
    Question -2 - After enabling the trace on instance/system level ,how can i check the enabled event ...
                  Meaning - Is there any query/command to check the above trace level (1031) is enabled or not ....
    Thanks

    1.  Try it.
    2.  Search dbms_system.read_ev on Oracle DBMS_SYSTEM , though see note.
    Also see Spying on the other session | Dion Cho - Oracle Performance Storyteller

  • Interface shipments from Order Management as events to Oracle Projects

    Hi to All,
    This is V.Kishore Kumar.
    Hi to All,
    Is there any way to "interface shipments from Order Management as events to Projects".
    Waiting ur solution.
    Thanks & Regards,
    V.Kishore Kumar

    Hi,
    EBS document suite has this document. If you do not have, you can download it from OTN. Document name is "Oracle® Projects APIs, Client Extensions, and Open Interfaces", Part No. B25624-02.
    Regards
    RK

  • How to migrate the data from DEC RDB 5.1 to Oracle 11g

    Hi,
    As part of my project, we need to migrate the data from DEC RDB 5.1 present on Alpha server with VMS 6.1 OS into Oracle 11g. The size of the data in DEC RDB is around 40 GB.
    Could you please suggest various ways of getting this done in easy and simpler way?
    Thanks in advance.

    Hello,
    when Oracle bought Rdb from Digital Equipment Corporation (DEC) in 1994, the name of the product changed from DEC Rdb to Oracle Rdb. Meanwhile the actual version of Rdb is 7.2, so you are on a VERY old version. And that excludes the suggestions from the mentioned note to use a database link from Oracle RDBMS to Rdb, that is simply not possible with that old version of Rdb.
    But Rdb 5.1 knew already the Rdb Management Utility (RMU) - I just checked that with Rdb 4.1 which is even older.
    There are two commands that are helpful for your task.
    RMU/EXTRACT - that writes the metadata into a file. That output helps you to build a script to create all the objects in your target database.
    RMU/UNLOAD - that writes the data of each table into a formatted file (one file per table). That output can be used by the SQL*Loader to load your data into the target database.
    You can read all details about these commands in the online help on your Alpha. At first, issue the HELP command and look in the output list whether it lists a command RMU or RMU51. Then run that command:
    $ help rmu /extract
    and
    $ help rmu /unload
    Replace rmu by rmu51 if the help command shows you that rmu51 exists but not rmu.
    There is one caveat. Do you use blobs in your Rdb database? If you don't know that, create an the output with RMU/EXTRACT and search the output file for the string LIST OF BYTE VARYING. If there are none then you have no blobs. If you have some you need to take more care of them, they can't be unloaded into a formatted file, that must happen programmatical. If you have such fields then let me know, then I'll tell you how to get them out of your Rdb database.
    Best regards
    Wolfgang
    P.S.: For Rdb related questions it is better to ask in our Communities at https://communities.oracle.com/portal/server.pt/community/rdb_product_family_on_openvms . That forum is watched by Rdb Support and Development.

  • No transition found from state: STARTING

    Hi Experts,
    I am doing a scenario with JMS receiver communication channel, and there is an error occurring when I send the data to JMS adapter:
    Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: No transition found from state: STARTING, on event: process_commence for DFA: CC_JMS_RECEIVER:d0058f0da62e309ba0930891dc300ee8
    Please someone gives me an idea!
    Thanks a lot,
    Thien Duong

    Hi Thien,
    Thats better , atleast with you giving a little background now i can start with my work. As you say thats it difficult for you to establish a trace it would be even more difficult from over here but still. Starting with first things first.
    1) The drivers and there version need to be correct and hope they are deployed correctly.
    2)
    Hope these links are useful to you..
    configuration of JMS  adapter Using WebSphereMQ
    connection with the JMS provider
    http://www-1.ibm.com/support/docview.wss?uid=swg21180117
    http://www-1.ibm.com/support/docview.wss?uid=swg21105655
    Regards
    joel

  • Receiver JMS ( websphere MQ ) error  - No transition found from state:ERROR

    Hi all
    we are using JMS adapter to connect to the Queue manager . whenever the queue manager restarts , the messages is not getting thru and it is struck in the adapter engine with status " not to be delivered "
    i am getting error in receiver communication channel audit log....its showing
    *MP: Exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: No transition found from state: ERROR, on event: process_commence for DFA: CC_JMS_XXXXXXXXX:15fa03eb9fd837849906f512610314c4*
    note : already i have gone thur many forum  and nothing helps.
    Thanks in advance
    Faheem

    If you are using the FCC then this could be because of that. What is the connection status with MQ? Are there any connection errors with MQ.
    If you are using FCC in your Receiver JMS channel then just to confirm, first remove the FCC configuration and try to send a xml file. If the xml file goes in successfully then the problem is in your FCC configuration.

  • 10046 trace event

    Hi! please! help me find out about "10046 trace event" ...
    how to read this, is there any technique involved !..
    if you have any web links then do share it with me, any sort of documentation will be very helpful to me...
    cheers'
    Amit

    Time to buy, Carry and Jeff's, award winning book of 2004, 'Optimizing Oracle Performance'. They have explained about the trace in-detail. Worthy to have a copy of it.
    For time being, go to, www.hotsos and download papers related to 10046event from their library.
    Jaffar

  • How can i open a PDF bank statement in numbers so that the rows and columns contain properly aligned data from statement?

    how can i open a PDF bank statement in "numbers" so that the rows and columns contain properly aligned data from statement?

    Numbers can store pdfs pages or clippings but does not directly open pdf files.  To get the bank statement into Numbers as a table I would open the bank statment in Preview (or Skim) or some pdf viewer.
    Then hold the option key while selecting a column of data.
    Then copy
    Then switch to numbers and paste the column into a table
    Then repeat for the other columns in the pdf document
    It would be easier (in my opinion) to download the QFX or CSV version from your bank

  • Count the number of rows resulting from a select statement

    Hi,
    Is there any way of counting the number of rows resulting from a select statement. i.e I have a select distinct statement and I then want to perform an IF statement on the number of rows resulting from the select statement.
    Any help appreciated
    Thanks
    Gary

    Declare
    var1 number;
    Begin
    select count(distinct column_name) into
    var1 from table_name;
    If var1 > x Then
    End IF;
    End;
    Hope I understood the problem correctly
    null

  • 10046 trace event - Missing privileges

    Hi,
    Version 11201
    Please advice what privileges are missing :
    SQL> ALTER SESSION SET events '10046 trace name context forever, level 12';
    ERROR:
    ORA-01031: insufficient privileges
    Thanks

    AllYourDataBase wrote:
    I would guess the "alter session" privilege.I'd also guess that, but i have the documentation to prove it as well :)
    http://download.oracle.com/docs/cd/B19306_01/network.102/b14266/appendixa.htm#CHDIBAJE
    Note that the ALTER SESSION privilege is required for setting events. Very few database users should require the alter session privilege.
    SQL> ALTER SESSION SET EVENTS ........
    The alter session privilege is not required for other alter session commands.
    SQL> ALTER SESSION SET NLS_TERRITORY = FRANCE;
    "

  • ProjectUID selected from the reporting database from Project Server OnPublished event is taking some delay

    Hi all,
    I'm invoking a stored procedure from the reporting database from the project server onPublished event.  I'm having some issues in getting the details of that particular project from the published event handler.  This i noticed that there is some
    delay is taking place in moving the data(project uid )  from the published to the reporting database .
    My stored procedure select statement is as follows:
    SELECT ProjectUID, ProjectName FROM MSP_EpmProject_UserView
     WHERE ProjectUID=value
    This stored procedure is invoked from the onPublished event of the project server event handler where that particular projectuid is passed in that stored procedure.I have noticed that some delay is taking palce to move  the data into the reporting database. 
    My stored procedure got invoked from the onPublished event of the project server event handler before the delay is complete.  So the row selected from the stored procedure is alwys zero (0).  Is there any other method to wait for repoting database
    to get refreshed. Please help me .

    Hi sabithad,
    The issue you are facing is because of the conflict of permissions, event handlers always works through administrative user credentials whereas the project is open in edit mode by the logged-in user. And you are tyring to update custom field at the back
    end with Administrative credentials, while project queue is in process by logged-in users credentials. Its not gonna work this way :) 
    The best option is to use Javascript on your PDP using CEWP, you can either build your complete logic in JavaScript and place that code on your PDP. OR you can use the combination of JavaScript and PSI and create a webpart to be placed on PDP.
    below blog link willgive you directions to go ahead with, but for sure the solution to your query is
    JavaScript :)
    http://epmxperts.wordpress.com/2012/05/21/generate-unique-id-for-project-using-a-webpart/
    hope this helps.
    Khurram Jamshed - MBA, PMP, MCTS, MCITP (
    Blog, Twitter, Linkedin )
    If you found this post helpful, please “Vote as Helpful”. If it answered your question, please “Mark as Answer”.

  • What is the use of additon in up to 1 rows in SELECT statement

    Hi All,
             What is the use of up to 1 rows in select statement.
    for example
    SELECT kostl
          FROM pa0001
          INTO y_lv_kostl UP TO 1 ROWS
          WHERE pernr EQ pernr
          AND endda GE sy-datum.
        ENDSELECT.
    I'm unable to get in wat situations we hav to add up to 1 rows
    please help me out...
    Thanks,
    santosh.

    Hi,
    Use "select up to 1 rows" only if you are sure that all the records returned will have the same value for the field(s) you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the second or the third record has the value you are looking for.
    The System test result showed that the variant Single * takes less time than Up to 1 rows as there is an additional level for COUNT STOP KEY for SELECT ENDSELECT UP TO 1 ROWS.
    The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set.
    Regards,
    Bhaskar

  • Query Running Diffrence from STATS$EVENT_HISTOGRAM

    I am tiring to do some analysis on STATS$EVENT_HISTOGRAM (Created as Part of PERFSTAT).
    I would like to end up with a result set like this;
    SNAP_ID   SNAP_TIME                 DB_RESTART    WAIT_COUNT_LE_7MS   WAIT_COUNT_GT_7MS  TOTAL_WAIT_COUNT   WAIT_COUNT_PERCENT_LE_7MS  WAIT_COUNT_PERCENT_GT_7MS
    397          2/9/2012 2:02:39 PM    NO             3,311              16,261             19,572             16.92                      83.08
    398          2/9/2012 2:35:03 PM    NO             10,040             11,499             21,539             46.61                      53.39
    399          2/9/2012 5:02:22 PM    YES            11,137             113,916            225,053            49.38                      50.62
    400          2/9/2012 5:32:21 PM    NO             5,880              5,047              10,927             53.81                      46.19
    401          2/9/2012 6:02:21 PM    NO             1,342              3,004              4,346              30.88                      69.12The rules are (That I know of so far):
    1. All values are the difference from the previous SNAP_ID
    2. The first SNAP_ID has no previous values so it will not be included in result set. In our case this was SNAP_ID 396.
    3. When the STATS$SNAPSHOT.STARTUP_TIME changes from the previous row this indicates a DB_RESTART=YES.
    4. When DB_RESTART=YES do not subtract values from previous SNAP_ID.
    I am on Oracle 11.1.0.7
    Create STATS$EVENT_HISTOGRAM table:
    CREATE TABLE STATS$EVENT_HISTOGRAM
      SNAP_ID          NUMBER,
      DBID             NUMBER,
      INSTANCE_NUMBER  NUMBER,
      EVENT_ID         NUMBER,
      WAIT_TIME_MILLI  NUMBER,
      WAIT_COUNT       NUMBER
    );Load my data into STATS$EVENT_HISTOGRAM table:
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI,WAIT_COUNT)
    Values (396, 2359907137, 1, 2652584166, 1,47088592);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (396, 2359907137, 1, 2652584166, 2, 7397910);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (396, 2359907137, 1, 2652584166, 4, 1049509);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (396, 2359907137, 1, 2652584166, 8, 2384662);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (396, 2359907137, 1, 2652584166, 16, 12446589);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (396, 2359907137, 1, 2652584166, 32, 6698196);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (396, 2359907137, 1, 2652584166, 64, 934431);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (396, 2359907137, 1, 2652584166, 128, 655758);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (396, 2359907137, 1, 2652584166, 256, 213053);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (396, 2359907137, 1, 2652584166, 512, 73814);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (396, 2359907137, 1, 2652584166, 1024, 6088);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (396, 2359907137, 1, 2652584166, 2048, 1825);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (396, 2359907137, 1, 2652584166, 4096, 2169);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (396, 2359907137, 1, 2652584166, 8192, 3122);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (396, 2359907137, 1, 2652584166, 16384, 4144);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (396, 2359907137, 1, 2652584166, 32768, 330);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (396, 2359907137, 1, 2652584166, 65536, 662);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (396, 2359907137, 1, 2652584166, 131072, 9);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (396, 2359907137, 1, 2652584166, 262144, 28);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (396, 2359907137, 1, 2652584166, 524288, 22);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (397, 2359907137, 1, 2652584166, 1, 47091161);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (397, 2359907137, 1, 2652584166, 2, 7398497);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (397, 2359907137, 1, 2652584166, 4, 1049664);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (397, 2359907137, 1, 2652584166, 8, 2386574);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (397, 2359907137, 1, 2652584166, 16, 12454531);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (397, 2359907137, 1, 2652584166, 32, 6701651);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (397, 2359907137, 1, 2652584166, 64, 934831);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (397, 2359907137, 1, 2652584166, 128, 656657);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (397, 2359907137, 1, 2652584166, 256, 213223);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (397, 2359907137, 1, 2652584166, 512, 74218);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (397, 2359907137, 1, 2652584166, 1024, 6167);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (397, 2359907137, 1, 2652584166, 2048, 1869);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (397, 2359907137, 1, 2652584166, 4096, 2237);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (397, 2359907137, 1, 2652584166, 8192, 3317);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (397, 2359907137, 1, 2652584166, 16384, 4779);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (397, 2359907137, 1, 2652584166, 32768, 358);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (397, 2359907137, 1, 2652584166, 65536, 663);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (397, 2359907137, 1, 2652584166, 131072, 12);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (397, 2359907137, 1, 2652584166, 262144, 47);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (397, 2359907137, 1, 2652584166, 524288, 29);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (398, 2359907137, 1, 2652584166, 1, 47100463);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (398, 2359907137, 1, 2652584166, 2, 7399116);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (398, 2359907137, 1, 2652584166, 4, 1049783);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (398, 2359907137, 1, 2652584166, 8, 2387726);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (398, 2359907137, 1, 2652584166, 16, 12459548);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (398, 2359907137, 1, 2652584166, 32, 6704135);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (398, 2359907137, 1, 2652584166, 64, 935351);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (398, 2359907137, 1, 2652584166, 128, 657496);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (398, 2359907137, 1, 2652584166, 256, 213525);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (398, 2359907137, 1, 2652584166, 512, 74515);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (398, 2359907137, 1, 2652584166, 1024, 6224);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (398, 2359907137, 1, 2652584166, 2048, 1898);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (398, 2359907137, 1, 2652584166, 4096, 2323);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (398, 2359907137, 1, 2652584166, 8192, 3503);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (398, 2359907137, 1, 2652584166, 16384, 5229);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (398, 2359907137, 1, 2652584166, 32768, 381);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (398, 2359907137, 1, 2652584166, 65536, 671);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (398, 2359907137, 1, 2652584166, 131072, 20);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (398, 2359907137, 1, 2652584166, 262144, 68);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (398, 2359907137, 1, 2652584166, 524288, 49);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (399, 2359907137, 1, 2652584166, 1, 86466);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (399, 2359907137, 1, 2652584166, 2, 20937);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (399, 2359907137, 1, 2652584166, 4, 3734);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (399, 2359907137, 1, 2652584166, 8, 11128);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (399, 2359907137, 1, 2652584166, 16, 58220);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (399, 2359907137, 1, 2652584166, 32, 33902);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (399, 2359907137, 1, 2652584166, 64, 5707);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (399, 2359907137, 1, 2652584166, 128, 3308);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (399, 2359907137, 1, 2652584166, 256, 1149);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (399, 2359907137, 1, 2652584166, 512, 413);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (399, 2359907137, 1, 2652584166, 1024, 40);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (399, 2359907137, 1, 2652584166, 2048, 25);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (399, 2359907137, 1, 2652584166, 4096, 12);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (399, 2359907137, 1, 2652584166, 8192, 7);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (399, 2359907137, 1, 2652584166, 16384, 4);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (399, 2359907137, 1, 2652584166, 32768, 0);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (399, 2359907137, 1, 2652584166, 65536, 1);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (400, 2359907137, 1, 2652584166, 1, 88335);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (400, 2359907137, 1, 2652584166, 2, 24658);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (400, 2359907137, 1, 2652584166, 4, 4024);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (400, 2359907137, 1, 2652584166, 8, 11678);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (400, 2359907137, 1, 2652584166, 16, 61227);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (400, 2359907137, 1, 2652584166, 32, 35252);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (400, 2359907137, 1, 2652584166, 64, 5821);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (400, 2359907137, 1, 2652584166, 128, 3316);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (400, 2359907137, 1, 2652584166, 256, 1158);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (400, 2359907137, 1, 2652584166, 512, 421);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (400, 2359907137, 1, 2652584166, 1024, 41);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (400, 2359907137, 1, 2652584166, 2048, 25);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (400, 2359907137, 1, 2652584166, 4096, 12);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (400, 2359907137, 1, 2652584166, 8192, 7);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (400, 2359907137, 1, 2652584166, 16384, 4);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (400, 2359907137, 1, 2652584166, 32768, 0);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (400, 2359907137, 1, 2652584166, 65536, 1);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (401, 2359907137, 1, 2652584166, 1, 89498);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (401, 2359907137, 1, 2652584166, 2, 24811);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (401, 2359907137, 1, 2652584166, 4, 4050);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (401, 2359907137, 1, 2652584166, 8, 11919);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (401, 2359907137, 1, 2652584166, 16, 62776);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (401, 2359907137, 1, 2652584166, 32, 36157);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (401, 2359907137, 1, 2652584166, 64, 5993);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (401, 2359907137, 1, 2652584166, 128, 3424);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (401, 2359907137, 1, 2652584166, 256, 1181);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (401, 2359907137, 1, 2652584166, 512, 427);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (401, 2359907137, 1, 2652584166, 1024, 41);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (401, 2359907137, 1, 2652584166, 2048, 25);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (401, 2359907137, 1, 2652584166, 4096, 12);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (401, 2359907137, 1, 2652584166, 8192, 7);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (401, 2359907137, 1, 2652584166, 16384, 4);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (401, 2359907137, 1, 2652584166, 32768, 0);
    Insert into STATS$EVENT_HISTOGRAM (SNAP_ID, DBID, INSTANCE_NUMBER, EVENT_ID, WAIT_TIME_MILLI, WAIT_COUNT)
    Values (401, 2359907137, 1, 2652584166, 65536, 1);
    COMMIT;Create STATS$SNAPSHOT table:
    CREATE TABLE STATS$SNAPSHOT
      SNAP_ID               NUMBER,
      DBID                  NUMBER,
      INSTANCE_NUMBER       NUMBER,
      SNAP_TIME             DATE,
      STARTUP_TIME          DATE,
      SESSION_ID            NUMBER,
      SERIAL#               NUMBER,
      SNAP_LEVEL            NUMBER,
      UCOMMENT              VARCHAR2(160 BYTE),
      EXECUTIONS_TH         NUMBER,
      PARSE_CALLS_TH        NUMBER,
      DISK_READS_TH         NUMBER,
      BUFFER_GETS_TH        NUMBER,
      SHARABLE_MEM_TH       NUMBER,
      VERSION_COUNT_TH      NUMBER,
      SEG_PHY_READS_TH      NUMBER,
      SEG_LOG_READS_TH      NUMBER,
      SEG_BUFF_BUSY_TH      NUMBER,
      SEG_ROWLOCK_W_TH      NUMBER,
      SEG_ITL_WAITS_TH      NUMBER,
      SEG_CR_BKS_RC_TH      NUMBER,
      SEG_CU_BKS_RC_TH      NUMBER,
      SEG_CR_BKS_SD_TH      NUMBER,
      SEG_CU_BKS_SD_TH      NUMBER,
      SNAPSHOT_EXEC_TIME_S  NUMBER,
      ALL_INIT              VARCHAR2(5 BYTE),
      BASELINE              VARCHAR2(1 BYTE)
    );Load my data into STATS$SNAPSHOT table:
    Insert into STATS$SNAPSHOT
       (SNAP_ID, DBID, INSTANCE_NUMBER, SNAP_TIME, STARTUP_TIME,
        SESSION_ID, SERIAL#, SNAP_LEVEL, EXECUTIONS_TH, PARSE_CALLS_TH,
        DISK_READS_TH, BUFFER_GETS_TH, SHARABLE_MEM_TH, VERSION_COUNT_TH, SEG_PHY_READS_TH,
        SEG_LOG_READS_TH, SEG_BUFF_BUSY_TH, SEG_ROWLOCK_W_TH, SEG_ITL_WAITS_TH, SEG_CR_BKS_RC_TH,
        SEG_CU_BKS_RC_TH, SNAPSHOT_EXEC_TIME_S, ALL_INIT)
    Values
       (396, 2359907137, 1, TO_DATE('02/09/2012 13:32:26', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('01/05/2012 20:33:22', 'MM/DD/YYYY HH24:MI:SS'),
        0, 0, 7, 100, 1000,
        1000, 10000, 1048576, 20, 1000,
        10000, 100, 100, 100, 1000,
        1000, 21.92, 'FALSE');
    Insert into STATS$SNAPSHOT
       (SNAP_ID, DBID, INSTANCE_NUMBER, SNAP_TIME, STARTUP_TIME,
        SESSION_ID, SERIAL#, SNAP_LEVEL, EXECUTIONS_TH, PARSE_CALLS_TH,
        DISK_READS_TH, BUFFER_GETS_TH, SHARABLE_MEM_TH, VERSION_COUNT_TH, SEG_PHY_READS_TH,
        SEG_LOG_READS_TH, SEG_BUFF_BUSY_TH, SEG_ROWLOCK_W_TH, SEG_ITL_WAITS_TH, SEG_CR_BKS_RC_TH,
        SEG_CU_BKS_RC_TH, SNAPSHOT_EXEC_TIME_S, ALL_INIT)
    Values
       (397, 2359907137, 1, TO_DATE('02/09/2012 14:02:39', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('01/05/2012 20:33:22', 'MM/DD/YYYY HH24:MI:SS'),
        0, 0, 7, 100, 1000,
        1000, 10000, 1048576, 20, 1000,
        10000, 100, 100, 100, 1000,
        1000, 70.49, 'FALSE');
    Insert into STATS$SNAPSHOT
       (SNAP_ID, DBID, INSTANCE_NUMBER, SNAP_TIME, STARTUP_TIME,
        SESSION_ID, SERIAL#, SNAP_LEVEL, EXECUTIONS_TH, PARSE_CALLS_TH,
        DISK_READS_TH, BUFFER_GETS_TH, SHARABLE_MEM_TH, VERSION_COUNT_TH, SEG_PHY_READS_TH,
        SEG_LOG_READS_TH, SEG_BUFF_BUSY_TH, SEG_ROWLOCK_W_TH, SEG_ITL_WAITS_TH, SEG_CR_BKS_RC_TH,
        SEG_CU_BKS_RC_TH, SNAPSHOT_EXEC_TIME_S, ALL_INIT)
    Values
       (398, 2359907137, 1, TO_DATE('02/09/2012 14:35:03', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('01/05/2012 20:33:22', 'MM/DD/YYYY HH24:MI:SS'),
        0, 0, 7, 100, 1000,
        1000, 10000, 1048576, 20, 1000,
        10000, 100, 100, 100, 1000,
        1000, 14.28, 'FALSE');
    Insert into STATS$SNAPSHOT
       (SNAP_ID, DBID, INSTANCE_NUMBER, SNAP_TIME, STARTUP_TIME,
        SESSION_ID, SERIAL#, SNAP_LEVEL, EXECUTIONS_TH, PARSE_CALLS_TH,
        DISK_READS_TH, BUFFER_GETS_TH, SHARABLE_MEM_TH, VERSION_COUNT_TH, SEG_PHY_READS_TH,
        SEG_LOG_READS_TH, SEG_BUFF_BUSY_TH, SEG_ROWLOCK_W_TH, SEG_ITL_WAITS_TH, SEG_CR_BKS_RC_TH,
        SEG_CU_BKS_RC_TH, SNAPSHOT_EXEC_TIME_S, ALL_INIT)
    Values
       (399, 2359907137, 1, TO_DATE('02/09/2012 17:02:22', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('02/09/2012 15:24:06', 'MM/DD/YYYY HH24:MI:SS'),
        0, 0, 7, 100, 1000,
        1000, 10000, 1048576, 20, 1000,
        10000, 100, 100, 100, 1000,
        1000, 15.92, 'FALSE');
    Insert into STATS$SNAPSHOT
       (SNAP_ID, DBID, INSTANCE_NUMBER, SNAP_TIME, STARTUP_TIME,
        SESSION_ID, SERIAL#, SNAP_LEVEL, EXECUTIONS_TH, PARSE_CALLS_TH,
        DISK_READS_TH, BUFFER_GETS_TH, SHARABLE_MEM_TH, VERSION_COUNT_TH, SEG_PHY_READS_TH,
        SEG_LOG_READS_TH, SEG_BUFF_BUSY_TH, SEG_ROWLOCK_W_TH, SEG_ITL_WAITS_TH, SEG_CR_BKS_RC_TH,
        SEG_CU_BKS_RC_TH, SNAPSHOT_EXEC_TIME_S, ALL_INIT)
    Values
       (400, 2359907137, 1, TO_DATE('02/09/2012 17:32:21', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('02/09/2012 15:24:06', 'MM/DD/YYYY HH24:MI:SS'),
        0, 0, 7, 100, 1000,
        1000, 10000, 1048576, 20, 1000,
        10000, 100, 100, 100, 1000,
        1000, 2.77, 'FALSE');
    Insert into STATS$SNAPSHOT
       (SNAP_ID, DBID, INSTANCE_NUMBER, SNAP_TIME, STARTUP_TIME,
        SESSION_ID, SERIAL#, SNAP_LEVEL, EXECUTIONS_TH, PARSE_CALLS_TH,
        DISK_READS_TH, BUFFER_GETS_TH, SHARABLE_MEM_TH, VERSION_COUNT_TH, SEG_PHY_READS_TH,
        SEG_LOG_READS_TH, SEG_BUFF_BUSY_TH, SEG_ROWLOCK_W_TH, SEG_ITL_WAITS_TH, SEG_CR_BKS_RC_TH,
        SEG_CU_BKS_RC_TH, SNAPSHOT_EXEC_TIME_S, ALL_INIT)
    Values
       (401, 2359907137, 1, TO_DATE('02/09/2012 18:02:21', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('02/09/2012 15:24:06', 'MM/DD/YYYY HH24:MI:SS'),
        0, 0, 7, 100, 1000,
        1000, 10000, 1048576, 20, 1000,
        10000, 100, 100, 100, 1000,
        1000, 1.72, 'FALSE');
    COMMIT;

    Hi,
    Sky13 wrote:
    OK I have it working, I'm glad you got it working. When I tried to run your latest query, I got an error. On about the 7th line, I think you meant
    when lag(SS.STARTUP_TIME) over (order by SS.SNAP_ID) !=  SS.STARTUP_TIME then 'YES'This site doesn't like to display the <> inequality operator. When posting here, always use the other, equivalent inequality operator, !=.
    When I fix that, I get "no rows selected".
    but it is ugly! Any ideas on simplifying it?This is a little shorter, but still rather ugly:
    WITH     got_wait_time_grp    AS
         SELECT     snap_id
         ,     wait_count
         ,     CASE
                  WHEN  wait_time_milli <= 7
                  THEN  '<= 7'
                  ELSE  '> 7'
              END     AS wait_time_grp
         FROM    stats$event_histogram
         WHERE     event_id     = 2652584166
    ,     grouped_data     AS
         SELECT       ss.snap_id
         ,       ss.snap_time
         ,       eh.wait_time_grp
         ,       CASE
                    WHEN  ss.startup_time != LAG (ss.startup_time) OVER ( PARTITION BY  eh.wait_time_grp
                                                                              ORDER BY         ss.snap_id
                    THEN  'YES'
                    ELSE  'NO'
                END                              AS db_restart
         ,       SUM (eh.wait_count) - LAG ( SUM (eh.wait_count)
                                             , 1
                                 , 0
                                 ) OVER ( PARTITION BY  ss.startup_time
                                             ,                    eh.wait_time_grp
                                             ORDER BY          ss.snap_id
                                     )              AS wait_dif
         ,       DENSE_RANK () OVER (ORDER BY ss.snap_id)     AS dr
         FROM      stats$snapshot      ss
         ,       got_wait_time_grp       eh
         WHERE       ss.snap_id           = eh.snap_id
         AND       ss.snap_id           BETWEEN 396
                                AND      401
         GROUP BY  GROUPING SETS ( (ss.snap_id, ss.snap_time, ss.startup_time, eh.wait_time_grp)
                                   , (ss.snap_id, ss.snap_time, ss.startup_time)
    SELECT       snap_id, snap_time, db_restart
    ,       MIN (CASE WHEN wait_time_grp = '<= 7' THEN wait_dif END)     AS wait_count_le_7ms
    ,       MIN (CASE WHEN wait_time_grp = '> 7'  THEN wait_dif END)     AS wait_count_gt_7ms
    ,       MIN (CASE WHEN wait_time_grp IS NULL  THEN wait_dif END)     AS total_wait_count
    ,       MIN (CASE WHEN wait_time_grp = '<= 7' THEN wait_dif END) * 100
         / MIN (CASE WHEN wait_time_grp IS NULL  THEN wait_dif END)     AS wait_count_percent_le_7ms
    ,       MIN (CASE WHEN wait_time_grp = '> 7'  THEN wait_dif END) * 100
         / MIN (CASE WHEN wait_time_grp IS NULL  THEN wait_dif END)     AS wait_count_percent_gt_7ms
    FROM       grouped_data
    WHERE       dr     > 1
    GROUP BY  snap_id, snap_time, db_restart
    ORDER BY  snap_id
    ;Output:
    `                                                        WAIT_   WAIT_
                                     WAIT_   WAIT_          COUNT_  COUNT_
                             DB_    COUNT_  COUNT_  TOTAL_ PERCENT PERCENT
    SNAP                     RE        LE_     GT_   WAIT_    _LE_    _GT_
    _ID SNAP_TIME           START     7MS     7MS   COUNT     7MS     7MS
    397 2/9/2012 2:02:39 PM NO       3311   16261   19572   16.92   83.08
    398 2/9/2012 2:35:03 PM NO      10040   11499   21539   46.61   53.39
    399 2/9/2012 5:02:22 PM YES    111137  113916  225053   49.38   50.62
    400 2/9/2012 5:32:21 PM NO       5880    5047   10927   53.81   46.19
    401 2/9/2012 6:02:21 PM NO       1342    3004    4346   30.88   69.12

Maybe you are looking for

  • Face tagging to Facebook

    Faces is great. It would save me a ton of time when uploading photos to Facebook if all the time spent tagging and correcting Faces in Aperture would also carry over to tags on Facebook. Ok, granted, in the Facebook album, I see the person's name, bu

  • Operating System Variable for Deski LOVs

    Colleagues,  There is an OS variable which cached LOV for Desktop Intelligence reports running in the XI R2 Enterprise environment. The problem is I can't remember what it is, just that it has a long unwieldy name, something like DESKI_LOV_CACHE exce

  • WLCS 3.2 & WLS 6.0

    Does Weblogic Commerce & Personalization run on top of Weblogic Server 6.0 ?

  • Access to GridControl cells

    Hi all, I have several questions involving GridControl in JDeveloper 2.0: 1) Can I change the value of a cell in a GridControl using java code (e.g. in a validation event). I have seen some code examples using a method called ImmediateAccess.getValue

  • Should I get iWork's I bought office and i am thinking i should have got I works instead

    I would lile to Know if I should have got Iworks instead of office since microsoft like to link there products show you have to buy there's you cant delete just one idems there link together