First execution of sql statements is slow every morning

Dears,
we are running an oracle11g database (HP-UX Itanium) and have the following problem:
Every morning the first execution of statements is very slow.
After the first execution the statements are running fine.
Does anyone have an idea where this can come from?
Is it possible that the cache (shared pool, etc.) will be deleted every night (for example when new statistics are generated or something else)?
Regards,
Ilja

I think you are close to answering your question.
As you know, Oracle 11g has an automated job to run performance stats every night at approx. 10:00pm (until 2:00am).
This is run by the dbms_scheduler.
This could be causing the shared_pool to be flushed because it certainly uses it a lot. I have to manually flush the shared_pool every night in one of my databases before this job runs otherwise I get an ORA-01461.
But, what I'm surprised is that you have this problem only in the morning.
It seems you would want to pin your SQL in memory and perhaps set a profile for your execution.
You don't bounce your database every night, do you?

Similar Messages

  • Execution of SQL statement 'alter tablespace PSAPSR3

    Dear mastah,
    I trying extend tablesapce at oracle, but not succesfully, and have problem,
    maybe can help this issue..
    error problem add tablespace:
    BR0280I BRSPACE time stamp: 2014-01-06 10.27.31
    BR0370I Directory /oracle/SID/sapreorg/semxnacf created
    BR0280I BRSPACE time stamp: 2014-01-06 10.27.32
    BR0319I Control file copy created: /oracle/SID/sapreorg/semxnacf/cntrlSID.old 99106816
    BR0280I BRSPACE time stamp: 2014-01-06 10.27.32
    BR1088I Extending tablespace PSAPSR3...
    BR0280I BRSPACE time stamp: 2014-01-06 10.27.51
    BR0301E SQL error -59 at location BrSqlExecute-1, SQL statement:
    '/* BRSPACE */ alter tablespace PSAPSR3 add datafile '/oracle/SID/sapdata16/sr3_218/sr3.data218' size 4000M autoextend off'
    ORA-00059: maximum number of DB_FILES exceeded
    BR1017E Execution of SQL statement 'alter tablespace PSAPSR3 add datafile '/oracle/SID/sapdata16/sr3_218/sr3.data218' size 4000M autoextend off' failed
    BR0669I Cannot continue due to previous warnings or errors - you can go back to repeat the last action
    BR0280I BRSPACE time stamp: 2014-01-06 10.27.51
    BR0671I Enter 'b[ack]' to go back, 's[top]' to abort:
    regards,
    amin

    BR1088I Extending tablespace PSAPSR3...
    BR0280I BRSPACE time stamp: 2014-01-06 10.27.51
    BR0301E SQL error -59 at location BrSqlExecute-1, SQL statement:
    '/* BRSPACE */ alter tablespace PSAPSR3 add datafile '/oracle/SID/sapdata16/sr3_218/sr3.data218' size 4000M autoextend off'
    ORA-00059: maximum number of DB_FILES exceeded
    $ oerr ora 59
    00059, 00000, "maximum number of DB_FILES exceeded"
    // *Cause:  The value of the DB_FILES initialization parameter was exceeded.
    // *Action: Increase the value of the DB_FILES parameter and warm start.
    $

  • RMAN-11003: failure during parse/execution of SQL statement: alter session

    without doing any changes I have started getting the following error in the RMAN logs.
    i didnt any changes related to sort_area_size but getting the error below
    plz help guys
    RMAN logs
    =====================
    connected to recovery catalog database
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of allocate command at 12/03/2007 22:00:01
    RMAN-03014: implicit resync of recovery catalog failed
    RMAN-03009: failure of full resync command on default channel at 12/03/2007 22:00:01
    RMAN-11003: failure during parse/execution of SQL statement: alter session set sort_area_size=10485760
    ORA-00068: invalid value 10485760 for parameter sort_area_size, must be between 0 and 1

    Hi:
    It seems when you are starting RMAN it's executing some commands (one 'ALTER SESSION...'. It's seems to be a batch which has a bad value for SORT_AREA_SIZE. Find it and modify to a proper value as message shows. If you can't find start RMAN by calling directly the executable ($ORACLE_HOME/bin/rman or %ORACLE_HOME%/bin/rman.exe).

  • Execution of SQL Query to slow

    Hey all!!!
    I'm using 10g express edition with apex 3.1, when I run this query:
    select asig.idasig IDASIG, asig.idAsig "Código Asignatura", asig.idasig ID,substr(asig.codigoasig||' '||asig.nombre,0,40) "Asignatura", p.nombre||' '||p.apellidos "Responsable", t.usuario "Técnico", substr(ea.estado,0,22) "Estado Asignatura", ec.estado "Estado Certificado", cert.idestado
    from certificado cert, asignatura asig, histasig ha, profesor p, tecnico t, estado ea, estado ec
    where cert.idasig = asig.idasig and
    p.idprof = asig.idprof and
    t.idtecnico = asig.idtecnico and
    *(cert.idasig, cert.fecha) in (select idasig, max(fecha) from certificado group by idasig) and*
    ec.idestado = cert.idestado and
    ha.idasig = asig.idasig and
    *(ha.idasig, ha.fecha) in (select idasig, max(fecha) from histasig group by idasig) and*
    ea.idestado = ha.idestado
    It gets too slow, making the query gets results in approximately 149s.
    Someone can give me an idea...
    PD:The case is that we have another query that make almost the same but with this one I get the results in less than 1s.

    These are the results:
    TKPROF: Release 10.2.0.1.0 - Production on Mar Feb 10 10:35:58 2009
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Trace file: C:\oraclexe\app\oracle\admin\XE\udump\xe_ora_4724.trc
    Sort options: prsela  exeela  fchela 
    count    = number of times OCI procedure was executed
    cpu      = cpu time in seconds executing
    elapsed  = elapsed time in seconds executing
    disk     = number of physical reads of buffers from disk
    query    = number of buffers gotten for consistent read
    current  = number of buffers gotten in current mode (usually for update)
    rows     = number of rows processed by the fetch or execute call
    select asig.idasig ID1, asig.idAsig ID2, asig.idasig ID3,asig.codigoasig, asig.nombre, p.nombre,p.apellidos,t.usuario,ea.estado,ec.estado,cert.idestado
    from certificado cert, asignatura asig, histasig ha,  profesor p, tecnico t, estado ea, estado ec
    where cert.idasig = asig.idasig and
    p.idprof = asig.idprof and
    t.idtecnico = asig.idtecnico and
    (cert.idasig, cert.fecha) in (select idasig, max(fecha) from certificado group by idasig) and
    ec.idestado = cert.idestado and
    ha.idasig = asig.idasig and
    (ha.idasig, ha.fecha) in (select idasig, max(fecha) from histasig group by idasig) and
    ea.idestado = ha.idestado
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.15       0.14          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch       64    102.17     102.43          0     369673          0         937
    total       66    102.32     102.57          0     369673          0         937
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 36 
    Rows     Row Source Operation
        937  NESTED LOOPS  (cr=369673 pr=0 pw=0 time=102241172 us)
        937   NESTED LOOPS  (cr=368672 pr=0 pw=0 time=103609539 us)
        937    NESTED LOOPS  (cr=5030 pr=0 pw=0 time=97377 us)
        937     NESTED LOOPS  (cr=3082 pr=0 pw=0 time=72064 us)
        937      NESTED LOOPS  (cr=2081 pr=0 pw=0 time=55194 us)
        947       HASH JOIN RIGHT SEMI (cr=44 pr=0 pw=0 time=22573 us)
        947        VIEW  VW_NSO_1 (cr=17 pr=0 pw=0 time=4100 us)
        947         HASH GROUP BY (cr=17 pr=0 pw=0 time=3151 us)
       1659          INDEX FAST FULL SCAN PK_CERTIFICADO (cr=17 pr=0 pw=0 time=1728 us)(object id 15811)
       1659        MERGE JOIN  (cr=27 pr=0 pw=0 time=11173 us)
         39         TABLE ACCESS BY INDEX ROWID ESTADO (cr=10 pr=0 pw=0 time=286 us)
         39          INDEX FULL SCAN PK_ESTADO (cr=5 pr=0 pw=0 time=95 us)(object id 15790)
       1659         SORT JOIN (cr=17 pr=0 pw=0 time=7693 us)
       1659          INDEX FAST FULL SCAN PK_CERTIFICADO (cr=17 pr=0 pw=0 time=42 us)(object id 15811)
        937       TABLE ACCESS BY INDEX ROWID ASIGNATURA (cr=2037 pr=0 pw=0 time=31871 us)
        947        INDEX UNIQUE SCAN PK_ASIGNATURA (cr=1011 pr=0 pw=0 time=16230 us)(object id 15797)
        937      TABLE ACCESS BY INDEX ROWID TECNICO (cr=1001 pr=0 pw=0 time=14632 us)
        937       INDEX UNIQUE SCAN PK_TECNICO (cr=64 pr=0 pw=0 time=6532 us)(object id 15777)
        937     TABLE ACCESS BY INDEX ROWID PROFESOR (cr=1948 pr=0 pw=0 time=20712 us)
        937      INDEX UNIQUE SCAN PK_PROFESOR (cr=1001 pr=0 pw=0 time=11554 us)(object id 15795)
        937    INDEX RANGE SCAN PK_HISTASIG (cr=363642 pr=0 pw=0 time=102276685 us)(object id 15809)
        937     FILTER  (cr=361692 pr=0 pw=0 time=101967826 us)
    64914543      HASH GROUP BY (cr=361692 pr=0 pw=0 time=139395915 us)
    94619691       INDEX FAST FULL SCAN PK_HISTASIG (cr=361692 pr=0 pw=0 time=94752646 us)(object id 15809)
        937   TABLE ACCESS BY INDEX ROWID ESTADO (cr=1001 pr=0 pw=0 time=39308 us)
        937    INDEX UNIQUE SCAN PK_ESTADO (cr=64 pr=0 pw=0 time=15348 us)(object id 15790)
    alter session set sql_trace true
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        1      0.00       0.00          0          0          0           0
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 36 
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.15       0.14          0          0          0           0
    Execute      2      0.00       0.00          0          0          0           0
    Fetch       64    102.17     102.43          0     369673          0         937
    total       67    102.32     102.57          0     369673          0         937
    Misses in library cache during parse: 1
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute      0      0.00       0.00          0          0          0           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        0      0.00       0.00          0          0          0           0
    Misses in library cache during parse: 0
        2  user  SQL statements in session.
        0  internal SQL statements in session.
        2  SQL statements in session.
    Trace file: C:\oraclexe\app\oracle\admin\XE\udump\xe_ora_4724.trc
    Trace file compatibility: 10.01.00
    Sort options: prsela  exeela  fchela 
           1  session in tracefile.
           2  user  SQL statements in trace file.
           0  internal SQL statements in trace file.
           2  SQL statements in trace file.
           2  unique SQL statements in trace file.
         147  lines in trace file.
         134  elapsed seconds in trace file.We had seen that the possible problems are here:
    937               INDEX RANGE SCAN PK_HISTASIG (cr=363642 pr=0 pw=0 time=102276685 us)(object id 15809)
    64914543       HASH GROUP BY (cr=361692 pr=0 pw=0 time=139395915 us)
    94619691       INDEX FAST FULL SCAN PK_HISTASIG (cr=361692 pr=0 pw=0 time=94752646 us)(object id 15809)The time spent is too much, but we don't see how can we solve this problem, any idea?

  • Time of execution of SQL statement

    Hi,
    I executed some DML statements and Select statements as user SYS for user U1. How can I find the time of execution of these statements?
    Regards,
    Mathew

    You have a couple of options to time queries.
    SET TIMING ON has already been mentioned. I'll add that spooling the session to a file helps keep those timings for later reference.
    You can use DBMS_UTILITY.GET_TIME to get start and end times in microseconds for PL/SQL evaluation. DBMS_PROFILER will time lines of PL/SQL code as they execute. Trace/tkprof has also already been mentioned, although tkrpof times tend to vary a bit between reported and real times and don't take OS activity into account as much as the other timings do.

  • Connecting strings for execution as SQL-Statement

    Hello to all.
    I've the problem, that I want to write a package which handels occuring erros as far as possible automatically.
    One part is to recompile invalid objects.
    I can find all these objects by useing the following cursor:
    CURSOR curInvalidObjects
    IS SELECT OBJECT_TYPE, OWNER, OBJECT_NAME
              from dba_objects a
              where STATUS = 'INVALID' and
              OWNER = 'BESECKE' AND
              OBJECT_TYPE in ( 'PACKAGE BODY',
    'PACKAGE', 'FUNCTION', 'PROCEDURE',
    'TRIGGER', 'VIEW' )
              order by OWNER, OBJECT_TYPE, OBJECT_NAME;
    After opening the cursor I can go trough the records and recompile the objects with something like this:
    alter || recInvalidObjects.OBJECT_TYPE || ' '
    || recInvalidObjects.OWNER || '.' ||
    recInvalidObjects.OBJECT_NAME || compile;
    But that does not work. In this way I can't get any executable SQL-Statement. It just becomes a string, but it's not executable.
    I think it's a simple problem, but I tried to find anything about executable stings in the documentation I have, and I could not find anything. So can anybody give me a short hint, how to create an executable statement?
    Thanks a lot.
    Susanne Saalmann

    If you just recompile without taking the correct order of compilation into account, you will have to run your statement a couple of times. This script solves that:
    SET HEADING OFF
    SET FEEDBACK OFF
    SET PAGES 9999
    SET TIMING OFF
    SET TERMOUT ON
    COLUMN noprn NOPRINT
    SPOOL comp.sql
    SELECT 'ALTER '||
    DECODE( o.object_type, 'PACKAGE BODY', 'PACKAGE', o.object_type)||
    ' '||decode(o.object_type,'JAVA CLASS','"',null)||
    o.object_name || decode(o.object_type,'JAVA CLASS','"',null)||
    ' COMPILE '||
    DECODE( o.object_type, 'PACKAGE BODY', 'BODY;', ';'),
    COUNT( d.name ) noprn
    FROM user_objects o,
    user_dependencies d
    WHERE o.object_name = d.referenced_name(+)
    AND o.object_type = d.referenced_type(+)
    AND o.status = 'INVALID'
    GROUP BY o.object_name, o.object_type
    ORDER BY noprn DESC
    SPOOL OFF
    SET HEADING ON
    SET FEEDBACK ON
    SET PAGES 14
    START comp.sql
    SHOW USER
    SELECT object_type, status, count(*)
    FROM user_objects
    GROUP BY object_type, status

  • Procedure not checking each sql statement.

    Hi All,
    I have created 2 tables names are A1 and B1. A1 table has some fields. Fields are no,sal,comm.,load_date. In A1 table NO (column) is the primary key.
    Second table is B1. this table has id,phone_no and load_date. In this table constraint
    ID column is the Not null.
    After that I have created 2 procedures one for A1 and one for B1. with in those procedures I used SQL insert statements.
    In procedures I used some valid sql statements and some invalid statements ( invalid statements means that I have specified constraint that’s why I specified duplicated and null values). While executing the procedures procedure shows error because of invalid statement and in that procedures I did not specify any Exceptions.
    If I specify Exceptions in procedures executing successfully some records are not loading procedure is comeing out. How do we mention server needs to be check and every insert sql startement.
    EX:
    If I give 6 records from 1 to 3 valid statements. I mentioned 4 th record copy of previos record( duplicated). 5 th record and 6 th valid records.
    Procedure executing successfully. Procedure loaded 1 to 4 records after that not loaded 5,6 and 7 records. How do we specify for record inserts 7. actually 7 th record is valid statement we should be insert this record. Please tell me how do we handle sql statements each and every one successfully or not.
    create or replace procedure a_proc as
    --declare
    begin
    insert into a1 values (100,2000,300,sysdate);
    insert into a1 values(200,1000,400,sysdate);
    insert into a1 values(300,3000,500,sysdate);
    insert into a1 values(400,6000,600,sysdate);
    insert into a1 values(400,900,700,sysdate);
    insert into a1 values(400,10000,1200,sysdate);
    insert into a1 values(900,11000,1300,sysdate);
    commit;
    EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('ERROR - '||sqlerrm);
    end a_proc;
    In B1 table colums are ID,PHONE_NO and Load_date. ID is not null column.
    For B1 population I have created one procedure
    create or replace procedure b_proc as
    --declare
    begin
    insert into b1 values(1,123456,sysdate); -- 1 record
    insert into b1 (phone_no,load_date) values (7896538,sysdate); --2 record
    insert into b1 (phone_no) values(6763723458); ----3 record
    insert into b1 (phone_no) values(453465778); --4 record
    insert into b1 values(400,72894894,sysdate); --5 record
    insert into b1 values(500,72894894,sysdate); --6 record
    commit;
    EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('ERROR - '||sqlerrm);
    end b_proc;
    if I execute above procedure procedure executing successfully but procedure inserting only first record not inserting 5th and 6th record. How do we exception for 5th and 6th records also.
    Thanks and Regards,
    Venkat

    {color:#808080}{color:#333300}Hi,
    Please find answer to your question below:{color}
    Venkat: Procedure executing successfully. Procedure loaded 1 to 4 records after that not loaded 5,6 and 7 records. How do we specify for record inserts 7. actually 7 th record is valid statement we should be insert this record. Please tell me how do we handle sql statements each and every one successfully or not.
    {color}
    {color:#0000ff}Guna: The procedure hits an exception after 4th record, and does not process anymore as it exits out of the procedure, I believe the data is not committed as well. You need handle exceptions if the processing has to continue. Same is the belwo case as well
    {color}{color:#333300}Regards,
    Guna{color}

  • SQL Statement / index on function ??

    Hello
    My environment is : Oracle 9.2.0.7
    In "top sql sessions" I obtained that sql statement as below consumes many ressources.
    When I use "SQL Analyzer" ... no recommandation was specified but I wonder if an index on function may be use to optimize this request.
    I'd like to have your opinion on how to optimize this kind of request :
    SELECT trim(CARD_NUMBER) as CARD_NUMBER,
    trim(CUSTOMER.CLIENTS.CUSTOMER_ID) as CUSTOMER_ID,
    trim(LASTNAME) as LASTNAME,
    trim(FIRSTNAME) as FIRSTNAME,
    trim(EMAIL) as EMAIL,
    FROM CUSTOMER.CARTES, CUSTOMER.CLIENTS
    WHERE CUSTOMER.CARTES.CUSTOMER_ID = CUSTOMER.CLIENTS.CUSTOMER_ID
    AND trim(CUSTOMER.CARTES.CARD_NUMBER) = '1234567890'
    AND (trim(CUSTOMER.CLIENTS.POST_CODE)='12345')
    Plan execution is :
    SQL STATEMENT :
    JOIN
    TABLE ACCESS (FULL) CUSTOMER.CARTES
    TABLE ACCESS (FULL) CUSTOMER.CLIENTS
    Many thanks for any help.
    Regards,
    Guillaume

    AND trim(CUSTOMER.CARTES.CARD_NUMBER) =
    '1234567890'
    AND (trim(CUSTOMER.CLIENTS.POST_CODE)='12345')Yea function based index on trim(CUSTOMER.CARTES.CARD_NUMBER) and trim(CUSTOMER.CLIENTS.POST_CODE) might help.
    BUT I suggest to correct data insertion app and insert already trimmed data in your table to avoid such ugly queries.
    Gints Plivna
    http://www.gplivna.eu

  • Sql reporting services stops every 24 hours for a short time then restarts

    I have noticed that recently in sccm 2012 sp1 the sql reporting services stops every morning at 7:58 am and restarts after a minute or two.  The only entry in the event logs is when it stops.  I don't see anything tied in with it that stops or
    starts at the same time and there are no tasks or anything like that which would point to this time frame.  I just thought I would throw this out there to see if anyone had any ideas.  Usually with something of this nature there are some corresponding
    log entries that go beyond the service stopping, but in this case there isn't.  Thanks for any help you can provide.

    I think I found out what was going on.  I approached this from a different angle and was directed to the sql reporting services logs and found information on the reporting web server stopping.  Researching that yielded the following information. 
    It appears that this is a result of the SSRS Web Server recycling the App Domain, which is supposed to be a pretty normal process.  In fact, the configuration file for this process defaults to recycling the app domain twice daily.  This lines up
    with the time frame that the reporting service is stopping.  It restarts it in less that two minutes and logs the recyling in the reporting services log twice daily so why I'm not seeing this entry in the event logs twice daily or even every day must
    be a timing thing.  I think if it takes an extra millisecond or two to recycle the app domain, it dumps an entry into the windows event logs and the sccm component status monitoring.
    http://ask.sqlservercentral.com/questions/97176/reporting-web-server-stopped.html

  • Retrieve Crystal SQL statements without first submitting parameter values?

    Hi,
    I am retrieving SQL statements for Crystal reports without issue, but a large number of our reports have parameters and for these the following error is thrown when I try to retrieve the SQL statement via RAS using getSQLStatement():
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException: Missing parameter values.---- Error code:-2147217394 Error code name:missingParameterValueError
    I have a large number of reports I'd like to pull SQL for, so it's not feasible to have my script push parameter values to each and every report.  Is there a way to retrieve SQL statements without first pushing parameter values?
    Thanks

    Hello Jeremy.
    I found a Knowledge Base article that deals with the "Error code:-2147217394 Error code name:missingParameterValueError" error that you mention.  Perhaps you could take a look at the following KBase Article in the Service MarketPlace and see if any of it applies to your situation:
    KBase number: 1420593
    I also found KBase number "1420501 - Report parameters ignored when set by Java post processing code" that seems to deal with the same problem.
    Regards.
    - Robert

  • Just a helpful SAP note for slow SQL statements

    Hi Guys,
    Just wanted to share this SAP note with you. I am sure many of you might have gone through it.
    [SAP Note 155413 - Analysis of slow SQL statements|https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=155413]
    Cheers,
    Abu

    >
    ZAFCO ABAP wrote:
    > Hi Guys,
    >
    > Just wanted to share this SAP note with you. I am sure many of you might have gone through it.
    >
    > [SAP Note 155413 - Analysis of slow SQL statements|https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=155413]
    >
    > Cheers,
    > Abu
    Hi,
    I would bet not as many as you might think -  many questions here suffering form not GOING through
    the analysis before they post it here. 
    Meantime I think questions to SQL statement performance here will only be answered when the execution plan on the statement  is posted with it.
    bye
    yk

  • Multiple Executions Plans for the same SQL statement

    Dear experts,
    awrsqrpt.sql is showing multiple executions plans for a single SQL statement. How is it possible that one SQL statement will have multiple Executions Plans within the same AWR report.
    Below is the awrsqrpt's output for your reference.
    WORKLOAD REPOSITORY SQL Report
    Snapshot Period Summary
    DB Name         DB Id    Instance     Inst Num Release     RAC Host
    TESTDB          2157605839 TESTDB1               1 10.2.0.3.0  YES testhost1
                  Snap Id      Snap Time      Sessions Curs/Sess
    Begin Snap:     32541 11-Oct-08 21:00:13       248     141.1
      End Snap:     32542 11-Oct-08 21:15:06       245     143.4
       Elapsed:               14.88 (mins)
       DB Time:               12.18 (mins)
    SQL Summary                            DB/Inst: TESTDB/TESTDB1  Snaps: 32541-32542
                    Elapsed
       SQL Id      Time (ms)
    51szt7b736bmg     25,131
    Module: SQL*Plus
    UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL,0) + NVL(ACCT_DR_BAL,
    0)) FROM ACCT WHERE ACCT_TRN_DT = (:B1 ) AND TEST_ACC_NB = ACCT_ACC_NB(+)) WHERE
    TEST_BATCH_DT = (:B1 )
    SQL ID: 51szt7b736bmg                  DB/Inst: TESTDB/TESTDB1  Snaps: 32541-32542
    -> 1st Capture and Last Capture Snap IDs
       refer to Snapshot IDs witin the snapshot range
    -> UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL,0) + NVL(AC...
        Plan Hash           Total Elapsed                 1st Capture   Last Capture
    #   Value                    Time(ms)    Executions       Snap ID        Snap ID
    1   2960830398                 25,131             1         32542          32542
    2   3834848140                      0             0         32542          32542
    Plan 1(PHV: 2960830398)
    Plan Statistics                        DB/Inst: TESTDB/TESTDB1  Snaps: 32541-32542
    -> % Total DB Time is the Elapsed Time of the SQL statement divided
       into the Total Database Time multiplied by 100
    Stat Name                                Statement   Per Execution % Snap
    Elapsed Time (ms)                            25,131       25,130.7     3.4
    CPU Time (ms)                                23,270       23,270.2     3.9
    Executions                                        1            N/A     N/A
    Buffer Gets                               2,626,166    2,626,166.0    14.6
    Disk Reads                                      305          305.0     0.3
    Parse Calls                                       1            1.0     0.0
    Rows                                        371,735      371,735.0     N/A
    User I/O Wait Time (ms)                         564            N/A     N/A
    Cluster Wait Time (ms)                            0            N/A     N/A
    Application Wait Time (ms)                        0            N/A     N/A
    Concurrency Wait Time (ms)                        0            N/A     N/A
    Invalidations                                     0            N/A     N/A
    Version Count                                     2            N/A     N/A
    Sharable Mem(KB)                                 26            N/A     N/A
    Execution Plan
    | Id  | Operation                    | Name            | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | UPDATE STATEMENT             |                 |       |       |  1110 (100)|          |
    |   1 |  UPDATE                      | TEST            |       |       |            |          |
    |   2 |   TABLE ACCESS FULL          | TEST            |   116K|  2740K|  1110   (2)| 00:00:14 |
    |   3 |   TABLE ACCESS BY INDEX ROWID| ACCT            |     1 |    26 |     5   (0)| 00:00:01 |
    |   4 |    INDEX RANGE SCAN          | ACCT_DT_ACC_IDX |     1 |       |     4   (0)| 00:00:01 |
    Plan 2(PHV: 3834848140)
    Plan Statistics                        DB/Inst: TESTDB/TESTDB1  Snaps: 32541-32542
    -> % Total DB Time is the Elapsed Time of the SQL statement divided
       into the Total Database Time multiplied by 100
    Stat Name                                Statement   Per Execution % Snap
    Elapsed Time (ms)                                 0            N/A     0.0
    CPU Time (ms)                                     0            N/A     0.0
    Executions                                        0            N/A     N/A
    Buffer Gets                                       0            N/A     0.0
    Disk Reads                                        0            N/A     0.0
    Parse Calls                                       0            N/A     0.0
    Rows                                              0            N/A     N/A
    User I/O Wait Time (ms)                           0            N/A     N/A
    Cluster Wait Time (ms)                            0            N/A     N/A
    Application Wait Time (ms)                        0            N/A     N/A
    Concurrency Wait Time (ms)                        0            N/A     N/A
    Invalidations                                     0            N/A     N/A
    Version Count                                     2            N/A     N/A
    Sharable Mem(KB)                                 26            N/A     N/A
    Execution Plan
    | Id  | Operation                    | Name         | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | UPDATE STATEMENT             |              |       |       |     2 (100)|          |
    |   1 |  UPDATE                      | TEST         |       |       |            |          |
    |   2 |   TABLE ACCESS BY INDEX ROWID| TEST         |     1 |    28 |     2   (0)| 00:00:01 |
    |   3 |    INDEX RANGE SCAN          | TEST_DT_IND  |     1 |       |     1   (0)| 00:00:01 |
    |   4 |   TABLE ACCESS BY INDEX ROWID| ACCT         |     1 |    26 |     4   (0)| 00:00:01 |
    |   5 |    INDEX RANGE SCAN          | INDX_ACCT_DT |     1 |       |     3   (0)| 00:00:01 |
    Full SQL Text
    SQL ID       SQL Text
    51szt7b736bm UPDATE TEST SET TEST_TRN_DAY_CL = (SELECT (NVL(ACCT_CR_BAL, 0) +
                  NVL(ACCT_DR_BAL, 0)) FROM ACCT WHERE ACCT_TRN_DT = (:B1 ) AND PB
                 RN_ACC_NB = ACCT_ACC_NB(+)) WHERE TEST_BATCH_DT = (:B1 )Your input is highly appreciated.
    Thanks for taking your time in answering my question.
    Regards

    Oracle Lover3 wrote:
    Dear experts,
    awrsqrpt.sql is showing multiple executions plans for a single SQL statement. How is it possible that one SQL statement will have multiple Executions Plans within the same AWR report.If you're using bind variables and you've histograms on your columns which can be created by default in 10g due to the "SIZE AUTO" default "method_opt" parameter of DBMS_STATS.GATHER__STATS it is quite normal that you get different execution plans for the same SQL statement. Depending on the values passed when the statement is hard parsed (this feature is called "bind variable peeking" and enabled by default since 9i) an execution plan is determined and re-used for all further executions of the same "shared" SQL statement.
    If now your statement ages out of the shared pool or is invalidated due to some DDL or statistics gathering activity it will be re-parsed and again the values passed in that particular moment will determine the execution plan. If you have skewed data distribution and a histogram in place that reflects that skewness you might get different execution plans depending on the actual values used.
    Since this "flip-flop" behaviour can sometimes be counter-productive if you're unlucky and the values used to hard parse the statement leading to a plan that is unsuitable for the majority of values used afterwards, 11g introduced the "adaptive" cursor sharing that attempts to detect such a situation and can automatically re-evaluate the execution plan of the statement.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Find start and end execution time of a sql statement?

    I am have databases with 10.2.0.3 and 9.2.0.8 on HP UNIX 11i and Windows 200x.
    I am not in a position to turn on sql tracing in production environment. Yet, I want to find when a sql statement started executing and when it ended. When I look at v$sql, it has information such FIRST_LOAD_TIME, LAST_LOAD_TIME etc. No where it has information last time statement began execution and when it ended execution.. It shows no of executions, elapsed time etc, but they are cumulative. Is there a way to find individual times (time information each time a sql statement was executed. – its start time, its end time ….)? If I were to write my own program how will I do it?
    Along the same line, when an AWR snapshot is shown, does it only include statements executed during that snapshot or it can have statements from the past if they have not been flushed from shared memory. If it only has statements executed in the snapshot period, how does it know when statement began execution?

    Hi,
    For oracle 10g you can use below query to find start and end time, you can see data for last seven days.
    select min(to_char(a.sample_time,'DD-MON-YY HH24:MI:SS')) "Start time", max(to_char(a.sample_time,'DD-MON-YY HH24:MI:SS')) "End Time", b.sql_text
    from dba_HIST_ACTIVE_SESS_HISTORY a,DBA_HIST_SQLTEXT b where
    a.sql_id=b.sql_id
    order by 1;
    Regards
    Jafar

  • SQL statement with Function returns slow in Interactive Report

    I have an Interactive Report that returns well but when I add in a function call in the where clause that does nothing but return a hard coded string of primary keys and is compared to a table's primary key with a like operator the performance tanks. Here is the example:
    get_school2_section(Y.pk_id,M.pk_id,I.section,:P577_SECTION_SHUTTLE) LIKE '%:' || I.pk_id || ':%'
    I have the values hard coded in the return of the function. There are no cursors run in the function, there is no processing done in the function. It only declares a variable. Sets the variable, and returns that variable back to the SQL statement.
    I can hard code the where clause value to look like this:
    ':90D8D830A877CCFFE040010A347D1A50:8ED0BBFDEAACC629E040010A347D6471:9800B8FDBD22B761E040010A347D0D9A:' LIKE '%:' || I.pk_id || ':%'
    This returns fast. When I add in the function call which returns the same hard coded values, the page goes from returning in 1 to 2 seconds to 45 or more seconds.
    Why does adding a simple function call into the where clause cause such a deterioration in performance.
    Edited by: alamantia on Aug 17, 2011 7:39 AM
    Edited by: alamantia on Aug 17, 2011 7:40 AM

    So you are telling me that the where clause with a function call will NOT run the function on every row? Please explain that to me further?
    if you have code that is the following:
    select a,b,c from a_table where a > 2 and b < 3 and function_call(c) > 0You are telling me that Oracle will NOT call that function on EVERY row it tries to process in the select?
    Thank you,
    Tony Miller
    Webster, TX
    I cried because I did not have an office with a door until I met a man who had no cubicle.
    -Dilbert
    If this question is answered, please mark the thread as closed and assign points where earned..

  • How to retrieve first update SQL statement initiator (locking)

    Hi!
    i have a table called as
    test ( A number, B varchar2(10));
    1) inserted 1000 records
    2) update test set A=A where A=1;
    3) open new session issue update test set B=B where A=1;
    reselt lock;
    opened again a new session and issued this statement
    COLUMN blocker format a15
    COLUMN blockee format a15
    SELECT (SELECT username || '.' || a.SID FROM v$session
    WHERE SID = a.SID ) blocker, ' is blocking ',
    (SELECT username || '.' || b.SID FROM v$session
    WHERE SID = b.SID ) blockee, ' from executing: ',
    (SELECT sql_text FROM sys.V_$SQL
    WHERE address =
    (SELECT sql_address FROM v$session WHERE SID = b.SID ) )
    FROM v$lock a, v$lock b
    WHERE a.BLOCK = 1 AND b.request > 0 AND a.id1 = b.id1 AND a.id2 = b.id2;
    Result as:-
    BLOCKER 'ISBLOCKING' BLOCKEE 'FROMEXECUTING:'
    (SELECTSQL_TEXTFROMSYS.V_$SQLWHEREADDRESS=(SELECTSQL_ADDRESSFROMV$SESSIONWHERESI
    SYS.159 is blocking SYS.144 from executing:
    UPDATE TEST SET B=B WHERE A=1
    question is how can i retrieve my first update sql statement i:e (initiator)....?
    as (UPDATE TEST SET A=A WHERE A=1;)
    Regards,

    Since releasing 10.2.0.1 several years ago Oracle has released patches to 10.2.0.2, 10.2.0.3, and 10.2.0.4. I would highly recommend you read the patch notes and get your system current.
    I note that you did not answer my two follow-up questions leading me to assume you do not have the license to look at the tables and views supporting ASH and AWR. Without them I do not believe you can retrieve the information you seek.
    I no longer have 10gR2 on my laptop so I am not sure but take a look at gv$session.
    Do you have columns named "BLOCKING_SESSION_STATUS", "BLOCKING_INSTANCE" and "BLOCKING_SESSION"? If you do that might lead you to a way you could track it down via gv$sql.

Maybe you are looking for

  • Display Document Set Columns Within The Document Set

    Hello all! Hopefully you all can let me know if the idea I have in my head is possible: Background: I have a Document Library with a custom made Document Set that has about 15 columns. The way I initially designed this, I left about 10 of the fields

  • Encoding conversion in Swing?

    Hi, In working with text file, there is a default encoding to convert the charset into java String. We can check it with System.getProperty("file.encoding"). How about in Swing component? Is there another default encoding to convert the text input in

  • Another Caller Display Problem

    My caller display stopped working today at 14.00hrs and dispite reporting it several times and getting a text saying its now fixed, its not working. I have no filters and a filtered face plate, on infinity broadband and tried 2 new bt phones and they

  • Running abap programs using the macros

    In our DP implementation we have faced several issues in the extraction of the data from the demand planning to one of the legacy system. We have written the ABAP program and would be using the read planning book bapi. I wanted to run the ABAP progra

  • Netca is not running (Enterprise Edition Release 10.2.0.1.0)

    Hi, How do I resolve this problem without having to reinstall something? I can not run the application netca the Linux server. Give the following stack of error: [oracle@<server machine>] $ netca Oracle Net Services Configuration: java.lang.NullPoint