Tkprof in client

This is what i do in my server to see the tkprof
-- setting user_dump_dest
alter system set user_dump_dest="/home/oracle/trace";
alter session set tracefile_identifier ="trace1";
ALTER SESSION SET SQL_TRACE = TRUE;
tkprof /home/oracle/trace/ora_16095_trace1.trc /home/oracle/trace/out.prf explain=scott/tiger SYS=NO
How can i do this same in my client .where i wont be having any idea about the server folders
need help on this or any articles

Hi
I need an user trace whenever he connects or whatever he does either by hitting
database through an application or running it using sqlplus.At page 69 of TOP I wrote the following...
The simplest approach is to create a logon trigger at the database level. To avoid enabling
SQL trace for all users, I usually suggest creating a role (named sql_trace in the following
example) and temporarily granting it only to the user utilized for the test. Naturally, it is also
possible to define the trigger for a single schema or perform other checks based, for example,
on the userenv context. Note that in addition to enabling SQL trace, it is good practice to set the
other parameters related to SQL trace as well (more about them later in this chapter).
CREATE ROLE sql_trace;
CREATE OR REPLACE TRIGGER enable_sql_trace AFTER LOGON ON DATABASE
BEGIN
  IF (dbms_session.is_role_enabled('SQL_TRACE'))
  THEN
    EXECUTE IMMEDIATE 'ALTER SESSION SET timed_statistics = TRUE';
    EXECUTE IMMEDIATE 'ALTER SESSION SET max_dump_file_size = unlimited';
   dbms_monitor.session_trace_enable;
  END IF;
END;
/HTH
Chris Antognini
Troubleshooting Oracle Performance, Apress 2008
http://top.antognini.ch

Similar Messages

  • Run TKPROF from oracle client machine

    Hello,
    I have install on my PC (windows xp sp2), Oracle Client, and I need TKPROF to speed up some query; Can I install TKPROF on my PC or it is necessary to run TKPROF from the server? What rights should I ask on my DBA?
    Thank you!
    XaM

    Thanks for your answer Graham,
    but i want to run
    something like this (from oracle documentations)
    tkprof filename1 filename2 [waits=yes|no] [sort=option] [print=n]
    [aggregate=yes|no] [insert=filename3] [sys=yes|no] [table=schema.table]
    [explain=user/password] [record=filename4] [width=n]
    Can i do that only with Oracle Client install? tkprof.exe isn't on my machine :( .
    XaM

  • Help to read TKPROF file in correct way

    Hi,
    I need help to understand what is going wrong.
    I have one query executed with different bind variables values.
    Case 1: Execution time is about 7.5 hours when :v6=:v3=:v4 (these are date bind variables values)
    Case 2: Execution time is about 2 minuteswhen :v6 differs from :v3 and :v4, but :v3=:v4 (these are date bind variables values)
    You can see TKPROF files below
    Case1
    SELECT EK.SECIK AS EK_SECIK,S.SECIK AS S_SECIK,EK.EQKEY1 AS EK_EQKEY1,EK.FROMDATE AS EK_FROMDATE,S.SECSHORT AS S_SECSHORT,S.SECNAME AS S_SECNAME,C.CDY AS C_CDY,C.CSTD AS C_CSTD,P.PAR AS P_PAR,P.PARIK AS P_PARIK,PH.ACCOUNTING_FRAMEWORK AS PH_ACC_FW,NVL(PH.BAL_NOMINAL_NUMBER,0) AS PH_BAL_NOM_NUM,PH.FROM_DATE AS PH_FROM_DATE,PH.POR AS PH_POR,PH.SEC_SHORT_NAME AS PH_SEC_SHORT_NAME,PH.TO_DATE AS PH_TO_DATE,PH.CUSTODY_SHORT_NAME AS PH_CUST_SHORT_NAME,T.TC_CSTD AS T_CSTD,SUM(T.TH_BAL_NOM_NUM) AS T_BAL_NOM_NUM,T.TH_SEC_SHORT_NAME AS T_SEC_SHORT_NAME,PH.POR_REF AS PH_POR_REF,PORT.PORIK AS PORT_PORIK,PORT.PORGRPIK AS PORT_PORGRPIK,PG.PORGRPIK AS PG_PORGRPIK,PG.PORGRPTYPEIK AS PG_PORGRPTYPEIK,PGT.PORGRPTYPEIK AS PGT_PORGRPTYPEIK FROM SCDAT.CUSTODIES C,SCDAT.EQUITYKEYS EK,SCDAT.PARTNERS P,SCDAT.PORTGROUPS PG,SCDAT.PORTGROUPTYPES PGT,(
    SELECT  HOLKEYS.PORIK As POR_REF,
    ACCDEF.ACC As ACCOUNTING_FRAMEWORK,
    NVL(HOLDINGS.BALNOMVAL,0) As BAL_NOMINAL_NUMBER,
    CUSTODIES.CDY As CUSTODY_SHORT_NAME,
    DECODE(HOLDINGS.FINBOOKED,0,'No',1,'Yes',' ') As FINALLY_BOOKED,
    HOLDINGS.FROMDATE As FROM_DATE,
    PORTFOLIOS.POR As POR,
    SECURITIES.SECSHORT As SEC_SHORT_NAME,
    HOLDINGS.TODATE As TO_DATE,
    HOLDINGS.FINBOOKED As X_FINALLY_BOOKED
    FROM HOLDINGS,HOLKEYS,ACCDEF,CUSTODIES,PORTFOLIOS,SECURITIES WHERE HOLDINGS.HOLKEYIK = HOLKEYS.HOLKEYIK AND HOLDINGS.ACCIK = ACCDEF.ACCIK AND HOLKEYS.CDYIK = CUSTODIES.CDYIK AND HOLKEYS.PORIK = PORTFOLIOS.PORIK AND HOLKEYS.SECIK = SECURITIES.SECIK) PH,SCDAT.PORTFOLIOS PORT,SCDAT.SECURITIES S,(SELECT TC.CDY AS TC_CDY,TC.CSTD AS TC_CSTD,SUM(NVL(TH.BAL_NOMINAL_NUMBER,0)) AS TH_BAL_NOM_NUM,TH.FROM_DATE AS TH_FROM_DATE,TH.TO_DATE AS TH_TO_DATE,TH.SEC_SHORT_NAME AS TH_SEC_SHORT_NAME,TH.CUSTODY_SHORT_NAME AS TH_CUST_SHORT_NAME,TP.PAR AS TP_PAR,TP.PARIK AS TP_PARIK FROM SCDAT.CUSTODIES TC,(
    SELECT  ACCDEF.ACC As ACCOUNTING_FRAMEWORK,
    NVL(HOLDINGS.BALNOMVAL,0) As BAL_NOMINAL_NUMBER,
    CUSTODIES.CDY As CUSTODY_SHORT_NAME,
    DECODE(HOLDINGS.FINBOOKED,0,'No',1,'Yes',' ') As FINALLY_BOOKED,
    HOLDINGS.FROMDATE As FROM_DATE,
    SECURITIES.SECSHORT As SEC_SHORT_NAME,
    HOLDINGS.TODATE As TO_DATE,
    HOLDINGS.FINBOOKED As X_FINALLY_BOOKED
    FROM HOLDINGS,HOLKEYS,ACCDEF,CUSTODIES,SECURITIES WHERE HOLDINGS.ACCIK = ACCDEF.ACCIK AND HOLDINGS.HOLKEYIK = HOLKEYS.HOLKEYIK AND HOLKEYS.CDYIK = CUSTODIES.CDYIK AND HOLKEYS.SECIK = SECURITIES.SECIK) TH,SCDAT.PARTNERS TP WHERE TH.CUSTODY_SHORT_NAME = TC.CDY AND TC.CSTD = TP.PARIK AND TH.ACCOUNTING_FRAMEWORK = :v1  AND NOT (NVL(TH.BAL_NOMINAL_NUMBER,0) = :v2 )  AND TH.FROM_DATE <= :v3  AND TH.TO_DATE >= :v4  AND TH.FINALLY_BOOKED = :v5  GROUP BY TC.CDY,TC.CSTD,TH.FROM_DATE,TH.TO_DATE,TH.SEC_SHORT_NAME,TH.CUSTODY_SHORT_NAME,TP.PAR,TP.PARIK) T WHERE EK.SECIK = S.SECIK AND PORT.PORGRPIK = PG.PORGRPIK AND PG.PORGRPTYPEIK = PGT.PORGRPTYPEIK AND S.SECSHORT = PH.SEC_SHORT_NAME AND PH.SEC_SHORT_NAME = T.TH_SEC_SHORT_NAME AND PH.POR_REF = PORT.PORIK AND PH.CUSTODY_SHORT_NAME = C.CDY AND EK.FROMDATE = :v6  AND NOT (EK.EQKEY1 = :v7 )  AND P.PAR = :v8  AND NOT (PGT.PORGRPTYPE IN (:v9 ,:v10  ))  AND PH.ACCOUNTING_FRAMEWORK = :v11   AND NOT (NVL(PH.BAL_NOMINAL_NUMBER,0) = :v12  )  AND PH.FINALLY_BOOKED = :v13   AND EK.FROMDATE >= PH.FROM_DATE AND EK.FROMDATE <= PH.TO_DATE AND C.CSTD = P.PARIK AND C.CSTD = T.TC_CSTD GROUP BY EK.SECIK,S.SECIK,EK.EQKEY1,EK.FROMDATE,S.SECSHORT,S.SECNAME,C.CDY,C.CSTD,P.PAR,P.PARIK,PH.ACCOUNTING_FRAMEWORK,NVL(PH.BAL_NOMINAL_NUMBER,0),PH.FROM_DATE,PH.POR,PH.SEC_SHORT_NAME,PH.TO_DATE,PH.CUSTODY_SHORT_NAME,T.TC_CSTD,T.TH_SEC_SHORT_NAME,PH.POR_REF,PORT.PORIK,PORT.PORGRPIK,PG.PORGRPIK,PG.PORGRPTYPEIK,PGT.PORGRPTYPEIK
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      2.31       2.31          0          0          0           0
    Fetch        1  27398.48   27473.33      11124  250891597          0           0
    total        3  27400.79   27475.65      11124  250891597          0           0
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 171  (SCDAT)
    Number of plan statistics captured: 1
    Rows (1st) Rows (avg) Rows (max)  Row Source Operation
             0          0          0  HASH GROUP BY (cr=0 pr=0 pw=0 time=55 us cost=1976 size=251 card=1)
           123        123        123   NESTED LOOPS  (cr=250890161 pr=11086 pw=0 time=35602462 us)
         38622      38622      38622    NESTED LOOPS  (cr=250858945 pr=8664 pw=0 time=4221237335 us cost=1975 size=251 card=1)
          3945       3945       3945     NESTED LOOPS  (cr=250850948 pr=7835 pw=0 time=1967017649 us cost=1937 size=199 card=1)
          3833       3833       3833      HASH JOIN  (cr=42840 pr=6196 pw=0 time=4910380 us cost=1559 size=1956 card=12)
          8667       8667       8667       NESTED LOOPS  (cr=42834 pr=6192 pw=0 time=4254867 us)
          8667       8667       8667        NESTED LOOPS  (cr=34167 pr=6192 pw=0 time=4232686 us cost=1556 size=2156 card=14)
          8667       8667       8667         NESTED LOOPS  (cr=26520 pr=6192 pw=0 time=4206426 us cost=1542 size=2058 card=14)
          8667       8667       8667          NESTED LOOPS  (cr=16041 pr=6192 pw=0 time=4161555 us cost=1528 size=1806 card=14)
         18060      18060      18060           NESTED LOOPS  (cr=16037 pr=6191 pw=0 time=4575478 us cost=1527 size=36504 card=312)
           177        177        177            NESTED LOOPS  (cr=6846 pr=6091 pw=0 time=3909468 us cost=1350 size=1500 card=15)
           177        177        177             NESTED LOOPS  (cr=6490 pr=6091 pw=0 time=3907157 us cost=1320 size=1245 card=15)
           177        177        177              NESTED LOOPS  (cr=6133 pr=6091 pw=0 time=3905733 us cost=1305 size=585 card=15)
             1          1          1               NESTED LOOPS  (cr=5 pr=2 pw=0 time=17096 us cost=2 size=23 card=1)
             1          1          1                TABLE ACCESS BY INDEX ROWID ACCDEF (cr=2 pr=2 pw=0 time=17079 us cost=1 size=12 card=1)
             1          1          1                 INDEX UNIQUE SCAN ACCDEF_IX1 (cr=1 pr=1 pw=0 time=6675 us cost=0 size=0 card=1)(object id 103661)
             1          1          1                TABLE ACCESS BY INDEX ROWID PARTNERS (cr=3 pr=0 pw=0 time=14 us cost=1 size=11 card=1)
             1          1          1                 INDEX UNIQUE SCAN PARTNERS_IX1 (cr=2 pr=0 pw=0 time=9 us cost=0 size=0 card=1)(object id 91563)
           177        177        177               TABLE ACCESS FULL EQUITYKEYS (cr=6128 pr=6089 pw=0 time=3888376 us cost=1303 size=240 card=15)
           177        177        177              TABLE ACCESS BY INDEX ROWID SECURITIES (cr=357 pr=0 pw=0 time=1127 us cost=1 size=44 card=1)
           177        177        177               INDEX UNIQUE SCAN P_SECURITIES (cr=180 pr=0 pw=0 time=563 us cost=0 size=0 card=1)(object id 93819)
           177        177        177             TABLE ACCESS BY INDEX ROWID SECURITIES (cr=356 pr=0 pw=0 time=2027 us cost=2 size=17 card=1)
           177        177        177              INDEX RANGE SCAN SECURITIES_IX2 (cr=180 pr=0 pw=0 time=1166 us cost=1 size=0 card=1)(object id 93809)
         18060      18060      18060            TABLE ACCESS BY INDEX ROWID HOLKEYS (cr=9191 pr=100 pw=0 time=716100 us cost=13 size=340 card=20)
         18060      18060      18060             INDEX RANGE SCAN I_HOLKEYS_SECPOR (cr=421 pr=100 pw=0 time=689634 us cost=2 size=0 card=23)(object id 98864)
          8667       8667       8667           TABLE ACCESS BY INDEX ROWID CUSTODIES (cr=4 pr=1 pw=0 time=131716 us cost=1 size=12 card=1)
         36120      36120      36120            INDEX RANGE SCAN R_CUSTODIES_CSTD (cr=3 pr=1 pw=0 time=53659 us cost=0 size=0 card=3)(object id 101437)
          8667       8667       8667          TABLE ACCESS BY INDEX ROWID PORTFOLIOS (cr=10479 pr=0 pw=0 time=36782 us cost=1 size=18 card=1)
          8667       8667       8667           INDEX UNIQUE SCAN P_PORTFOLIOS (cr=1812 pr=0 pw=0 time=14722 us cost=0 size=0 card=1)(object id 91399)
          8667       8667       8667         INDEX UNIQUE SCAN P_PORTGROUPS (cr=7647 pr=0 pw=0 time=20935 us cost=0 size=0 card=1)(object id 95885)
          8667       8667       8667        TABLE ACCESS BY INDEX ROWID PORTGROUPS (cr=8667 pr=0 pw=0 time=15075 us cost=1 size=7 card=1)
             3          3          3       VIEW  index$_join$_005 (cr=6 pr=4 pw=0 time=17822 us cost=3 size=45 card=5)
             3          3          3        HASH JOIN  (cr=6 pr=4 pw=0 time=17816 us)
             5          5          5         INDEX FAST FULL SCAN PORTGROUPTYPES_IX1 (cr=3 pr=2 pw=0 time=10731 us cost=1 size=45 card=5)(object id 95857)
             3          3          3         INDEX FAST FULL SCAN P_PORTGROUPTYPES (cr=3 pr=2 pw=0 time=6182 us cost=1 size=45 card=5)(object id 95858)
          3945       3945       3945      VIEW PUSHED PREDICATE  (cr=250808108 pr=1639 pw=0 time=1615801762 us cost=32 size=36 card=1)
          3945       3945       3945       SORT GROUP BY (cr=250808108 pr=1639 pw=0 time=1615792437 us cost=32 size=86 card=1)
          8052       8052       8052        NESTED LOOPS  (cr=250808108 pr=1639 pw=0 time=3245096176 us cost=31 size=86 card=1)
       6879822    6879822    6879822         NESTED LOOPS  (cr=14142041 pr=0 pw=0 time=93287445 us cost=18 size=53 card=1)
          7665       7665       7665          MERGE JOIN CARTESIAN (cr=3980 pr=0 pw=0 time=214689 us cost=5 size=40 card=1)
          7665       7665       7665           NESTED LOOPS  (cr=3846 pr=0 pw=0 time=75334 us cost=3 size=23 card=1)
          3833       3833       3833            TABLE ACCESS BY INDEX ROWID PARTNERS (cr=3842 pr=0 pw=0 time=38447 us cost=2 size=11 card=1)
          3833       3833       3833             INDEX UNIQUE SCAN P_PARTNERS (cr=9 pr=0 pw=0 time=13355 us cost=1 size=0 card=1)(object id 91507)
          7665       7665       7665            TABLE ACCESS BY INDEX ROWID CUSTODIES (cr=4 pr=0 pw=0 time=34661 us cost=1 size=12 card=1)
          7665       7665       7665             INDEX RANGE SCAN R_CUSTODIES_CSTD (cr=3 pr=0 pw=0 time=23093 us cost=0 size=0 card=1)(object id 101437)
          7665       7665       7665           BUFFER SORT (cr=134 pr=0 pw=0 time=128191 us cost=4 size=17 card=1)
          7665       7665       7665            TABLE ACCESS BY INDEX ROWID SECURITIES (cr=134 pr=0 pw=0 time=44771 us cost=2 size=17 card=1)
          7665       7665       7665             INDEX RANGE SCAN SECURITIES_IX2 (cr=109 pr=0 pw=0 time=32098 us cost=1 size=0 card=1)(object id 93809)
       6879822    6879822    6879822          TABLE ACCESS BY INDEX ROWID HOLKEYS (cr=14138061 pr=0 pw=0 time=99798296 us cost=13 size=13 card=1)
      27845684   27845684   27845684           INDEX RANGE SCAN I_HOLKEYS_SECPOR (cr=92999 pr=0 pw=0 time=21161648 us cost=2 size=0 card=23)(object id 98864)
          8052       8052       8052         VIEW PUSHED PREDICATE  VW_GBC_22 (cr=236667503 pr=1677 pw=0 time=1559090990 us cost=13 size=33 card=1)
          8052       8052       8052          SORT GROUP BY (cr=236667503 pr=1677 pw=0 time=1552356479 us cost=13 size=64 card=1)
          8052       8052       8052           HASH JOIN  (cr=236667503 pr=1677 pw=0 time=1518269306 us cost=12 size=64 card=1)
       6879822    6879822    6879822            TABLE ACCESS BY INDEX ROWID ACCDEF (cr=13759644 pr=0 pw=0 time=58085525 us cost=1 size=12 card=1)
       6879822    6879822    6879822             INDEX UNIQUE SCAN ACCDEF_IX1 (cr=6879822 pr=0 pw=0 time=37383556 us cost=0 size=0 card=1)(object id 103661)
         16077      16077      16077            TABLE ACCESS BY INDEX ROWID HOLDINGS (cr=222907859 pr=1677 pw=0 time=1109306657 us cost=10 size=52 card=1)
      13212301   13212301   13212301             INDEX SKIP SCAN P_HOLDINGS (cr=211196455 pr=431 pw=0 time=734718877 us cost=6 size=0 card=3)(object id 2173392)
         38622      38622      38622     INDEX RANGE SCAN R_HOLDINGS_HOLKEYIK (cr=7997 pr=829 pw=0 time=9653175 us cost=2 size=0 card=42)(object id 2173885)
           123        123        123    TABLE ACCESS BY INDEX ROWID HOLDINGS (cr=31216 pr=2422 pw=0 time=40223697 us cost=38 size=52 card=1)
    Case2
    SELECT EK.SECIK AS EK_SECIK,S.SECIK AS S_SECIK,EK.EQKEY1 AS EK_EQKEY1,EK.FROMDATE AS EK_FROMDATE,S.SECSHORT AS S_SECSHORT,S.SECNAME AS S_SECNAME,C.CDY AS C_CDY,C.CSTD AS C_CSTD,P.PAR AS P_PAR,P.PARIK AS P_PARIK,PH.ACCOUNTING_FRAMEWORK AS PH_ACC_FW,NVL(PH.BAL_NOMINAL_NUMBER,0) AS PH_BAL_NOM_NUM,PH.FROM_DATE AS PH_FROM_DATE,PH.POR AS PH_POR,PH.SEC_SHORT_NAME AS PH_SEC_SHORT_NAME,PH.TO_DATE AS PH_TO_DATE,PH.CUSTODY_SHORT_NAME AS PH_CUST_SHORT_NAME,T.TC_CSTD AS T_CSTD,SUM(T.TH_BAL_NOM_NUM) AS T_BAL_NOM_NUM,T.TH_SEC_SHORT_NAME AS T_SEC_SHORT_NAME,PH.POR_REF AS PH_POR_REF,PORT.PORIK AS PORT_PORIK,PORT.PORGRPIK AS PORT_PORGRPIK,PG.PORGRPIK AS PG_PORGRPIK,PG.PORGRPTYPEIK AS PG_PORGRPTYPEIK,PGT.PORGRPTYPEIK AS PGT_PORGRPTYPEIK FROM SCDAT.CUSTODIES C,SCDAT.EQUITYKEYS EK,SCDAT.PARTNERS P,SCDAT.PORTGROUPS PG,SCDAT.PORTGROUPTYPES PGT,(
    SELECT  HOLKEYS.PORIK As POR_REF,
    ACCDEF.ACC As ACCOUNTING_FRAMEWORK,
    NVL(HOLDINGS.BALNOMVAL,0) As BAL_NOMINAL_NUMBER,
    CUSTODIES.CDY As CUSTODY_SHORT_NAME,
    DECODE(HOLDINGS.FINBOOKED,0,'No',1,'Yes',' ') As FINALLY_BOOKED,
    HOLDINGS.FROMDATE As FROM_DATE,
    PORTFOLIOS.POR As POR,
    SECURITIES.SECSHORT As SEC_SHORT_NAME,
    HOLDINGS.TODATE As TO_DATE,
    HOLDINGS.FINBOOKED As X_FINALLY_BOOKED
    FROM HOLDINGS,HOLKEYS,ACCDEF,CUSTODIES,PORTFOLIOS,SECURITIES WHERE HOLDINGS.HOLKEYIK = HOLKEYS.HOLKEYIK AND HOLDINGS.ACCIK = ACCDEF.ACCIK AND HOLKEYS.CDYIK = CUSTODIES.CDYIK AND HOLKEYS.PORIK = PORTFOLIOS.PORIK AND HOLKEYS.SECIK = SECURITIES.SECIK) PH,SCDAT.PORTFOLIOS PORT,SCDAT.SECURITIES S,(SELECT TC.CDY AS TC_CDY,TC.CSTD AS TC_CSTD,SUM(NVL(TH.BAL_NOMINAL_NUMBER,0)) AS TH_BAL_NOM_NUM,TH.FROM_DATE AS TH_FROM_DATE,TH.TO_DATE AS TH_TO_DATE,TH.SEC_SHORT_NAME AS TH_SEC_SHORT_NAME,TH.CUSTODY_SHORT_NAME AS TH_CUST_SHORT_NAME,TP.PAR AS TP_PAR,TP.PARIK AS TP_PARIK FROM SCDAT.CUSTODIES TC,(
    SELECT  ACCDEF.ACC As ACCOUNTING_FRAMEWORK,
    NVL(HOLDINGS.BALNOMVAL,0) As BAL_NOMINAL_NUMBER,
    CUSTODIES.CDY As CUSTODY_SHORT_NAME,
    DECODE(HOLDINGS.FINBOOKED,0,'No',1,'Yes',' ') As FINALLY_BOOKED,
    HOLDINGS.FROMDATE As FROM_DATE,
    SECURITIES.SECSHORT As SEC_SHORT_NAME,
    HOLDINGS.TODATE As TO_DATE,
    HOLDINGS.FINBOOKED As X_FINALLY_BOOKED
    FROM HOLDINGS,HOLKEYS,ACCDEF,CUSTODIES,SECURITIES WHERE HOLDINGS.ACCIK = ACCDEF.ACCIK AND HOLDINGS.HOLKEYIK = HOLKEYS.HOLKEYIK AND HOLKEYS.CDYIK = CUSTODIES.CDYIK AND HOLKEYS.SECIK = SECURITIES.SECIK) TH,SCDAT.PARTNERS TP WHERE TH.CUSTODY_SHORT_NAME = TC.CDY AND TC.CSTD = TP.PARIK AND TH.ACCOUNTING_FRAMEWORK = :v1  AND NOT (NVL(TH.BAL_NOMINAL_NUMBER,0) = :v2 )  AND TH.FROM_DATE <= :v3  AND TH.TO_DATE >= :v4  AND TH.FINALLY_BOOKED = :v5  GROUP BY TC.CDY,TC.CSTD,TH.FROM_DATE,TH.TO_DATE,TH.SEC_SHORT_NAME,TH.CUSTODY_SHORT_NAME,TP.PAR,TP.PARIK) T WHERE EK.SECIK = S.SECIK AND PORT.PORGRPIK = PG.PORGRPIK AND PG.PORGRPTYPEIK = PGT.PORGRPTYPEIK AND S.SECSHORT = PH.SEC_SHORT_NAME AND PH.SEC_SHORT_NAME = T.TH_SEC_SHORT_NAME AND PH.POR_REF = PORT.PORIK AND PH.CUSTODY_SHORT_NAME = C.CDY AND EK.FROMDATE = :v6  AND NOT (EK.EQKEY1 = :v7 )  AND P.PAR = :v8  AND NOT (PGT.PORGRPTYPE IN (:v9 ,:v10  ))  AND PH.ACCOUNTING_FRAMEWORK = :v11   AND NOT (NVL(PH.BAL_NOMINAL_NUMBER,0) = :v12  )  AND PH.FINALLY_BOOKED = :v13   AND EK.FROMDATE >= PH.FROM_DATE AND EK.FROMDATE <= PH.TO_DATE AND C.CSTD = P.PARIK AND C.CSTD = T.TC_CSTD GROUP BY EK.SECIK,S.SECIK,EK.EQKEY1,EK.FROMDATE,S.SECSHORT,S.SECNAME,C.CDY,C.CSTD,P.PAR,P.PARIK,PH.ACCOUNTING_FRAMEWORK,NVL(PH.BAL_NOMINAL_NUMBER,0),PH.FROM_DATE,PH.POR,PH.SEC_SHORT_NAME,PH.TO_DATE,PH.CUSTODY_SHORT_NAME,T.TC_CSTD,T.TH_SEC_SHORT_NAME,PH.POR_REF,PORT.PORIK,PORT.PORGRPIK,PG.PORGRPIK,PG.PORGRPTYPEIK,PGT.PORGRPTYPEIK
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      2.34       2.34          0          0          0           0
    Fetch        2     39.31     131.53      17885   17489238          0        2039
    total        4     41.66     133.88      17885   17489238          0        2039
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 171  (SCDAT)
    Number of plan statistics captured: 1
    Rows (1st) Rows (avg) Rows (max)  Row Source Operation
          2039       2039       2039  HASH GROUP BY (cr=17489238 pr=17885 pw=0 time=131529969 us cost=2062 size=251 card=1)
        166827     166827     166827   NESTED LOOPS  (cr=17489238 pr=17885 pw=0 time=157379020 us cost=2061 size=251 card=1)
          2043       2043       2043    NESTED LOOPS  (cr=143626 pr=5419 pw=0 time=19393083 us cost=2003 size=215 card=1)
         11156      11156      11156     HASH JOIN  (cr=53391 pr=2600 pw=0 time=4865614 us cost=1559 size=1956 card=12)
         11156      11156      11156      NESTED LOOPS  (cr=53385 pr=2600 pw=0 time=4585085 us)
         11156      11156      11156       NESTED LOOPS  (cr=42229 pr=2600 pw=0 time=4563404 us cost=1555 size=2156 card=14)
         11156      11156      11156        NESTED LOOPS  (cr=32467 pr=2600 pw=0 time=4543117 us cost=1541 size=2058 card=14)
         11156      11156      11156         NESTED LOOPS  (cr=19234 pr=2600 pw=0 time=4506220 us cost=1527 size=1806 card=14)
         24211      24211      24211          NESTED LOOPS  (cr=19230 pr=2600 pw=0 time=4417211 us cost=1526 size=36504 card=312)
           193        193        193           NESTED LOOPS  (cr=6926 pr=2556 pw=0 time=4371848 us cost=1350 size=1500 card=15)
           193        193        193            NESTED LOOPS  (cr=6537 pr=2556 pw=0 time=4370289 us cost=1320 size=1245 card=15)
           193        193        193             NESTED LOOPS  (cr=6148 pr=2556 pw=0 time=4369122 us cost=1305 size=585 card=15)
             1          1          1              NESTED LOOPS  (cr=5 pr=1 pw=0 time=6568 us cost=2 size=23 card=1)
             1          1          1               TABLE ACCESS BY INDEX ROWID ACCDEF (cr=2 pr=1 pw=0 time=6556 us cost=1 size=12 card=1)
             1          1          1                INDEX UNIQUE SCAN ACCDEF_IX1 (cr=1 pr=1 pw=0 time=6551 us cost=0 size=0 card=1)(object id 103661)
             1          1          1               TABLE ACCESS BY INDEX ROWID PARTNERS (cr=3 pr=0 pw=0 time=10 us cost=1 size=11 card=1)
             1          1          1                INDEX UNIQUE SCAN PARTNERS_IX1 (cr=2 pr=0 pw=0 time=6 us cost=0 size=0 card=1)(object id 91563)
           193        193        193              TABLE ACCESS FULL EQUITYKEYS (cr=6143 pr=2555 pw=0 time=4362460 us cost=1303 size=240 card=15)
           193        193        193             TABLE ACCESS BY INDEX ROWID SECURITIES (cr=389 pr=0 pw=0 time=1000 us cost=1 size=44 card=1)
           193        193        193              INDEX UNIQUE SCAN P_SECURITIES (cr=196 pr=0 pw=0 time=498 us cost=0 size=0 card=1)(object id 93819)
           193        193        193            TABLE ACCESS BY INDEX ROWID SECURITIES (cr=389 pr=0 pw=0 time=1486 us cost=2 size=17 card=1)
           193        193        193             INDEX RANGE SCAN SECURITIES_IX2 (cr=197 pr=0 pw=0 time=899 us cost=1 size=0 card=1)(object id 93809)
         24211      24211      24211           TABLE ACCESS BY INDEX ROWID HOLKEYS (cr=12304 pr=44 pw=0 time=38145 us cost=13 size=340 card=20)
         24211      24211      24211            INDEX RANGE SCAN I_HOLKEYS_SECPOR (cr=475 pr=44 pw=0 time=13253 us cost=2 size=0 card=23)(object id 98864)
         11156      11156      11156          TABLE ACCESS BY INDEX ROWID CUSTODIES (cr=4 pr=0 pw=0 time=93056 us cost=1 size=12 card=1)
         48422      48422      48422           INDEX RANGE SCAN R_CUSTODIES_CSTD (cr=3 pr=0 pw=0 time=35831 us cost=0 size=0 card=3)(object id 101437)
         11156      11156      11156         TABLE ACCESS BY INDEX ROWID PORTFOLIOS (cr=13233 pr=0 pw=0 time=31391 us cost=1 size=18 card=1)
         11156      11156      11156          INDEX UNIQUE SCAN P_PORTFOLIOS (cr=2077 pr=0 pw=0 time=12494 us cost=0 size=0 card=1)(object id 91399)
         11156      11156      11156        INDEX UNIQUE SCAN P_PORTGROUPS (cr=9762 pr=0 pw=0 time=15817 us cost=0 size=0 card=1)(object id 95885)
         11156      11156      11156       TABLE ACCESS BY INDEX ROWID PORTGROUPS (cr=11156 pr=0 pw=0 time=15160 us cost=1 size=7 card=1)
             5          5          5      VIEW  index$_join$_005 (cr=6 pr=0 pw=0 time=656 us cost=3 size=45 card=5)
             5          5          5       HASH JOIN  (cr=6 pr=0 pw=0 time=648 us)
             5          5          5        INDEX FAST FULL SCAN PORTGROUPTYPES_IX1 (cr=3 pr=0 pw=0 time=26 us cost=1 size=45 card=5)(object id 95857)
             7          7          7        INDEX FAST FULL SCAN P_PORTGROUPTYPES (cr=3 pr=0 pw=0 time=15 us cost=1 size=45 card=5)(object id 95858)
          2043       2043       2043     TABLE ACCESS BY INDEX ROWID HOLDINGS (cr=90235 pr=2819 pw=0 time=19041512 us cost=38 size=52 card=1)
         92362      92362      92362      INDEX RANGE SCAN R_HOLDINGS_HOLKEYIK (cr=22368 pr=436 pw=0 time=2663719 us cost=2 size=0 card=42)(object id 2173885)
        166827     166827     166827    VIEW PUSHED PREDICATE  (cr=17345612 pr=12466 pw=0 time=107441684 us cost=58 size=36 card=1)
        166827     166827     166827     SORT GROUP BY (cr=17345612 pr=12466 pw=0 time=107408172 us cost=58 size=117 card=1)
       1911217    1911217    1911217      NESTED LOOPS  (cr=17345612 pr=12466 pw=0 time=1296620056 us)
      10575944   10575944   10575944       NESTED LOOPS  (cr=9800492 pr=1140 pw=0 time=22104782 us cost=57 size=117 card=1)
       2292837    2292837    2292837        NESTED LOOPS  (cr=5195338 pr=0 pw=0 time=9516177 us cost=19 size=65 card=1)
          4086       4086       4086         MERGE JOIN CARTESIAN (cr=4885 pr=0 pw=0 time=93451 us cost=6 size=52 card=1)
          4086       4086       4086          NESTED LOOPS  (cr=4103 pr=0 pw=0 time=29074 us cost=4 size=35 card=1)
          2043       2043       2043           NESTED LOOPS  (cr=4099 pr=0 pw=0 time=20146 us cost=3 size=23 card=1)
          2043       2043       2043            TABLE ACCESS BY INDEX ROWID PARTNERS (cr=2052 pr=0 pw=0 time=10371 us cost=2 size=11 card=1)
          2043       2043       2043             INDEX UNIQUE SCAN P_PARTNERS (cr=9 pr=0 pw=0 time=4583 us cost=1 size=0 card=1)(object id 91507)
          2043       2043       2043            TABLE ACCESS BY INDEX ROWID ACCDEF (cr=2047 pr=0 pw=0 time=7133 us cost=1 size=12 card=1)
          2043       2043       2043             INDEX UNIQUE SCAN ACCDEF_IX1 (cr=4 pr=0 pw=0 time=3680 us cost=0 size=0 card=1)(object id 103661)
          4086       4086       4086           TABLE ACCESS BY INDEX ROWID CUSTODIES (cr=4 pr=0 pw=0 time=10204 us cost=1 size=12 card=1)
          4086       4086       4086            INDEX RANGE SCAN R_CUSTODIES_CSTD (cr=3 pr=0 pw=0 time=6320 us cost=0 size=0 card=1)(object id 101437)
          4086       4086       4086          BUFFER SORT (cr=782 pr=0 pw=0 time=60735 us cost=5 size=17 card=1)
          4086       4086       4086           TABLE ACCESS BY INDEX ROWID SECURITIES (cr=782 pr=0 pw=0 time=27892 us cost=2 size=17 card=1)
          4086       4086       4086            INDEX RANGE SCAN SECURITIES_IX2 (cr=590 pr=0 pw=0 time=13746 us cost=1 size=0 card=1)(object id 93809)
       2292837    2292837    2292837         TABLE ACCESS BY INDEX ROWID HOLKEYS (cr=5190453 pr=0 pw=0 time=12329304 us cost=13 size=13 card=1)
      10116948   10116948   10116948          INDEX RANGE SCAN I_HOLKEYS_SECPOR (cr=41387 pr=0 pw=0 time=2136775 us cost=2 size=0 card=23)(object id 98864)
      10575944   10575944   10575944        INDEX RANGE SCAN R_HOLDINGS_HOLKEYIK (cr=4605154 pr=1140 pw=0 time=14152971 us cost=2 size=0 card=42)(object id 2173885)
       1911217    1911217    1911217       TABLE ACCESS BY INDEX ROWID HOLDINGS (cr=7545120 pr=11326 pw=0 time=78999228 us cost=38 size=52 card=1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
       2039   HASH (GROUP BY)
    166827    NESTED LOOPS
       2043     NESTED LOOPS
      11156      HASH JOIN
      11156       VIEW OF 'index$_join$_005' (VIEW)
      11156        HASH JOIN
      11156         INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                        'PORTGROUPTYPES_IX1' (INDEX (UNIQUE))
      11156         INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                        'P_PORTGROUPTYPES' (INDEX (UNIQUE))
      24211       HASH JOIN
        193        VIEW OF 'index$_join$_004' (VIEW)
        193         HASH JOIN
        193          INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                         'P_PORTGROUPS' (INDEX (UNIQUE))
          1          INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                         'R_PORTGROUPS_PORGRPTYPEIK' (INDEX)
          1        HASH JOIN
          1         HASH JOIN
          1          TABLE ACCESS   MODE: ANALYZED (FULL) OF
                         'EQUITYKEYS' (TABLE)
          1          HASH JOIN
        193           TABLE ACCESS   MODE: ANALYZED (FULL) OF
                          'SECURITIES' (TABLE)
        193           HASH JOIN
        193            VIEW OF 'index$_join$_012' (VIEW)
        193             HASH JOIN
        193              INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                             'P_SECURITIES' (INDEX (UNIQUE))
      24211              INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                             'SECURITIES_IX2' (INDEX (UNIQUE))
      24211            NESTED LOOPS
      11156             NESTED LOOPS
      48422              NESTED LOOPS
      11156               NESTED LOOPS
      11156                TABLE ACCESS   MODE: ANALYZED (BY
                               INDEX ROWID) OF 'ACCDEF' (TABLE)
      11156                 INDEX   MODE: ANALYZED (UNIQUE SCAN)
                                OF 'ACCDEF_IX1' (INDEX (UNIQUE))
      11156                TABLE ACCESS   MODE: ANALYZED (BY
                               INDEX ROWID) OF 'PARTNERS' (TABLE)
          5                 INDEX   MODE: ANALYZED (UNIQUE SCAN)
                                OF 'PARTNERS_IX1' (INDEX (UNIQUE))
          5               TABLE ACCESS   MODE: ANALYZED (BY INDEX
                              ROWID) OF 'CUSTODIES' (TABLE)
          5                INDEX   MODE: ANALYZED (RANGE SCAN) OF
                               'R_CUSTODIES_CSTD' (INDEX)
          7              INDEX   MODE: ANALYZED (RANGE SCAN) OF
                             'R_HOLKEYS_CDYIK' (INDEX)
       2043             TABLE ACCESS   MODE: ANALYZED (BY INDEX
                            ROWID) OF 'HOLKEYS' (TABLE)
      92362         VIEW OF 'index$_join$_013' (VIEW)
    166827          HASH JOIN
    166827           INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                          'P_PORTFOLIOS' (INDEX (UNIQUE))
    1911217           INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                          'PORTFOLIOS_IX1' (INDEX (UNIQUE))
    10575944      TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF
                     'HOLDINGS' (TABLE)
    2292837       INDEX   MODE: ANALYZED (RANGE SCAN) OF
                      'R_HOLDINGS_HOLKEYIK' (INDEX)
       4086     VIEW PUSHED PREDICATE
       4086      SORT (GROUP BY)
       2043       NESTED LOOPS
       2043        NESTED LOOPS
       2043         MERGE JOIN (CARTESIAN)
       2043          NESTED LOOPS
       2043           TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID)
                          OF 'PARTNERS' (TABLE)
       4086            INDEX   MODE: ANALYZED (UNIQUE SCAN) OF
                           'P_PARTNERS' (INDEX (UNIQUE))
       4086           TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID)
                          OF 'CUSTODIES' (TABLE)
       4086            INDEX   MODE: ANALYZED (RANGE SCAN) OF
                           'R_CUSTODIES_CSTD' (INDEX)
       4086          BUFFER (SORT)
       4086           TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID)
                          OF 'SECURITIES' (TABLE)
    2292837            INDEX   MODE: ANALYZED (RANGE SCAN) OF
                           'SECURITIES_IX2' (INDEX (UNIQUE))
    10116948         TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF
                        'HOLKEYS' (TABLE)
    10575944          INDEX   MODE: ANALYZED (RANGE SCAN) OF
                         'I_HOLKEYS_SECPOR' (INDEX)
    1911217        VIEW PUSHED PREDICATE OF 'VW_GBC_22' (VIEW)
          0         SORT (GROUP BY)
          0          NESTED LOOPS
          0           TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID)
                          OF 'ACCDEF' (TABLE)
          0            INDEX   MODE: ANALYZED (UNIQUE SCAN) OF
                           'ACCDEF_IX1' (INDEX (UNIQUE))
          0           TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID)
                          OF 'HOLDINGS' (TABLE)
          0            INDEX   MODE: ANALYZED (RANGE SCAN) OF
                           'R_HOLDINGS_HOLKEYIK' (INDEX)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                       2        0.00          0.00
      db file sequential read                     16176        0.17         90.98
      db file scattered read                        590        0.01          1.94
      Disk file operations I/O                       15        0.00          0.00
      SQL*Net message from client                     2        0.04          0.04
      SQL*Net more data to client                    33        0.00          0.00

    the plans show that your first query has to do much more work than the second query (250M vs. 17M consistent gets). The queries use different plans and the second plan seems to be the better choice - since the first query does not return any rows. The plans also tell us where the time is spent - and there are some nested loops with extreme execution counts and a lot of expansive index access operations (especially the skip scan on P_HOLDINGS), but I would prefer to use a a plan with rowsource statistics to find the errors in the optimizers cardinality estimations.

  • How many cpus on server are allocated to client

    hello,
    its not an issue rather doubt which is hunting me from last 2-3 days.
    My 10gR2 Oracle database running on
    Widows server 2008 R2 Enterprise
    Processor ----> intel Xeon cpu [email protected] GHz (4 processor)
    RAM------>8GB
    its a dedicated server.
    Actually i was going through the AWR report whn one of the client came to me with slow database performance during some time interval.
    when i had a look at the Top 5 Timed Events in Report it showed me the
    Sql*net message from client      834.35si told them to run their query so that i can have trace of that.
    then time event showed me something nearer to above and our database was taking only 15 sec to carry out the task.
    i told them that
    "you application/client is taking 834 sec to tell our database to do something.But once the database got your application's request to carry out something, the database is taking only 15 sec to provide you with the result"
    so they asked me to justify that the problem is with application side/machine side.
    After digging in a lot on the internet ground, chatting with my colleges on cell phone and running through many threads specially Asktom.oracle.com, i got really confused.
    They came up with varied opinions which kept me thinking again & again over the same thing.
    In one of his(Thomas kyte) thread the discussion was as follows.
    The output of tkprof when the developers run the same program on their PC shows a big difference in
    SQL*Net message from client.
    The SQL*Net message from client from my tkprof is almost 4-5 times theirs.
    Could you please advise what might be the cause of that?
    Thanks
    Followup   August 25, 2009 - 9am Central time zone:
    that could mean.....
    your machine is slow (their desktop cpus blow your server cpus away) as much as anything.
    since their code is not instrumented, try SQL*Net trace (with TIMESTAMPS) can be helpful to check out the time in the network between the client and server. See Note 16658.1 - see if you experience radically different response times on the various machines.
    4 stars   August 25, 2009 - 2pm Central time zone
    Bookmark | Bottom | Top
    Reviewer: Jaklin Ekdawi
    My Database server is T5120 with 4 core 1.2 GHz Ultra SPARC T2 processor (from O/S it is seen as 32
    CPU * 1.2 GHz).
    Their PC has 2 CPU * 4 Ghz.
    Based on the above, How come their PC is more powerful than my server?
    The ASH Report for the execution period of the program shows ¿CPU + Wait for CPU¿ is the top event,
    however, tkprof shows ¿SQL*Net from client¿ is the top event waited on.
    Top User Events
    Event        Event Class    % Activity    Avg Active Sessions
    CPU + Wait for CPU     CPU             81.66        0.14
    log file sync             Commit             5.92        0.01
    db file scattered read     User I/O     2.37        0.00
    Can you please explain why there is a difference between tkprof and ASH report?
    Thank You
    Followup   August 25, 2009 - 8pm Central time zone:
    I only care about a single cpu, your client program is not using more than one.
    I often downloaded stuff from my big bad sparc to my desktop because my desktop was many times faster than the sparc.
    look further down in the ash report - sqlnet message from client is an idle wait, we tend to ignore it as it is the time we spent WAITING FOR THE CLIENT.
    Their pc looks a lot faster than your server since you are only using a single cpu - your client is not multi-process. It only uses a single cpu.
    4 stars   August 25, 2009 - 2pm Central time zone
    Bookmark | Bottom | Top
    Reviewer: Jaklin Ekdawi
    Sorry, I forgot to say that during the execution time the cpu on the server was 98-99% idle based
    on (using top and sar).
    Thanks
    Followup   August 25, 2009 - 8pm Central time zone:
    I agree, because you could not use 31 out of 32 cpus, I would expect it to be almost idle.
    97% idle would mean a single cpu was 100% used. So, it sounds like you were using almost 100% of that single cpu you had access to.
    and it isn't as fast as their pc.
    4 stars   August 25, 2009 - 10pm Central time zone
    Bookmark | Bottom | Top
    Reviewer: Jaklin Ekdawi
    The tkprof from the developer's PC is below
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse      122      0.39       0.68          0        403          0           0
    Execute    122      0.00       0.00          0          0          0           0
    Fetch      396      0.09       0.11          0      25354          0         274
    total      640      0.48       0.80          0      25757          0         274
    Misses in library cache during parse: 122
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                     763        0.00          0.00
      SQL*Net message from client                   763       14.71        312.91
      SQL*Net more data to client                   122        0.00          0.00
    The tkprof for the running the same process on Solaris DB Server
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse      124      0.06       0.03          0          0          0           0
    Execute    124      0.04       0.01          0          0          0           0
    Fetch      400      0.07       0.10          0        802          0         276
    total      648      0.17       0.15          0        802          0         276
    Misses in library cache during parse: 1
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                     774        0.00          0.00
      SQL*Net message from client                   774       43.65        964.23
    - On Solaris DB server, the CPU is 0.17, however, "SQL*Net message from client" is 964.23.
    - On the developer¿s PC, the CPU is 0.48, however, "SQL*Net message from client" is 312.91.
    Based on that, how I can approve it is CPU issue?
    Followup   August 26, 2009 - 7pm Central time zone:
    how about this.
    have the developers write something that mimics what they do without the database in it. Same sorts of loops and processing they do in the code in the client.
    run it on their machine
    run it on yours
    You'll find your big bad server has cpu's that are extremely slow compared to the desktop machine.
    Hence - the time spent waiting for sqlnet message from client is - time spent in YOUR client on YOUR server processing the data returned from the database.
    saying "the cpu 0.17 on one and 0.48 on the other" is meaningless, they are completely different cpus with completely different performance characteristics.
    And that you have 32 of them - no use to you, you use one..
    It looks like your server is about 2-3 times slower then their test machine.
    5 stars SQL*Net Message from client may not be an issue from the app   May 28, 2010 - 8am Central time zone
    Bookmark | Bottom | Top
    Reviewer: Thierry B from Paris, France
    Hi,
    I just read your post as I experienced the exact same problem. I found something that fixed this
    problem for me, my sqlnet.ora contained that line after an oracle upgrade:
    TRACE_LEVEL_CLIENT=16
    I don't know how it came there. But it was the cause of my problem (too long idle time). I simply
    removed it and no more wait events.
    I hope it can be of any help for anyone.
    Followup   May 28, 2010 - 8am Central time zone:
    that is a client side issue though, isn't it. It is an application side issue, not a database side issue.
    5 stars   April 15, 2011 - 10am Central time zone
    Bookmark | Bottom | Top
    Reviewer: A reader in this thread Tom insisted that the client has access to only 1 CPU on the server even though the questioner told him that his machine is having around 32 CPU'S.
    so this thread was the source of my confusion.
    i kept asking myself "if the client application has access to one cpu out of 32 cpu's on the server on which the database server is running,then What is the use of multiprocessor? my oracle/client application has access to only one cpu on the server(like Tom said), what other 31 cpu's on the server machine are upto?if one cpu is getting exhausted by the client Application request, then what the other processor are doing ? are they not meant for load balancing?"
    when i had a chat on cell phone with my colleagues regarding the oracle access to the cpu's on the server, then they told me that if there are more number of cpu's then the the response time would be fast cause workload is divided among the multiple processor to carry out the task in parallel.
    Again i got confused with the deferring opinion..
    so just want to have clarification on
    * how many processes do i have access to on server machine where my oracle is installed?*
    how many processes do the client applicaiton S/W/client machine have access to out of 32 processors?
    is workload devided among the cpus on the server ,in case of huge request from the client application?
    thanks & i hope my doubt would be cleared

    Look at it in basic terms (forgetting for the moment about Oracle and SQL*Net and specific s/w itself).
    A process is loaded into memory. This process contains machine code instructions. How many CPUs can execute these instructions?
    Only 1.
    Simplistically. The process has a single execution pointer and set of CPU registers. A single CPU executes the instruction (as indicated by the execution pointer). The registers are used and updated.
    The same CPU may not be used each time around. So a single process can during its lifetime, be executed by a number of CPUs. But a single CPU at a time.
    A process can thread. This basically means that a second copy of the execution pointer and registers set are created. Each such copy will be executed by by a single CPU at a time.
    An Oracle client is serviced by an Oracle server process (either dedicated or shared). On Linux/Unix systems, this will be a unique physical process. On Windows, it will be a unique thread.
    This process is executed by a single CPU. Thus that client is serviced by a single CPU.
    This changes when Oracle can use parallel processing and there are PX slave processes available. In that case, the client is serviced by a single process - but that process has in turn enlisted the assistance of helper processes. Thus the client is now serviced by multiple processes (or threads on Windows) and thus by multiple CPUs.
    However, it is not that simple either. It is "cheaper" for the kernel to run threads on the same CPU than on different CPUs. The reason is the same memory is used by both and access to that memory by different CPUs is more complex (and thus more expensive and slower) than from the same CPU.
    So depending on a number of factors, that client may still be serviced by a single CPU despite the fact that PX slaves are used. And from a client process perspective, this does not really matter. The crux of the issue in this regard is the CPU utilisation/footprint of that client process on the server.
    If the clock time for a client process says "+running for 60s+" and the server says "+CPU time is 10s+", you cannot say that the process was not serviced by multiple CPUs. You do not know whether than 10s CPU time was for 5 processes each spending 2s to service that client.
    However, when the server says "+CPU time is 70s+" - a longer period that the wall clock time of the client, then it is reasonable to assume that multiple server processes (and thus CPUs) are servicing that client process.
    As for exactly how many CPUs are in fact used by the server? That has no real bearing on this. It does not change client-server behaviour.
    Even Oracle does not know and does not care which CPU is servicing it. The correct piece of s/w to deal with that, is the kernel. Yes, you can bind a thread or process to a specific server CPU, but the reasons for this is quite technical and is always an exception. Let the kernel deal with which CPU to use. It is of no concern to the server s/w (like Oracle), and even less to the client process being serviced by that server s/w.

  • Sqltrace and tkprof

    can anyone xplain how to do sqltrace and tkprof
    here i am getting an error while executing a query
    at firs i gave
    set autotrace on
    SQL> select * from dept;
    DEPTNO DEPT_NAME
    500 INFORMATION SYSTEMS
    CIVIL
    400 INFORMATION TECHNOLOGY
    100 computers
    200 mechanical
    300 electrical
    6 rows selected.
    Execution Plan
    0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3 Card=6
    1 0 TABLE ACCESS (FULL) OF 'DEPT' (TABLE) (Cost=3 Car
    =96)
    Statistics
    1 recursive calls
    0 db block gets
    8 consistent gets
    0 physical reads
    0 redo size
    360 bytes sent via SQL*Net to client
    276 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    0 sorts (memory)
    0 sorts (disk)
    6 rows processed
    after that
    SQL> ed
    Wrote file afiedt.buf
    1 tkprof pra.trc
    2 explain=dthpc/dthpc
    3* table=dept
    SQL> /
    tkprof pra.trc
    ERROR at line 1:
    ORA-00900: invalid SQL statement
    can anyone help me out regarding tkprof

    SQL> ed
    Wrote file afiedt.buf
    +1 tkprof pra.trc+
    +2 explain=dthpc/dthpc+
    +3* table=dept+
    i am confused as what you are trying to do here? are you combining explain plan and tkprof?

  • Looking for your advise on this TKProf

    Hello There,
    I am looking for your advise on the following TKProf:
    TKPROF: Release 11.1.0.7.0 - Production on Thu Apr 28 16:37:23 2011
    Copyright (c) 1982, 2007, Oracle. All rights reserved.
    Trace file: DCPRD_ora_9930_AIBRAHIM80.trc
    Sort options: prsdsk exedsk fchdsk
    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
    The following statement encountered a error during parse:
    SELECT ROWID,VENDOR_NAME,VENDOR_NUMBER,VENDOR_SITE_CODE,TERRITORY_SHORT_NAME,CONCATENATED_ADDRESS,LANGUAGE_DESCRIPTION,AREA_CODE,PHONE,COUNTRY,LANGUAGE,INVOICE_CURRENCY_CODE,VENDOR_ID,VENDOR_SITE_ID FROM AP_VENDOR_DISP_V WHERE (VENDOR_ID=:1) and (VENDOR_SITE_ID=:2)
    Error encountered: ORA-01445
    SQL ID: 5uz1ugat7bn9k
    Plan Hash: 1624111731
    SELECT COUNT( DECODE( POD.PREVENT_ENCUMBRANCE_FLAG , 'Y', NULL , DECODE(
    POD.ENCUMBERED_FLAG , 'Y', 'Y' , NULL ) ) ) , COUNT( DECODE(
    POD.PREVENT_ENCUMBRANCE_FLAG , 'Y', NULL , DECODE( POD.ENCUMBERED_FLAG ,
    'Y', NULL , 'N' ) ) ) , COUNT( DECODE( POD.PREVENT_ENCUMBRANCE_FLAG , 'Y',
    'Y' , NULL ) )
    FROM
    PO_DISTRIBUTIONS_ALL POD , PO_LINE_LOCATIONS_ALL POLL , PO_HEADERS_ALL POH
    WHERE POLL.LINE_LOCATION_ID(+) = POD.LINE_LOCATION_ID AND POH.PO_HEADER_ID =
    POD.PO_HEADER_ID AND ( (:B2 <> :B11 AND NVL(POLL.CANCEL_FLAG,'N') <> 'Y')
    OR (:B2 = :B11 AND NVL(POH.CANCEL_FLAG,'N') <> 'Y') ) AND ( ( :B2 <> :B11
    AND NVL(POLL.CLOSED_CODE,:B10 ) <> :B9 ) OR ( :B2 = :B11 AND
    NVL(POH.CLOSED_CODE,:B10 ) <> :B9 ) ) AND ( ( :B5 = :B8 AND
    POD.PO_DISTRIBUTION_ID = :B3 ) OR ( :B5 = :B7 AND POD.LINE_LOCATION_ID =
    :B3 ) OR ( :B5 = :B6 AND POD.PO_LINE_ID = :B3 ) OR ( :B5 = :B4 AND :B2 =
    :B1 AND POD.PO_RELEASE_ID = :B3 ) OR ( :B5 = :B4 AND :B2 <> :B1 AND
    POD.PO_HEADER_ID = :B3 ) ) AND ( ( :B2 <> :B1 AND POD.PO_RELEASE_ID IS NULL
    ) OR ( :B2 = :B1 AND POD.PO_RELEASE_ID IS NOT NULL ) )
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 114604 414.24 434.04 0 0 0 0
    Fetch 114604 45.91 750.41 46028 2831063 0 114604
    total 229209 460.15 1184.46 46028 2831063 0 114604
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 183 (recursive depth: 1)
    Number of plan statistics captured: 1
    Rows (1st) Rows (avg) Rows (max) Row Source Operation
    1 1 1 SORT AGGREGATE (cr=12 pr=9 pw=0 time=0 us)
    1 1 1 CONCATENATION (cr=12 pr=9 pw=0 time=0 us)
    1 1 1 FILTER (cr=12 pr=9 pw=0 time=0 us)
    1 1 1 FILTER (cr=12 pr=9 pw=0 time=0 us)
    1 1 1 NESTED LOOPS OUTER (cr=12 pr=9 pw=0 time=0 us cost=7 size=57 card=1)
    1 1 1 NESTED LOOPS (cr=7 pr=4 pw=0 time=0 us cost=5 size=42 card=1)
    1 1 1 TABLE ACCESS BY INDEX ROWID PO_DISTRIBUTIONS_ALL (cr=4 pr=4 pw=0 time=0 us cost=4 size=29 card=1)
    1 1 1 INDEX RANGE SCAN PO_DISTRIBUTIONS_N11 (cr=3 pr=3 pw=0 time=0 us cost=3 size=0 card=5)(object id 45031)
    1 1 1 TABLE ACCESS BY INDEX ROWID PO_HEADERS_ALL (cr=3 pr=0 pw=0 time=0 us cost=1 size=13 card=1)
    1 1 1 INDEX UNIQUE SCAN PO_HEADERS_U1 (cr=2 pr=0 pw=0 time=0 us cost=0 size=0 card=1)(object id 45109)
    1 1 1 TABLE ACCESS BY INDEX ROWID PO_LINE_LOCATIONS_ALL (cr=5 pr=5 pw=0 time=0 us cost=2 size=15 card=1)
    1 1 1 INDEX UNIQUE SCAN PO_LINE_LOCATIONS_U1 (cr=3 pr=3 pw=0 time=0 us cost=1 size=0 card=1)(object id 45204)
    0 0 0 FILTER (cr=0 pr=0 pw=0 time=0 us)
    0 0 0 FILTER (cr=0 pr=0 pw=0 time=0 us)
    0 0 0 NESTED LOOPS OUTER (cr=0 pr=0 pw=0 time=0 us cost=6 size=57 card=1)
    0 0 0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us cost=4 size=42 card=1)
    0 0 0 TABLE ACCESS BY INDEX ROWID PO_DISTRIBUTIONS_ALL (cr=0 pr=0 pw=0 time=0 us cost=3 size=29 card=1)
    0 0 0 INDEX UNIQUE SCAN PO_DISTRIBUTIONS_U1 (cr=0 pr=0 pw=0 time=0 us cost=2 size=0 card=1)(object id 45078)
    0 0 0 TABLE ACCESS BY INDEX ROWID PO_HEADERS_ALL (cr=0 pr=0 pw=0 time=0 us cost=1 size=477061 card=36697)
    0 0 0 INDEX UNIQUE SCAN PO_HEADERS_U1 (cr=0 pr=0 pw=0 time=0 us cost=0 size=0 card=1)(object id 45109)
    0 0 0 TABLE ACCESS BY INDEX ROWID PO_LINE_LOCATIONS_ALL (cr=0 pr=0 pw=0 time=0 us cost=2 size=11849205 card=789947)
    0 0 0 INDEX UNIQUE SCAN PO_LINE_LOCATIONS_U1 (cr=0 pr=0 pw=0 time=0 us cost=1 size=0 card=1)(object id 45204)
    0 0 0 FILTER (cr=0 pr=0 pw=0 time=0 us)
    0 0 0 FILTER (cr=0 pr=0 pw=0 time=0 us)
    0 0 0 NESTED LOOPS OUTER (cr=0 pr=0 pw=0 time=0 us cost=7 size=57 card=1)
    0 0 0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us cost=5 size=42 card=1)
    0 0 0 TABLE ACCESS BY INDEX ROWID PO_DISTRIBUTIONS_ALL (cr=0 pr=0 pw=0 time=0 us cost=4 size=29 card=1)
    0 0 0 INDEX RANGE SCAN PO_DISTRIBUTIONS_N1 (cr=0 pr=0 pw=0 time=0 us cost=3 size=0 card=1)(object id 45023)
    0 0 0 TABLE ACCESS BY INDEX ROWID PO_HEADERS_ALL (cr=0 pr=0 pw=0 time=0 us cost=1 size=13 card=1)
    0 0 0 INDEX UNIQUE SCAN PO_HEADERS_U1 (cr=0 pr=0 pw=0 time=0 us cost=0 size=0 card=1)(object id 45109)
    0 0 0 TABLE ACCESS BY INDEX ROWID PO_LINE_LOCATIONS_ALL (cr=0 pr=0 pw=0 time=0 us cost=2 size=15 card=1)
    0 0 0 INDEX UNIQUE SCAN PO_LINE_LOCATIONS_U1 (cr=0 pr=0 pw=0 time=0 us cost=1 size=0 card=1)(object id 45204)
    0 0 0 FILTER (cr=0 pr=0 pw=0 time=0 us)
    0 0 0 FILTER (cr=0 pr=0 pw=0 time=0 us)
    0 0 0 NESTED LOOPS OUTER (cr=0 pr=0 pw=0 time=0 us cost=10 size=57 card=1)
    0 0 0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us cost=8 size=42 card=1)
    0 0 0 TABLE ACCESS BY INDEX ROWID PO_DISTRIBUTIONS_ALL (cr=0 pr=0 pw=0 time=0 us cost=7 size=29 card=1)
    0 0 0 INDEX RANGE SCAN PO_DISTRIBUTIONS_N3 (cr=0 pr=0 pw=0 time=0 us cost=3 size=0 card=21)(object id 45049)
    0 0 0 TABLE ACCESS BY INDEX ROWID PO_HEADERS_ALL (cr=0 pr=0 pw=0 time=0 us cost=1 size=13 card=1)
    0 0 0 INDEX UNIQUE SCAN PO_HEADERS_U1 (cr=0 pr=0 pw=0 time=0 us cost=0 size=0 card=1)(object id 45109)
    0 0 0 TABLE ACCESS BY INDEX ROWID PO_LINE_LOCATIONS_ALL (cr=0 pr=0 pw=0 time=0 us cost=2 size=15 card=1)
    0 0 0 INDEX UNIQUE SCAN PO_LINE_LOCATIONS_U1 (cr=0 pr=0 pw=0 time=0 us cost=1 size=0 card=1)(object id 45204)
    0 0 0 FILTER (cr=0 pr=0 pw=0 time=0 us)
    0 0 0 FILTER (cr=0 pr=0 pw=0 time=0 us)
    0 0 0 NESTED LOOPS OUTER (cr=0 pr=0 pw=0 time=0 us cost=8 size=57 card=1)
    0 0 0 NESTED LOOPS (cr=0 pr=0 pw=0 time=0 us cost=6 size=42 card=1)
    0 0 0 TABLE ACCESS BY INDEX ROWID PO_DISTRIBUTIONS_ALL (cr=0 pr=0 pw=0 time=0 us cost=5 size=29 card=1)
    0 0 0 INDEX RANGE SCAN PO_DISTRIBUTIONS_N4 (cr=0 pr=0 pw=0 time=0 us cost=3 size=0 card=3)(object id 45054)
    0 0 0 TABLE ACCESS BY INDEX ROWID PO_HEADERS_ALL (cr=0 pr=0 pw=0 time=0 us cost=1 size=13 card=1)
    0 0 0 INDEX UNIQUE SCAN PO_HEADERS_U1 (cr=0 pr=0 pw=0 time=0 us cost=0 size=0 card=1)(object id 45109)
    0 0 0 TABLE ACCESS BY INDEX ROWID PO_LINE_LOCATIONS_ALL (cr=0 pr=0 pw=0 time=0 us cost=2 size=15 card=1)
    0 0 0 INDEX UNIQUE SCAN PO_LINE_LOCATIONS_U1 (cr=0 pr=0 pw=0 time=0 us cost=1 size=0 card=1)(object id 45204)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 46028 1.12 712.45
    SELECT ROW_ID,ORG_ID,PO_RELEASE_ID,PO_HEADER_ID,RELEASE_TYPE,AGENT_ID,VENDOR_ID,SHIP_TO_LOCATION_ID,SHIP_TO_LOCATION,SHIP_TO_ORGANIZATION_ID,VENDOR_SITE_ID,APPROVED_DATE,APPROVED_FLAG,AUTHORIZATION_STATUS,CANCEL_DATE,CANCEL_REASON,CANCELLED_BY,CANCEL_FLAG,HOLD_BY,HOLD_DATE,HOLD_REASON,HOLD_FLAG,CLOSED_CODE,FROZEN_FLAG,PRINT_COUNT,PRINTED_DATE,CREATED_BY,CREATION_DATE,LAST_UPDATED_BY,LAST_UPDATE_DATE,LAST_UPDATE_LOGIN,PROGRAM_APPLICATION_ID,PROGRAM_ID,PROGRAM_UPDATE_DATE,REQUEST_ID,ATTRIBUTE2,ATTRIBUTE3,ATTRIBUTE4,ATTRIBUTE1,ATTRIBUTE5,ATTRIBUTE6,ATTRIBUTE7,ATTRIBUTE8,ATTRIBUTE9,ATTRIBUTE10,ATTRIBUTE11,ATTRIBUTE12,ATTRIBUTE13,ATTRIBUTE15,ATTRIBUTE14,ATTRIBUTE_CATEGORY,PO_NUM,RELEASE_NUM,REVISION_NUM,RELEASE_REVISION_NUM,REVISED_DATE,RELEASE_DATE,VENDOR_NAME,VENDOR_SITE_CODE,CURRENCY_CODE,AGENT_NAME,STATUS,FIRM_STATUS_LOOKUP_CODE,ACCEPTANCE_REQUIRED_FLAG,ACCEPTANCE_DUE_DATE,PCARD_ID,GOVERNMENT_CONTEXT,AGREEMENT_TYPE,AMOUNT_LIMIT,MIN_RELEASE_AMOUNT,PRICE_UPDATE_TOLERANCE,AGREEMENT_BUYER,AGREEMENT_CONTACT,AGREEMENT_DESCRIPTION,NOTE_TO_SUPPLIER,NOTE_TO_RECEIVER,START_DATE,END_DATE,PAYMENT_TERMS,PAY_ON_CODE,SHIPPING_CONTROL,GLOBAL_ATTRIBUTE_CATEGORY,GLOBAL_ATTRIBUTE1,GLOBAL_ATTRIBUTE2,GLOBAL_ATTRIBUTE3,GLOBAL_ATTRIBUTE4,GLOBAL_ATTRIBUTE5,GLOBAL_ATTRIBUTE6,GLOBAL_ATTRIBUTE7,GLOBAL_ATTRIBUTE8,GLOBAL_ATTRIBUTE9,GLOBAL_ATTRIBUTE10,GLOBAL_ATTRIBUTE11,GLOBAL_ATTRIBUTE12,GLOBAL_ATTRIBUTE13,GLOBAL_ATTRIBUTE14,GLOBAL_ATTRIBUTE15,GLOBAL_ATTRIBUTE16,GLOBAL_ATTRIBUTE17,GLOBAL_ATTRIBUTE18,GLOBAL_ATTRIBUTE19,GLOBAL_ATTRIBUTE20,TYPE_LOOKUP_CODE,PO_AUTHORIZATION_STATUS,FOB_LOOKUP_CODE,FREIGHT_TERMS_LOOKUP_CODE FROM PO_RELEASES_V WHERE NVL(consigned_consumption_flag, 'N') <> 'Y' and ((authorization_status is null or authorization_status not in ('IN PROCESS', 'PRE-APPROVED' ))) and ((NOT(RELEASE_TYPE IN ('BLANKET', 'SCHEDULED')) OR (((PO_RELEASES_V.security_level_code = 'PUBLIC' ) OR (PO_RELEASES_V.security_level_code = 'PRIVATE' AND 183739=AGENT_ID) OR (PO_RELEASES_V.security_level_code = 'HIERARCHY' AND ((183739=AGENT_ID) OR (EXISTS (SELECT 'Y' FROM PO_ACTION_HISTORY POAH2 WHERE POAH2.employee_id =183739 AND POAH2.object_type_code = (DECODE(PO_RELEASES_V.DOCUMENT_TYPE, 'BLANKET', 'PA', 'STANDARD', 'PO' , 'PLANNED' , 'PO' , 'CONTRACT' , 'PA', 'RELEASE' , 'RELEASE' ) ) AND POAH2.object_id = PO_RELEASES_V.PO_RELEASE_ID)) OR (183739 IN (SELECT H.superior_id FROM PO_EMPLOYEE_HIERARCHIES H, PO_SYSTEM_PARAMETERS PSP WHERE H.employee_id = PO_RELEASES_V.AGENT_ID AND H.position_structure_id = NVL(PSP.SECURITY_POSITION_STRUCTURE_ID,-1) AND PSP.ORG_ID = PO_RELEASES_V.ORG_ID )))) OR (PO_RELEASES_V.security_level_code = 'PURCHASING' AND ((183739=AGENT_ID) OR (EXISTS (SELECT 'Y' FROM PO_ACTION_HISTORY POAH2 WHERE POAH2.employee_id =183739 AND POAH2.object_type_code = (DECODE(PO_RELEASES_V.DOCUMENT_TYPE, 'BLANKET', 'PA', 'STANDARD', 'PO' , 'PLANNED' , 'PO' , 'CONTRACT' , 'PA', 'RELEASE' , 'RELEASE' ) ) AND POAH2.object_id = PO_RELEASES_V.PO_RELEASE_ID)) OR (EXISTS(SELECT NULL FROM PO_AGENTS WHERE agent_id= 183739 AND SYSDATE BETWEEN NVL(start_date_active, SYSDATE) AND NVL(end_date_active, SYSDATE+1))))))AND (('MODIFY' = 'VIEW_ONLY' ) OR ( 'MODIFY' = 'MODIFY' AND PO_RELEASES_V.access_level_code IN ('MODIFY','FULL') ) OR ( 'MODIFY' = 'FULL' AND PO_RELEASES_V.access_level_code = 'FULL' ) OR ( 183739 = AGENT_ID))))) and (LAST_UPDATED_BY = last_updated_by
    AND nvl(cancel_flag,'N') ='N'
    AND nvl(closed_code,'OPEN') !='FINALLY CLOSED'
    AND nvl(frozen_flag,'N') !='Y'
    AND release_type IN ('BLANKET','SCHEDULED')
    AND EXISTS (SELECT 'Header is not frozen'
    FROM po_headers ph
    WHERE ph.po_header_id = po_releases_v.po_header_id
    AND NVL(ph.frozen_flag,'N') ='N'
    AND nvl(ph.closed_code,'OPEN') !='FINALLY CLOSED')
    AND ('' IS NULL
    OR po_releases_v.authorization_status IN
    (SELECT plc.lookup_code
    FROM po_lookup_codes plc
    WHERE plc.lookup_type = 'AUTHORIZATION STATUS'
    AND plc.displayed_field LIKE ''))) order by po_num desc, release_num desc
    call count cpu elapsed disk query current rows
    Parse 1 168.61 160.43 288 4291 14 0
    Execute 1 0.01 0.00 0 0 0 0
    Fetch 1 166.81 580.89 18452 2628283 0 2
    total 3 335.43 741.33 18740 2632574 14 2
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 183
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    SQL*Net message to client 1 0.00 0.00
    SQL*Net more data to client 3 0.00 0.00
    db file sequential read 18452 0.88 417.79
    SQL*Net message from client 1 0.00 0.00
    SQL ID: 3ktacv9r56b51
    Plan Hash: 458693102
    select owner#,name,namespace,remoteowner,linkname,p_timestamp,p_obj#,
    nvl(property,0),subname,type#,d_attrs
    from
    dependency$ d, obj$ o where d_obj#=:1 and p_obj#=obj#(+) order by order#
    call count cpu elapsed disk query current rows
    Parse 131 0.00 0.01 0 0 8 0
    Execute 131 0.01 0.03 0 0 0 0
    Fetch 1125 0.25 9.06 386 3632 0 994
    total 1387 0.26 9.10 386 3632 8 994
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Number of plan statistics captured: 3
    Rows (1st) Rows (avg) Rows (max) Row Source Operation
    1 7 20 SORT ORDER BY (cr=27 pr=4 pw=0 time=0 us cost=20 size=375 card=5)
    1 7 20 NESTED LOOPS OUTER (cr=27 pr=4 pw=0 time=18 us cost=19 size=375 card=5)
    1 7 20 TABLE ACCESS BY INDEX ROWID DEPENDENCY$ (cr=4 pr=1 pw=0 time=2 us cost=4 size=155 card=5)
    1 7 20 INDEX RANGE SCAN I_DEPENDENCY1 (cr=3 pr=0 pw=0 time=0 us cost=3 size=0 card=5)(object id 116)
    1 7 20 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=23 pr=3 pw=0 time=0 us cost=3 size=44 card=1)
    1 7 20 INDEX RANGE SCAN I_OBJ1 (cr=16 pr=2 pw=0 time=0 us cost=2 size=0 card=1)(object id 1288242)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 386 0.20 8.95
    SQL ID: cvn54b7yz0s8u
    Plan Hash: 2991757387
    select /*+ index(idl_ub1$ i_idl_ub11) +*/ piece#,length,piece
    from
    idl_ub1$ where obj#=:1 and part=:2 and version=:3 order by piece#
    call count cpu elapsed disk query current rows
    Parse 165 0.00 0.00 0 0 8 0
    Execute 165 0.08 0.06 0 0 0 0
    Fetch 449 0.09 10.49 379 1740 0 410
    total 779 0.17 10.56 379 1740 8 410
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Number of plan statistics captured: 3
    Rows (1st) Rows (avg) Rows (max) Row Source Operation
    1 1 2 TABLE ACCESS BY INDEX ROWID IDL_UB1$ (cr=5 pr=1 pw=0 time=0 us cost=4 size=21 card=1)
    1 1 2 INDEX RANGE SCAN I_IDL_UB11 (cr=4 pr=0 pw=0 time=3 us cost=3 size=0 card=1)(object id 110)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 379 0.22 10.44
    ********************************************************************************

    SQL ID: 8r75sj1fpjn1k
    Plan Hash: 1052563856
    SELECT PLC_STA.DISPLAYED_FIELD, DECODE(POR.CANCEL_FLAG, 'Y',
    PLC_CAN.DISPLAYED_FIELD, NULL), DECODE(NVL(POR.CLOSED_CODE, 'OPEN'), 'OPEN',
    NULL, PLC_CLO.DISPLAYED_FIELD), DECODE(POR.FROZEN_FLAG, 'Y',
    PLC_FRO.DISPLAYED_FIELD, NULL), DECODE(POR.HOLD_FLAG, 'Y',
    PLC_HLD.DISPLAYED_FIELD, NULL), POR.AUTHORIZATION_STATUS,
    NVL(POR.CANCEL_FLAG, 'N'), NVL(POR.CLOSED_CODE, 'OPEN'),
    NVL(POR.FROZEN_FLAG, 'N'), NVL(POR.HOLD_FLAG, 'N')
    FROM
    PO_RELEASES POR, PO_LOOKUP_CODES PLC_STA, PO_LOOKUP_CODES PLC_CAN,
    PO_LOOKUP_CODES PLC_CLO, PO_LOOKUP_CODES PLC_FRO, PO_LOOKUP_CODES PLC_HLD
    WHERE PLC_STA.LOOKUP_CODE = DECODE(POR.APPROVED_FLAG, 'R',
    POR.APPROVED_FLAG, NVL(POR.AUTHORIZATION_STATUS,'INCOMPLETE')) AND
    PLC_STA.LOOKUP_TYPE IN ('PO APPROVAL', 'DOCUMENT STATE') AND
    PLC_CAN.LOOKUP_CODE = 'CANCELLED' AND PLC_CAN.LOOKUP_TYPE = 'DOCUMENT
    STATE' AND PLC_CLO.LOOKUP_CODE = NVL(POR.CLOSED_CODE, 'OPEN') AND
    PLC_CLO.LOOKUP_TYPE = 'DOCUMENT STATE' AND PLC_FRO.LOOKUP_CODE = 'FROZEN'
    AND PLC_FRO.LOOKUP_TYPE = 'DOCUMENT STATE' AND PLC_HLD.LOOKUP_CODE = 'ON
    HOLD' AND PLC_HLD.LOOKUP_TYPE = 'DOCUMENT STATE' AND POR.PO_RELEASE_ID =
    :B1
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 114597 37.02 40.60 0 0 0 0
    Fetch 114597 64.11 68.70 239 2988322 0 114597
    total 229195 101.13 109.30 239 2988322 0 114597
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 183 (recursive depth: 1)
    Number of plan statistics captured: 1
    Rows (1st) Rows (avg) Rows (max) Row Source Operation
    1 1 1 NESTED LOOPS (cr=27 pr=6 pw=0 time=0 us)
    1 1 1 NESTED LOOPS (cr=26 pr=5 pw=0 time=0 us cost=18 size=323 card=1)
    1 1 1 MERGE JOIN CARTESIAN (cr=20 pr=4 pw=0 time=0 us cost=14 size=265 card=1)
    1 1 1 MERGE JOIN CARTESIAN (cr=16 pr=4 pw=0 time=0 us cost=11 size=207 card=1)
    1 1 1 MERGE JOIN CARTESIAN (cr=12 pr=4 pw=0 time=0 us cost=8 size=149 card=1)
    1 1 1 NESTED LOOPS (cr=8 pr=4 pw=0 time=0 us cost=5 size=91 card=1)
    1 1 1 TABLE ACCESS BY INDEX ROWID PO_RELEASES_ALL (cr=4 pr=2 pw=0 time=0 us cost=2 size=33 card=1)
    1 1 1 INDEX UNIQUE SCAN PO_RELEASES_U1 (cr=2 pr=2 pw=0 time=0 us cost=1 size=0 card=1)(object id 45219)
    1 1 1 TABLE ACCESS BY INDEX ROWID FND_LOOKUP_VALUES (cr=4 pr=2 pw=0 time=0 us cost=3 size=58 card=1)
    1 1 1 INDEX RANGE SCAN FND_LOOKUP_VALUES_U1 (cr=3 pr=1 pw=0 time=0 us cost=2 size=0 card=1)(object id 33540)
    1 1 1 BUFFER SORT (cr=4 pr=0 pw=0 time=0 us cost=5 size=58 card=1)
    1 1 1 TABLE ACCESS BY INDEX ROWID FND_LOOKUP_VALUES (cr=4 pr=0 pw=0 time=0 us cost=3 size=58 card=1)
    1 1 1 INDEX RANGE SCAN FND_LOOKUP_VALUES_U1 (cr=3 pr=0 pw=0 time=0 us cost=2 size=0 card=1)(object id 33540)
    1 1 1 BUFFER SORT (cr=4 pr=0 pw=0 time=0 us cost=8 size=58 card=1)
    1 1 1 TABLE ACCESS BY INDEX ROWID FND_LOOKUP_VALUES (cr=4 pr=0 pw=0 time=0 us cost=3 size=58 card=1)
    1 1 1 INDEX RANGE SCAN FND_LOOKUP_VALUES_U1 (cr=3 pr=0 pw=0 time=0 us cost=2 size=0 card=1)(object id 33540)
    1 1 1 BUFFER SORT (cr=4 pr=0 pw=0 time=0 us cost=11 size=58 card=1)
    1 1 1 TABLE ACCESS BY INDEX ROWID FND_LOOKUP_VALUES (cr=4 pr=0 pw=0 time=0 us cost=3 size=58 card=1)
    1 1 1 INDEX RANGE SCAN FND_LOOKUP_VALUES_U1 (cr=3 pr=0 pw=0 time=0 us cost=2 size=0 card=1)(object id 33540)
    1 1 1 INLIST ITERATOR (cr=6 pr=1 pw=0 time=0 us)
    1 1 1 INDEX RANGE SCAN FND_LOOKUP_VALUES_U1 (cr=6 pr=1 pw=0 time=0 us cost=3 size=0 card=1)(object id 33540)
    1 1 1 TABLE ACCESS BY INDEX ROWID FND_LOOKUP_VALUES (cr=1 pr=1 pw=0 time=0 us cost=4 size=58 card=1)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 239 0.23 4.54
    SQL ID: 7ng34ruy5awxq
    Plan Hash: 3984801583
    select i.obj#,i.ts#,i.file#,i.block#,i.intcols,i.type#,i.flags,i.property,
    i.pctfree$,i.initrans,i.maxtrans,i.blevel,i.leafcnt,i.distkey,i.lblkkey,
    i.dblkkey,i.clufac,i.cols,i.analyzetime,i.samplesize,i.dataobj#,
    nvl(i.degree,1),nvl(i.instances,1),i.rowcnt,mod(i.pctthres$,256),
    i.indmethod#,i.trunccnt,nvl(c.unicols,0),nvl(c.deferrable#+c.valid#,0),
    nvl(i.spare1,i.intcols),i.spare4,i.spare2,i.spare6,decode(i.pctthres$,null,
    null,mod(trunc(i.pctthres$/256),256)),ist.cachedblk,ist.cachehit,
    ist.logicalread
    from
    ind$ i, ind_stats$ ist, (select enabled, min(cols) unicols,
    min(to_number(bitand(defer,1))) deferrable#,min(to_number(bitand(defer,4)))
    valid# from cdef$ where obj#=:1 and enabled > 1 group by enabled) c where
    i.obj#=c.enabled(+) and i.obj# = ist.obj#(+) and i.bo#=:1 order by i.obj#
    call count cpu elapsed disk query current rows
    Parse 24 0.01 0.00 0 0 4 0
    Execute 80 0.03 0.04 0 0 0 0
    Fetch 470 0.27 6.55 197 882 0 390
    total 574 0.31 6.60 197 882 4 390
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Number of plan statistics captured: 24
    Rows (1st) Rows (avg) Rows (max) Row Source Operation
    1 5 18 SORT ORDER BY (cr=11 pr=3 pw=0 time=0 us cost=8 size=376 card=2)
    1 5 18 HASH JOIN OUTER (cr=11 pr=3 pw=0 time=2 us cost=7 size=376 card=2)
    1 5 18 NESTED LOOPS OUTER (cr=7 pr=2 pw=0 time=7560 us cost=3 size=290 card=2)
    1 5 18 TABLE ACCESS CLUSTER IND$ (cr=6 pr=2 pw=0 time=7555 us cost=3 size=186 card=2)
    1 1 1 INDEX UNIQUE SCAN I_OBJ# (cr=2 pr=0 pw=0 time=0 us cost=1 size=0 card=1)(object id 3)
    0 0 0 TABLE ACCESS BY INDEX ROWID IND_STATS$ (cr=1 pr=0 pw=0 time=0 us cost=0 size=52 card=1)
    0 0 0 INDEX UNIQUE SCAN I_IND_STATS$_OBJ# (cr=1 pr=0 pw=0 time=0 us cost=0 size=0 card=1)(object id 647660)
    0 0 0 VIEW (cr=4 pr=1 pw=0 time=0 us cost=3 size=43 card=1)
    0 0 0 SORT GROUP BY (cr=4 pr=1 pw=0 time=0 us cost=3 size=16 card=1)
    0 0 0 TABLE ACCESS CLUSTER CDEF$ (cr=4 pr=1 pw=0 time=0 us cost=2 size=16 card=1)
    1 1 1 INDEX UNIQUE SCAN I_COBJ# (cr=2 pr=0 pw=0 time=0 us cost=1 size=0 card=1)(object id 27)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 197 0.35 6.34
    SQL ID: 96g93hntrzjtr
    Plan Hash: 841937906
    select /*+ rule */ bucket_cnt, row_cnt, cache_cnt, null_cnt, timestamp#,
    sample_size, minimum, maximum, distcnt, lowval, hival, density, col#,
    spare1, spare2, avgcln
    from
    hist_head$ where obj#=:1 and intcol#=:2
    call count cpu elapsed disk query current rows
    Parse 38 0.01 0.00 0 0 2 0
    Execute 663 0.28 0.24 0 0 0 0
    Fetch 663 0.05 4.84 150 2731 0 656
    total 1364 0.34 5.09 150 2731 2 656
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: RULE
    Parsing user id: SYS (recursive depth: 1)
    Number of plan statistics captured: 38
    Rows (1st) Rows (avg) Rows (max) Row Source Operation
    1 1 1 TABLE ACCESS BY INDEX ROWID HIST_HEAD$ (cr=4 pr=1 pw=0 time=0 us)
    1 1 1 INDEX RANGE SCAN I_HH_OBJ#_INTCOL# (cr=3 pr=0 pw=0 time=0 us)(object id 194)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 150 0.28 4.80
    SQL ID: ga9j9xk5cy9s0
    Plan Hash: 467424113
    select /*+ index(idl_sb4$ i_idl_sb41) +*/ piece#,length,piece
    from
    idl_sb4$ where obj#=:1 and part=:2 and version=:3 order by piece#
    call count cpu elapsed disk query current rows
    Parse 165 0.00 0.01 0 0 8 0
    Execute 165 0.05 0.07 0 0 0 0
    Fetch 369 0.11 3.79 141 1107 0 204
    total 699 0.16 3.88 141 1107 8 204
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Number of plan statistics captured: 3
    Rows (1st) Rows (avg) Rows (max) Row Source Operation
    2 2 2 TABLE ACCESS BY INDEX ROWID IDL_SB4$ (cr=6 pr=0 pw=0 time=0 us cost=4 size=19 card=1)
    2 2 2 INDEX RANGE SCAN I_IDL_SB41 (cr=5 pr=0 pw=0 time=9 us cost=3 size=0 card=1)(object id 113)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 141 0.20 3.75
    SQL ID: 39m4sx9k63ba2
    Plan Hash: 2769382227
    select /*+ index(idl_ub2$ i_idl_ub21) +*/ piece#,length,piece
    from
    idl_ub2$ where obj#=:1 and part=:2 and version=:3 order by piece#
    call count cpu elapsed disk query current rows
    Parse 165 0.03 0.01 0 0 8 0
    Execute 165 0.05 0.06 0 0 0 0
    Fetch 219 0.03 3.08 114 759 0 93
    total 549 0.11 3.16 114 759 8 93
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 1)
    Number of plan statistics captured: 3
    Rows (1st) Rows (avg) Rows (max) Row Source Operation
    2 1 2 TABLE ACCESS BY INDEX ROWID IDL_UB2$ (cr=5 pr=1 pw=0 time=0 us cost=4 size=20 card=1)
    2 1 2 INDEX RANGE SCAN I_IDL_UB21 (cr=4 pr=0 pw=0 time=9 us cost=3 size=0 card=1)(object id 112)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 114 0.13 3.06
    SQL ID: 8swypbbr0m372
    Plan Hash: 872636971
    select order#,columns,types
    from
    access$ where d_obj#=:1
    call count cpu elapsed disk query current rows
    Parse 131 0.00 0.01 0 0 8 0
    Execute 131 0.02 0.02 0 0 0 0
    Fetch 1017 0.05 2.77 113 2170 0 886
    total 1279 0.07 2.81 113 2170 8 886
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: CHOOSE
    Parsing user id: SYS (recursive depth: 2)
    Number of plan statistics captured: 3
    Rows (1st) Rows (avg) Rows (max) Row Source Operation
    0 4 12 TABLE ACCESS BY INDEX ROWID ACCESS$ (cr=11 pr=1 pw=0 time=0 us cost=4 size=200 card=8)
    0 4 12 INDEX RANGE SCAN I_ACCESS1 (cr=7 pr=0 pw=0 time=3 us cost=3 size=0 card=8)(object id 118)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 113 0.14 2.74
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call count cpu elapsed disk query current rows
    Parse 100 168.74 160.81 295 4538 40 0
    Execute 119 3.39 3.38 2 43 0 12
    Fetch 107 166.95 583.44 18545 2628759 0 364
    total 326 339.08 747.64 18842 2633340 40 376
    Misses in library cache during parse: 30
    Misses in library cache during execute: 11
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    SQL*Net message to client 221 0.00 0.00
    SQL*Net message from client 221 100.05 191.50
    db file sequential read 18558 0.88 420.50
    log file sync 2 0.01 0.01
    SQL*Net more data to client 52 0.00 0.00
    SQL*Net more data from client 9 0.03 0.03
    SQL*Net break/reset to client 2 0.00 0.00
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call count cpu elapsed disk query current rows
    Parse 2161 0.50 0.48 0 0 282 0
    Execute 349226 639.57 671.70 7 86 74 9
    Fetch 365281 113.87 886.34 48788 5852890 0 362441
    total 716668 753.94 1558.53 48795 5852976 356 362450
    Misses in library cache during parse: 119
    Misses in library cache during execute: 136
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 48795 1.12 781.12
    latch: row cache objects 1 0.00 0.00
    344378 user SQL statements in session.
    4837 internal SQL statements in session.
    349215 SQL statements in session.
    Trace file: DCPRD_ora_9930_AIBRAHIM80.trc
    Trace file compatibility: 11.1.0.7
    Sort options: prsdsk exedsk fchdsk
    1 session in tracefile.
    344378 user SQL statements in trace file.
    4837 internal SQL statements in trace file.
    349215 SQL statements in trace file.
    196 unique SQL statements in trace file.
    32265404 lines in trace file.
    2505 elapsed seconds in trace file.
    Regards,
    Tareq

  • Query tuning using TKprof

    Hi all,
    I have one procedure which takes normally more time to finish, cpu is normal at that time still the procedure takes more time. TKPROF has been generated and find the output below. As i am new with tkprof, what are the points need to noted and with the tkprof how we can impove the response of the query.
    TKPROF: Release 10.2.0.1.0 - Production on Tue Jan 8 17:03:09 2008
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Trace file: odsprod_ora_27486.trc
    Sort options: default
    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 B.CITY_CODE||'-'||B.STORE_NO||'-'||B.STORE_SHORT_NAME CITY_STORE,
    RPAD(K1.TDATE,14,' ') TDATE, RPAD(K1.TAMT,14,' ') TAMT, RPAD(K1.NTKT ,9,' ')
    NTKT, K1.POS POS
    FROM
    ( SELECT SUBSTR(STORE_NO,3,6) STNO, TRANS_DATE TDATE, TICKET_AMOUNT TAMT,
    TICKET_NO NTKT, POS_NO POS FROM DEVDBA.S_RET_TICKET_END_REJ WHERE
    TRUNC(RECORD_DATE)=TRUNC(SYSDATE) AND TRAINING_MODE_FLAG=0 AND
    VOID_TICKET_FLAG=0 AND (TICKET_AMOUNT>1000000 OR TICKET_AMOUNT<-1000000 ) )
    K1,DEVDBA.S_SITE_MASTER B WHERE STNO=B.STORE_NO
    call count cpu elapsed disk query current rows
    Parse 1 0.02 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.39 2.51 4641 4648 0 0
    total 3 0.41 2.52 4641 4648 0 0
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 86 (ORADMIN) (recursive depth: 1)
    Rows Row Source Operation
    0 NESTED LOOPS (cr=4648 pr=4641 pw=0 time=2518383 us)
    0 TABLE ACCESS FULL S_RET_TICKET_END_REJ (cr=4648 pr=4641 pw=0 time=2518377 us)
    0 TABLE ACCESS BY INDEX ROWID S_SITE_MASTER (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN PK_SITE_NUM (cr=0 pr=0 pw=0 time=0 us)(object id 98999)
    Rows Execution Plan
    0 SELECT STATEMENT MODE: ALL_ROWS
    0 NESTED LOOPS
    0 TABLE ACCESS MODE: ANALYZED (FULL) OF 'S_RET_TICKET_END_REJ'
    (TABLE)
    0 TABLE ACCESS MODE: ANALYZED (BY INDEX ROWID) OF
    'S_SITE_MASTER' (TABLE)
    0 INDEX MODE: ANALYZED (UNIQUE SCAN) OF 'PK_SITE_NUM' (INDEX
    (UNIQUE))
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 3 0.02 0.04
    db file scattered read 89 0.07 2.19
    BEGIN PROC_RET_REPORT_TEST; END;
    call count cpu elapsed disk query current rows
    Parse 0 0.00 0.00 0 0 0 0
    Execute 1 407.03 714.35 1306018 2069759 0 1
    Fetch 0 0.00 0.00 0 0 0 0
    total 1 407.03 714.35 1306018 2069759 0 1
    Misses in library cache during parse: 0
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 86 (ORADMIN)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    TCP Socket (KGAS) 43 0.11 0.12
    SQL*Net message to client 1 0.00 0.00
    SQL*Net message from client 1 0.20 0.20
    BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 3 0 1
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.00 0.00 0 3 0 1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 86 (ORADMIN)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    SQL*Net message to client 1 0.00 0.00
    SQL*Net message from client 1 0.03 0.03
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 2 407.03 714.35 1306018 2069762 0 2
    Fetch 0 0.00 0.00 0 0 0 0
    total 3 407.03 714.35 1306018 2069762 0 2
    Misses in library cache during parse: 0
    Misses in library cache during execute: 1
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file scattered read 7444 0.51 106.03
    db file sequential read 9311 0.25 13.64
    TCP Socket (KGAS) 43 0.11 0.12
    SQL*Net message to client 4 0.00 0.00
    SQL*Net message from client 4 201.99 202.27
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call count cpu elapsed disk query current rows
    Parse 22 0.05 0.04 0 0 0 0
    Execute 30 0.03 0.02 0 0 0 0
    Fetch 40 0.40 2.57 4646 4883 0 34
    total 92 0.48 2.64 4646 4883 0 34
    Misses in library cache during parse: 10
    Misses in library cache during execute: 5
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file scattered read 89 0.07 2.19
    db file sequential read 8 0.02 0.08
    3 user SQL statements in session.
    31 internal SQL statements in session.
    34 SQL statements in session.
    1 statement EXPLAINed in this session.
    Trace file: odsprod_ora_27486.trc
    Trace file compatibility: 10.01.00
    Sort options: default
    1 session in tracefile.
    3 user SQL statements in trace file.
    31 internal SQL statements in trace file.
    34 SQL statements in trace file.
    13 unique SQL statements in trace file.
    1 SQL statements EXPLAINed using schema:
    ORADMIN.prof$plan_table
    Default table was used.
    Table was created.
    Table was dropped.
    17240 lines in trace file.
    2 elapsed seconds in trace file.
    Sorry for the formatting,
    Now i have enabled certain event generated trace files for the same procedure, please find the part of o/p below. Now what is the actual problem stating in the trace file.Now this trace file is very big. So only find the particular points
    WAIT #23: nam='db file scattered read' ela= 15889 file#=8 block#=513995 blocks=62 obj#=102475 tim=5857651746404
    WAIT #23: nam='db file sequential read' ela= 52 file#=12 block#=518683 blocks=1 obj#=102476 tim=5857651755104
    ARSING IN CURSOR #25 len=69 dep=2 uid=0 oct=3 lid=0 tim=5857874309691 hv=1471956217 ad='2af8ea78'
    select con#,obj#,rcon#,enabled,nvl(defer,0) from cdef$ where robj#=:1
    END OF STMT
    PARSE #25:c=10000,e=6668,p=0,cr=0,cu=0,mis=1,r=0,dep=2,og=4,tim=5857874309683
    EXEC #25:c=0,e=3780,p=0,cr=0,cu=0,mis=1,r=0,dep=2,og=4,tim=5857874313677
    FETCH #25:c=0,e=22,p=0,cr=1,cu=0,mis=0,r=0,dep=2,og=4,tim=5857874313766
    STAT #25 id=1 cnt=0 pid=0 pos=1 obj=31 op='TABLE ACCESS BY INDEX ROWID CDEF$ (cr=1 pr=0 pw=0 time=25 us)'
    STAT #25 id=2 cnt=0 pid=1 pos=1 obj=52 op='INDEX RANGE SCAN I_CDEF3 (cr=1 pr=0 pw=0 time=18 us)'
    =====================
    PARSING IN CURSOR #25 len=146 dep=2 uid=0 oct=3 lid=0 tim=5857874316480 hv=2107929772 ad='2bedcd80'
    select con#,type#,condlength,intcols,robj#,rcon#,match#,refact,nvl(enabled,0),rowid,cols,nvl(defer,0),mtime,nvl(spare1,0) from cdef$ where obj#=:1
    END OF STMT
    PARSE #25:c=0,e=2534,p=0,cr=0,cu=0,mis=1,r=0,dep=2,og=4,tim=5857874316476
    =====================
    PARSING IN CURSOR #26 len=210 dep=3 uid=0 oct=3 lid=0 tim=5857874317518 hv=864012087 ad='2beb15a0'
    select /*+ rule */ bucket_cnt, row_cnt, cache_cnt, null_cnt, timestamp#, sample_size, minimum, maximum, distcnt, lowval, hival, density, col#, spare1, spare2, avgcln from hist_head$ where obj#=:1 and intcol#=:2
    END OF STMT
    PARSE #26:c=0,e=63,p=0,cr=0,cu=0,mis=0,r=0,dep=3,og=3,tim=5857874317514
    EXEC #26:c=0,e=64,p=0,cr=0,cu=0,mis=0,r=0,dep=3,og=3,tim=5857874317818
    WAIT #26: nam='db file sequential read' ela= 10371 file#=1 block#=1778 blocks=1 obj#=266662 tim=5857874328282
    FETCH #26:c=0,e=10527,p=1,cr=4,cu=0,mis=0,r=1,dep=3,og=3,tim=5857874328383
    STAT #26 id=1 cnt=1 pid=0 pos=1 obj=255 op='TABLE ACCESS BY INDEX ROWID HIST_HEAD$ (cr=4 pr=1 pw=0 time=10521 us)'
    STAT #26 id=2 cnt=1 pid=1 pos=1 obj=257 op='INDEX RANGE SCAN I_HH_OBJ#_INTCOL# (cr=3 pr=0 pw=0 time=30 us)'
    =====================
    PARSING IN CURSOR #26 len=210 dep=3 uid=0 oct=3 lid=0 tim=5857874328696 hv=864012087 ad='2beb15a0'
    select /*+ rule */ bucket_cnt, row_cnt, cache_cnt, null_cnt, timestamp#, sample_size, minimum, maximum, distcnt, lowval, hival, density, col#, spare1, spare2, avgcln from hist_head$ where obj#=:1 and intcol#=:2
    END OF STMT
    EXEC #26:c=0,e=31,p=0,cr=0,cu=0,mis=0,r=0,dep=3,og=3,tim=5857874328692
    FETCH #26:c=0,e=26,p=0,cr=4,cu=0,mis=0,r=1,dep=3,og=3,tim=5857874328815
    STAT #26 id=1 cnt=2 pid=0 pos=1 obj=255 op='TABLE ACCESS BY INDEX ROWID HIST_HEAD$ (cr=8 pr=1 pw=0 time=10545 us)'
    STAT #26 id=2 cnt=2 pid=1 pos=1 obj=257 op='INDEX RANGE SCAN I_HH_OBJ#_INTCOL# (cr=6 pr=0 pw=0 time=44 us)'
    =====================
    PARSING IN CURSOR #26 len=121 dep=3 uid=0 oct=3 lid=0 tim=5857874332429 hv=3150898423 ad='2beb0588'
    select /*+ rule */ bucket, endpoint, col#, epvalue from histgrm$ where obj#=:1 and intcol#=:2 and row#=:3 order by bucket
    END OF STMT
    PARSE #26:c=0,e=3475,p=0,cr=0,cu=0,mis=1,r=0,dep=3,og=3,tim=5857874332424
    EXEC #26:c=0,e=2945,p=0,cr=0,cu=0,mis=1,r=0,dep=3,og=3,tim=5857874335562
    WAIT #26: nam='db file sequential read' ela= 8681 file#=1 block#=1819 blocks=1 obj#=266662 tim=5857874344365
    FETCH #26:c=0,e=9040,p=1,cr=3,cu=0,mis=0,r=10,dep=3,og=3,tim=5857874344669
    STAT #26 id=1 cnt=10 pid=0 pos=1 obj=0 op='SORT ORDER BY (cr=3 pr=1 pw=0 time=8996 us)'
    STAT #26 id=2 cnt=10 pid=1 pos=1 obj=253 op='TABLE ACCESS CLUSTER HISTGRM$ (cr=3 pr=1 pw=0 time=8896 us)'
    STAT #26 id=3 cnt=1 pid=2 pos=1 obj=252 op='INDEX UNIQUE SCAN I_OBJ#_INTCOL# (cr=2 pr=0 pw=0 time=23 us)'
    =====================
    PARSING IN CURSOR #26 len=210 dep=3 uid=0 oct=3 lid=0 tim=5857874345413 hv=864012087 ad='2beb15a0'
    select /*+ rule */ bucket_cnt, row_cnt, cache_cnt, null_cnt, timestamp#, sample_size, minimum, maximum, distcnt, lowval, hival, density, col#, spare1, spare2, avgcln from hist_head$ where obj#=:1 and intcol#=:2
    END OF STMT
    EXEC #26:c=0,e=111,p=0,cr=0,cu=0,mis=0,r=0,dep=3,og=3,tim=5857874345408
    FETCH #26:c=0,e=58,p=0,cr=4,cu=0,mis=0,r=1,dep=3,og=3,tim=5857874345580
    STAT #26 id=1 cnt=3 pid=0 pos=1 obj=255 op='TABLE ACCESS BY INDEX ROWID HIST_HEAD$ (cr=12 pr=1 pw=0 time=10604 us)'
    STAT #26 id=2 cnt=3 pid=1 pos=1 obj=257 op='INDEX RANGE SCAN I_HH_OBJ#_INTCOL# (cr=9 pr=0 pw=0 time=84 us)'
    =====================
    PARSING IN CURSOR #26 len=210 dep=3 uid=0 oct=3 lid=0 tim=5857874345898 hv=864012087 ad='2beb15a0'
    select /*+ rule */ bucket_cnt, row_cnt, cache_cnt, null_cnt, timestamp#, sample_size, minimum, maximum, distcnt, lowval, hival, density, col#, spare1, spare2, avgcln from hist_head$ where obj#=:1 and intcol#=:2
    END OF STMT
    EXEC #26:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=3,og=3,tim=5857874345894
    FETCH #26:c=0,e=16,p=0,cr=3,cu=0,mis=0,r=0,dep=3,og=3,tim=5857874346046
    STAT #26 id=1 cnt=3 pid=0 pos=1 obj=255 op='TABLE ACCESS BY INDEX ROWID HIST_HEAD$ (cr=15 pr=1 pw=0 time=10623 us)'
    STAT #26 id=2 cnt=3 pid=1 pos=1 obj=257 op='INDEX RANGE SCAN I_HH_OBJ#_INTCOL# (cr=12 pr=0 pw=0 time=100 us)'
    =====================
    PARSING IN CURSOR #26 len=210 dep=3 uid=0 oct=3 lid=0 tim=5857874346370 hv=864012087 ad='2beb15a0'
    select /*+ rule */ bucket_cnt, row_cnt, cache_cnt, null_cnt, timestamp#, sample_size, minimum, maximum, distcnt, lowval, hival, density, col#, spare1, spare2, avgcln from hist_head$ where obj#=:1 and intcol#=:2
    END OF STMT
    EXEC #26:c=0,e=26,p=0,cr=0,cu=0,mis=0,r=0,dep=3,og=3,tim=5857874346366
    FETCH #26:c=0,e=27,p=0,cr=4,cu=0,mis=0,r=1,dep=3,og=3,tim=5857874346494
    STAT #26 id=1 cnt=4 pid=0 pos=1 obj=255 op='TABLE ACCESS BY INDEX ROWID HIST_HEAD$ (cr=19 pr=1 pw=0 time=10645 us)'
    STAT #26 id=2 cnt=4 pid=1 pos=1 obj=257 op='INDEX RANGE SCAN I_HH_OBJ#_INTCOL# (cr=15 pr=0 pw=0 time=113 us)'
    =====================
    PARSING IN CURSOR #26 len=210 dep=3 uid=0 oct=3 lid=0 tim=5857874346747 hv=864012087 ad='2beb15a0'
    select /*+ rule */ bucket_cnt, row_cnt, cache_cnt, null_cnt, timestamp#, sample_size, minimum, maximum, distcnt, lowval, hival, density, col#, spare1, spare2, avgcln from hist_head$ where obj#=:1 and intcol#=:2
    END OF STMT
    EXEC #26:c=0,e=21,p=0,cr=0,cu=0,mis=0,r=0,dep=3,og=3,tim=5857874346744
    FETCH #26:c=0,e=24,p=0,cr=4,cu=0,mis=0,r=1,dep=3,og=3,tim=5857874346859
    STAT #26 id=1 cnt=5 pid=0 pos=1 obj=255 op='TABLE ACCESS BY INDEX ROWID HIST_HEAD$ (cr=23 pr=1 pw=0 time=10666 us)'
    STAT #26 id=2 cnt=5 pid=1 pos=1 obj=257 op='INDEX RANGE SCAN I_HH_OBJ#_INTCOL# (cr=18 pr=0 pw=0 time=126 us)'
    =====================
    PARSING IN CURSOR #26 len=121 dep=3 uid=0 oct=3 lid=0 tim=5857874347077 hv=3150898423 ad='2beb0588'
    select /*+ rule */ bucket, endpoint, col#, epvalue from histgrm$ where obj#=:1 and intcol#=:2 and row#=:3 order by bucket
    END OF STMT
    EXEC #26:c=0,e=50,p=0,cr=0,cu=0,mis=0,r=0,dep=3,og=3,tim=5857874347073
    WAIT #26: nam='db file sequential read' ela= 10038 file#=1 block#=62670 blocks=1 obj#=266662 tim=5857874357272
    FETCH #26:c=0,e=10206,p=1,cr=3,cu=0,mis=0,r=3,dep=3,og=3,tim=5857874357373
    STAT #26 id=1 cnt=13 pid=0 pos=1 obj=0 op='SORT ORDER BY (cr=6 pr=2 pw=0 time=19206 us)'
    STAT #26 id=2 cnt=13 pid=1 pos=1 obj=253 op='TABLE ACCESS CLUSTER HISTGRM$ (cr=6 pr=2 pw=0 time=19073 us)'
    STAT #26 id=3 cnt=2 pid=2 pos=1 obj=252 op='INDEX UNIQUE SCAN I_OBJ#_INTCOL# (cr=4 pr=0 pw=0 time=47 us)'
    EXEC #25:c=20000,e=47991,p=3,cr=29,cu=0,mis=1,r=0,dep=2,og=4,tim=5857874364704
    FETCH #25:c=0,e=28,p=0,cr=2,cu=0,mis=0,r=0,dep=2,og=4,tim=5857874364807
    STAT #25 id=1 cnt=0 pid=0 pos=1 obj=31 op='TABLE ACCESS BY INDEX ROWID CDEF$ (cr=2 pr=0 pw=0 time=31 us)'
    STAT #25 id=2 cnt=0 pid=1 pos=1 obj=51 op='INDEX RANGE SCAN I_CDEF2 (cr=2 pr=0 pw=0 time=26 us)'
    =====================
    PARSING IN CURSOR #26 len=79 dep=2 uid=0 oct=3 lid=0 tim=5857874369296 hv=1782622679 ad='29ccc320'
    select min(bitmapped) from ts$ where dflmaxext =:1 and bitand(flags,1024) =1024
    END OF STMT
    PARSE #26:c=10000,e=2920,p=0,cr=0,cu=0,mis=1,r=0,dep=2,og=4,tim=5857874369291
    EXEC #26:c=0,e=3231,p=0,cr=0,cu=0,mis=1,r=0,dep=2,og=4,tim=5857874372683
    FETCH #26:c=0,e=177,p=0,cr=18,cu=0,mis=0,r=1,dep=2,og=4,tim=5857874372914
    FETCH #26:c=0,e=1,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=0,tim=5857874372967
    STAT #26 id=1 cnt=1 pid=0 pos=1 obj=0 op='SORT AGGREGATE (cr=18 pr=0 pw=0 time=189 us)'
    STAT #26 id=2 cnt=1 pid=1 pos=1 obj=16 op='TABLE ACCESS FULL TS$ (cr=18 pr=0 pw=0 time=167 us)'
    =====================
    PARSING IN CURSOR #25 len=79 dep=2 uid=0 oct=3 lid=0 tim=5857874373282 hv=1782622679 ad='29ccc320'
    select min(bitmapped) from ts$ where dflmaxext =:1 and bitand(flags,1024) =1024
    END OF STMT
    PARSE #25:c=0,e=44,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=4,tim=5857874373279
    EXEC #25:c=0,e=29,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=4,tim=5857874373433
    FETCH #25:c=0,e=100,p=0,cr=18,cu=0,mis=0,r=1,dep=2,og=4,tim=5857874373569
    FETCH #25:c=0,e=1,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=0,tim=5857874373617
    STAT #25 id=1 cnt=1 pid=0 pos=1 obj=0 op='SORT AGGREGATE (cr=18 pr=0 pw=0 time=106 us)'
    STAT #25 id=2 cnt=1 pid=1 pos=1 obj=16 op='TABLE ACCESS FULL TS$ (cr=18 pr=0 pw=0 time=95 us)'
    =====================
    PARSING IN CURSOR #26 len=79 dep=2 uid=0 oct=3 lid=0 tim=5857874373766 hv=1782622679 ad='29ccc320'
    select min(bitmapped) from ts$ where dflmaxext =:1 and bitand(flags,1024) =1024
    END OF STMT
    PARSE #26:c=0,e=24,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=4,tim=5857874373763
    EXEC #26:c=0,e=24,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=4,tim=5857874373902
    FETCH #26:c=0,e=92,p=0,cr=18,cu=0,mis=0,r=1,dep=2,og=4,tim=5857874374030
    FETCH #26:c=0,e=1,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=0,tim=5857874374078
    STAT #26 id=1 cnt=1 pid=0 pos=1 obj=0 op='SORT AGGREGATE (cr=18 pr=0 pw=0 time=96 us)'
    STAT #26 id=2 cnt=1 pid=1 pos=1 obj=16 op='TABLE ACCESS FULL TS$ (cr=18 pr=0 pw=0 time=87 us)'
    =====================
    PARSING IN CURSOR #24 len=496 dep=1 uid=86 oct=3 lid=86 tim=5857874377134 hv=2953360709 ad='f2a17790'
    SELECT B.CITY_CODE||'-'||B.STORE_NO||'-'||B.STORE_SHORT_NAME CITY_STORE, RPAD(K1.TDATE,14,' ') TDATE, RPAD(K1.TAMT,14,' ') TAMT, RPAD(K1.NTKT ,9,' ')NTKT, K1.POS POS FROM ( SELECT SUBSTR(STORE_NO,3,6) STNO, TRANS_DATE TDATE, TICKET_AMOUNT TAMT, TICKET_NO NTKT, POS_NO POS FROM DEVDBA.S_RET_TICKET_END_REJ WHERE TRUNC(RECORD_DATE)=TRUNC(SYSDATE) AND TRAINING_MODE_FLAG=0 AND VOID_TICKET_FLAG=0 AND (TICKET_AMOUNT>1000000 OR TICKET_AMOUNT<-1000000 ) )K1,DEVDBA.S_SITE_MASTER B WHERE STNO=B.STORE_NO
    END OF STMT
    PARSE #24:c=60000,e=75793,p=3,cr=86,cu=0,mis=1,r=0,dep=1,og=1,tim=5857874377128
    EXEC #24:c=0,e=53,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=1,tim=5857874377294
    WAIT #24: nam='db file sequential read' ela= 11063 file#=28 block#=502155 blocks=1 obj#=108859 tim=5857874388592
    WAIT #24: nam='db file scattered read' ela= 12272 file#=28 block#=502156 blocks=5 obj#=108859 tim=5857874401123
    FETCH #24:c=390000,e=2518389,p=4641,cr=4648,cu=0,mis=0,r=0,dep=1,og=1,tim=5857876895883
    =====================
    PARSING IN CURSOR #26 len=79 dep=2 uid=0 oct=3 lid=0 tim=5857876898889 hv=1782622679 ad='29ccc320'
    select min(bitmapped) from ts$ where dflmaxext =:1 and bitand(flags,1024) =1024
    END OF STMT
    PARSE #26:c=0,e=45,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=4,tim=5857876898885
    EXEC #26:c=0,e=108,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=4,tim=5857876899153
    FETCH #26:c=0,e=186,p=0,cr=18,cu=0,mis=0,r=1,dep=2,og=4,tim=5857876899385
    FETCH #26:c=0,e=1,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=0,tim=5857876899435
    STAT #26 id=1 cnt=1 pid=0 pos=1 obj=0 op='SORT AGGREGATE (cr=18 pr=0 pw=0 time=201 us)'
    STAT #26 id=2 cnt=1 pid=1 pos=1 obj=16 op='TABLE ACCESS FULL TS$ (cr=18 pr=0 pw=0 time=171 us)'
    =====================
    PARSING IN CURSOR #26 len=79 dep=2 uid=0 oct=3 lid=0 tim=5857876899687 hv=1782622679 ad='29ccc320'
    select min(bitmapped) from ts$ where dflmaxext =:1 and bitand(flags,1024) =1024
    END OF STMT
    PARSE #26:c=0,e=15,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=4,tim=5857876899683
    EXEC #26:c=0,e=30,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=4,tim=5857876899829
    FETCH #26:c=0,e=93,p=0,cr=18,cu=0,mis=0,r=1,dep=2,og=4,tim=5857876899958
    FETCH #26:c=0,e=1,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=0,tim=5857876900005
    STAT #26 id=1 cnt=1 pid=0 pos=1 obj=0 op='SORT AGGREGATE (cr=18 pr=0 pw=0 time=98 us)'
    STAT #26 id=2 cnt=1 pid=1 pos=1 obj=16 op='TABLE ACCESS FULL TS$ (cr=18 pr=0 pw=0 time=89 us)'
    =====================
    PARSING IN CURSOR #26 len=79 dep=2 uid=0 oct=3 lid=0 tim=5857876900141 hv=1782622679 ad='29ccc320'
    select min(bitmapped) from ts$ where dflmaxext =:1 and bitand(flags,1024) =1024
    END OF STMT
    PARSE #26:c=0,e=14,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=4,tim=5857876900138
    EXEC #26:c=0,e=24,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=4,tim=5857876900276
    FETCH #26:c=0,e=92,p=0,cr=18,cu=0,mis=0,r=1,dep=2,og=4,tim=5857876900404
    FETCH #26:c=0,e=0,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=0,tim=5857876900449
    STAT #26 id=1 cnt=1 pid=0 pos=1 obj=0 op='SORT AGGREGATE (cr=18 pr=0 pw=0 time=96 us)'
    STAT #26 id=2 cnt=1 pid=1 pos=1 obj=16 op='TABLE ACCESS FULL TS$ (cr=18 pr=0 pw=0 time=86 us)'
    =====================
    PARSING IN CURSOR #26 len=79 dep=2 uid=0 oct=3 lid=0 tim=5857876900794 hv=1782622679 ad='29ccc320'
    select min(bitmapped) from ts$ where dflmaxext =:1 and bitand(flags,1024) =1024
    END OF STMT
    PARSE #26:c=0,e=14,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=4,tim=5857876900790
    EXEC #26:c=0,e=25,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=4,tim=5857876900933
    FETCH #26:c=0,e=96,p=0,cr=18,cu=0,mis=0,r=1,dep=2,og=4,tim=5857876901066
    FETCH #26:c=0,e=0,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=0,tim=5857876901114
    STAT #26 id=1 cnt=1 pid=0 pos=1 obj=0 op='SORT AGGREGATE (cr=18 pr=0 pw=0 time=102 us)'
    STAT #26 id=2 cnt=1 pid=1 pos=1 obj=16 op='TABLE ACCESS FULL TS$ (cr=18 pr=0 pw=0 time=92 us)'
    =====================
    PARSING IN CURSOR #26 len=79 dep=2 uid=0 oct=3 lid=0 tim=5857876901304 hv=1782622679 ad='29ccc320'
    select min(bitmapped) from ts$ where dflmaxext =:1 and bitand(flags,1024) =1024
    END OF STMT
    PARSE #26:c=0,e=14,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=4,tim=5857876901300
    EXEC #26:c=0,e=24,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=4,tim=5857876901441
    FETCH #26:c=0,e=93,p=0,cr=18,cu=0,mis=0,r=1,dep=2,og=4,tim=5857876901570
    FETCH #26:c=0,e=1,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=0,tim=5857876901617
    STAT #26 id=1 cnt=1 pid=0 pos=1 obj=0 op='SORT AGGREGATE (cr=18 pr=0 pw=0 time=99 us)'
    STAT #26 id=2 cnt=1 pid=1 pos=1 obj=16 op='TABLE ACCESS FULL TS$ (cr=18 pr=0 pw=0 time=88 us)'
    =====================
    PARSING IN CURSOR #26 len=79 dep=2 uid=0 oct=3 lid=0 tim=5857876901750 hv=1782622679 ad='29ccc320'
    select min(bitmapped) from ts$ where dflmaxext =:1 and bitand(flags,1024) =1024
    END OF STMT
    PARSE #26:c=0,e=14,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=4,tim=5857876901747
    EXEC #26:c=0,e=23,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=4,tim=5857876901885
    FETCH #26:c=0,e=93,p=0,cr=18,cu=0,mis=0,r=1,dep=2,og=4,tim=5857876902013
    FETCH #26:c=0,e=1,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=0,tim=5857876902059
    STAT #26 id=1 cnt=1 pid=0 pos=1 obj=0 op='SORT AGGREGATE (cr=18 pr=0 pw=0 time=98 us)'
    STAT #26 id=2 cnt=1 pid=1 pos=1 obj=16 op='TABLE ACCESS FULL TS$ (cr=18 pr=0 pw=0 time=87 us)'
    =====================
    PARSING IN CURSOR #25 len=72 dep=1 uid=0 oct=3 lid=0 tim=5857876908751 hv=2397574443 ad='2c965cf0'
    SELECT RTRIM(VALUE) FROM V$PARAMETER WHERE UPPER(NAME)='SMTP_OUT_SERVER'
    END OF STMT
    PARSE #25:c=10000,e=12247,p=0,cr=108,cu=0,mis=1,r=0,dep=1,og=1,tim=5857876908746
    EXEC #25:c=0,e=50,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=1,tim=5857876908896
    =====================
    PARSING IN CURSOR #26 len=79 dep=2 uid=0 oct=3 lid=0 tim=5857876909030 hv=1782622679 ad='29ccc320'
    select min(bitmapped) from ts$ where dflmaxext =:1 and bitand(flags,1024) =1024
    END OF STMT
    PARSE #26:c=0,e=24,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=4,tim=5857876909026
    EXEC #26:c=0,e=40,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=4,tim=5857876909183
    FETCH #26:c=0,e=113,p=0,cr=18,cu=0,mis=0,r=1,dep=2,og=4,tim=5857876909331
    FETCH #26:c=0,e=1,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=0,tim=5857876909378
    STAT #26 id=1 cnt=1 pid=0 pos=1 obj=0 op='SORT AGGREGATE (cr=18 pr=0 pw=0 time=118 us)'
    STAT #26 id=2 cnt=1 pid=1 pos=1 obj=16 op='TABLE ACCESS FULL TS$ (cr=18 pr=0 pw=0 time=107 us)'
    FETCH #25:c=10000,e=7851,p=0,cr=18,cu=0,mis=0,r=1,dep=1,og=1,tim=5857876916780
    =====================
    PARSING IN CURSOR #28 len=53 dep=3 uid=0 oct=3 lid=0 tim=5857876920266 hv=2195068792 ad='2af8a840'
    select timestamp, flags from fixed_obj$ where obj#=:1
    END OF STMT
    PARSE #28:c=0,e=2515,p=0,cr=0,cu=0,mis=1,r=0,dep=3,og=4,tim=5857876920261
    =====================
    PARSING IN CURSOR #29 len=210 dep=4 uid=0 oct=3 lid=0 tim=5857876920858 hv=864012087 ad='2beb15a0'
    select /*+ rule */ bucket_cnt, row_cnt, cache_cnt, null_cnt, timestamp#, sample_size, minimum, maximum, distcnt, lowval, hival, density, col#, spare1, spare2, avgcln from hist_head$ where obj#=:1 and intcol#=:2
    END OF STMT
    PARSE #29:c=0,e=116,p=0,cr=0,cu=0,mis=0,r=0,dep=4,og=3,tim=5857876920853
    EXEC #29:c=0,e=55,p=0,cr=0,cu=0,mis=0,r=0,dep=4,og=3,tim=5857876921133
    FETCH #29:c=0,e=57,p=0,cr=4,cu=0,mis=0,r=1,dep=4,og=3,tim=5857876921228
    STAT #29 id=1 cnt=1 pid=0 pos=1 obj=255 op='TABLE ACCESS BY INDEX ROWID HIST_HEAD$ (cr=4 pr=0 pw=0 time=56 us)'
    STAT #29 id=2 cnt=1 pid=1 pos=1 obj=257 op='INDEX RANGE SCAN I_HH_OBJ#_INTCOL# (cr=3 pr=0 pw=0 time=38 us)'
    =====================
    PARSING IN CURSOR #29 len=210 dep=4 uid=0 oct=3 lid=0 tim=5857876921615 hv=864012087 ad='2beb15a0'
    select /*+ rule */ bucket_cnt, row_cnt, cache_cnt, null_cnt, timestamp#, sample_size, minimum, maximum, distcnt, lowval, hival, density, col#, spare1, spare2, avgcln from hist_head$ where obj#=:1 and intcol#=:2
    END OF STMT
    EXEC #29:c=0,e=22,p=0,cr=0,cu=0,mis=0,r=0,dep=4,og=3,tim=5857876921611
    FETCH #29:c=0,e=24,p=0,cr=4,cu=0,mis=0,r=1,dep=4,og=3,tim=5857876921728
    STAT #29 id=1 cnt=2 pid=0 pos=1 obj=255 op='TABLE ACCESS BY INDEX ROWID HIST_HEAD$ (cr=8 pr=0 pw=0 time=77 us)'
    STAT #29 id=2 cnt=2 pid=1 pos=1 obj=257 op='INDEX RANGE SCAN I_HH_OBJ#_INTCOL# (cr=6 pr=0 pw=0 time=52 us)'
    =====================
    PARSING IN CURSOR #29 len=210 dep=4 uid=0 oct=3 lid=0 tim=5857876921979 hv=864012087 ad='2beb15a0'
    select /*+ rule */ bucket_cnt, row_cnt, cache_cnt, null_cnt, timestamp#, sample_size, minimum, maximum, distcnt, lowval, hival, density, col#, spare1, spare2, avgcln from hist_head$ where obj#=:1 and intcol#=:2
    END OF STMT
    EXEC #29:c=0,e=20,p=0,cr=0,cu=0,mis=0,r=0,dep=4,og=3,tim=5857876921975
    FETCH #29:c=0,e=22,p=0,cr=4,cu=0,mis=0,r=1,dep=4,og=3,tim=5857876922089
    STAT #29 id=1 cnt=3 pid=0 pos=1 obj=255 op='TABLE ACCESS BY INDEX ROWID HIST_HEAD$ (cr=12 pr=0 pw=0 time=95 us)'
    STAT #29 id=2 cnt=3 pid=1 pos=1 obj=257 op='INDEX RANGE SCAN I_HH_OBJ#_INTCOL# (cr=9 pr=0 pw=0 time=65 us)'
    =====================
    PARSING IN CURSOR #29 len=121 dep=4 uid=0 oct=3 lid=0 tim=5857876922285 hv=3150898423 ad='2beb0588'
    select /*+ rule */ bucket, endpoint, col#, epvalue from histgrm$ where obj#=:1 and intcol#=:2 and row#=:3 order by bucket
    END OF STMT
    PARSE #29:c=0,e=64,p=0,cr=0,cu=0,mis=0,r=0,dep=4,og=3,tim=5857876922282
    EXEC #29:c=0,e=48,p=0,cr=0,cu=0,mis=0,r=0,dep=4,og=3,tim=5857876922479
    WAIT #29: nam='db file sequential read' ela= 10352 file#=1 block#=126071 blocks=1 obj#=108859 tim=5857876932944
    WAIT #29: nam='db file sequential read' ela= 6111 file#=1 block#=1844 blocks=1 obj#=108859 tim=5857876939152
    FETCH #29:c=0,e=16726,p=2,cr=3,cu=0,mis=0,r=1,dep=4,og=3,tim=5857876939276
    STAT #29 id=1 cnt=1 pid=0 pos=1 obj=0 op='SORT ORDER BY (cr=3 pr=2 pw=0 time=16738 us)'
    STAT #29 id=2 cnt=1 pid=1 pos=1 obj=253 op='TABLE ACCESS CLUSTER HISTGRM$ (cr=3 pr=2 pw=0 time=16685 us)'
    STAT #29 id=3 cnt=1 pid=2 pos=1 obj=252 op='INDEX UNIQUE SCAN I_OBJ#_INTCOL# (cr=2 pr=1 pw=0 time=10473 us)'
    EXEC #28:c=10000,e=21483,p=2,cr=15,cu=0,mis=1,r=0,dep=3,og=4,tim=5857876941861
    FETCH #28:c=0,e=17,p=0,cr=2,cu=0,mis=0,r=0,dep=3,og=4,tim=5857876941920
    STAT #28 id=1 cnt=0 pid=0 pos=1 obj=706 op='TABLE ACCESS BY INDEX ROWID FIXED_OBJ$ (cr=2 pr=0 pw=0 time=20 us)'
    STAT #28 id=2 cnt=0 pid=1 pos=1 obj=707 op='INDEX UNIQUE SCAN I_FIXED_OBJ$_OBJ# (cr=2 pr=0 pw=0 time=16 us)'
    =====================
    PARSING IN CURSOR #29 len=37 dep=3 uid=0 oct=3 lid=0 tim=5857876944818 hv=1983168772 ad='db809f00'
    select inst_id, banner from x$version
    END OF STMT
    PARSE #29:c=0,e=2672,p=0,cr=0,cu=0,mis=1,r=0,dep=3,og=4,tim=5857876944814
    =====================
    PARSING IN CURSOR #27 len=66 dep=2 uid=0 oct=3 lid=0 tim=5857876947353 hv=3446116166 ad='e5345238'
    select BANNER from GV$VERSION where inst_id = USERENV('Instance')
    END OF STMT
    PARSE #27:c=10000,e=30018,p=2,cr=17,cu=0,mis=1,r=0,dep=2,og=4,tim=5857876947348
    =====================
    PARSING IN CURSOR #28 len=210 dep=2 uid=0 oct=3 lid=0 tim=5857876948195 hv=864012087 ad='2beb15a0'
    select /*+ rule */ bucket_cnt, row_cnt, cache_cnt, null_cnt, timestamp#, sample_size, minimum, maximum, distcnt, lowval, hival, density, col#, spare1, spare2, avgcln from hist_head$ where obj#=:1 and intcol#=:2
    END OF STMT
    EXEC #28:c=0,e=34,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=3,tim=5857876948191
    FETCH #28:c=0,e=28,p=0,cr=3,cu=0,mis=0,r=0,dep=2,og=3,tim=5857876948315
    =====================
    PARSING IN CURSOR #29 len=210 dep=2 uid=0 oct=3 lid=0 tim=5857876948528 hv=864012087 ad='2beb15a0'
    select /*+ rule */ bucket_cnt, row_cnt, cache_cnt, null_cnt, timestamp#, sample_size, minimum, maximum, distcnt, lowval, hival, density, col#, spare1, spare2, avgcln from hist_head$ where obj#=:1 and intcol#=:2
    END OF STMT
    EXEC #29:c=0,e=22,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=3,tim=5857876948525
    FETCH #29:c=0,e=13,p=0,cr=3,cu=0,mis=0,r=0,dep=2,og=3,tim=5857876948630
    =====================
    PARSING IN CURSOR #26 len=102 dep=1 uid=0 oct=3 lid=0 tim=5857876951095 hv=2007878721 ad='2a7035f0'
    SELECT 'Mailer by '|| SUBSTR(BANNER,1,INSTR(BANNER,' ')-1)|| ' UTL_MAIL' FROM V$VERSION WHERE ROWNUM<2
    END OF STMT
    PARSE #26:c=10000,e=34172,p=2,cr=23,cu=0,mis=1,r=0,dep=1,og=1,tim=5857876951090
    EXEC #26:c=0,e=46,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=1,tim=5857876951235
    FETCH #26:c=0,e=31,p=0,cr=0,cu=0,mis=0,r=1,dep=1,og=1,tim=5857876951296
    WAIT #4: nam='TCP Socket (KGAS)' ela= 1812 =2 =0 =0 obj#=108859 tim=5857876957511
    PARSING IN CURSOR #4 len=34 dep=0 uid=86 oct=47 lid=86 tim=5857877083392 hv=1432432939 ad='f22431a8'
    BEGIN PROC_RET_REPORT_TEST; END;
    END OF STMT
    EXEC #4:c=407030000,e=714358039,p=1306018,cr=2069759,cu=0,mis=1,r=1,dep=0,og=1,tim=5857877083386
    WAIT #4: nam='SQL*Net message to client' ela= 3 driver id=1413697536 #bytes=1 p3=0 obj#=108859 tim=5857877086767
    WAIT #4: nam='SQL*Net message from client' ela= 200996 driver id=1413697536 #bytes=1 p3=0 obj#=108859 tim=5857877287847
    =====================
    PARSING IN CURSOR #27 len=52 dep=0 uid=86 oct=47 lid=86 tim=5857877288121 hv=1029988163 ad='2c9c9168'
    BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;
    END OF STMT
    PARSE #27:c=0,e=115,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,tim=5857877288114
    WAIT #27: nam='SQL*Net message to client' ela= 2 driver id=1413697536 #bytes=1 p3=0 obj#=108859 tim=5857877288662
    EXEC #27:c=0,e=637,p=0,cr=3,cu=0,mis=0,r=1,dep=0,og=1,tim=5857877288949
    WAIT #27: nam='SQL*Net message from client' ela= 37034 driver id=1413697536 #bytes=1 p3=0 obj#=108859 tim=5857877326129
    WAIT #0: nam='SQL*Net message to client' ela= 1 driver id=1413697536 #bytes=1 p3=0 obj#=108859 tim=5857877326246
    WAIT #0: nam='SQL*Net message from client' ela= 41706 driver id=1413697536 #bytes=1 p3=0 obj#=108859 tim=5857877367979
    WAIT #0: nam='SQL*Net message to client' ela= 0 driver id=1413697536 #bytes=1 p3=0 obj#=108859 tim=5857877368117
    *** 2008-01-08 16:41:16.179
    WAIT #0: nam='SQL*Net message from client' ela= 201999998 driver id=1413697536 #bytes=1 p3=0 obj#=108859 tim=5858079368156
    XCTEND rlbk=0, rd_only=1
    STAT #25 id=1 cnt=1 pid=0 pos=1 obj=0 op='HASH JOIN (cr=18 pr=0 pw=0 time=7852 us)'
    STAT #25 id=2 cnt=1 pid=1 pos=1 obj=0 op='FIXED TABLE FULL X$KSPPI (cr=0 pr=0 pw=0 time=2990 us)'
    STAT #25 id=3 cnt=1385 pid=1 pos=2 obj=0 op='FIXED TABLE FULL X$KSPPCV (cr=0 pr=0 pw=0 time=2780 us)'
    STAT #26 id=1 cnt=1 pid=0 pos=1 obj=0 op='COUNT STOPKEY (cr=0 pr=0 pw=0 time=38 us)'
    STAT #26 id=2 cnt=1 pid=1 pos=1 obj=0 op='FIXED TABLE FULL X$VERSION (cr=0 pr=0 pw=0 time=31 us)'
    STAT #24 id=1 cnt=0 pid=0 pos=1 obj=0 op='NESTED LOOPS (cr=4648 pr=4641 pw=0 time=2518383 us)'
    STAT #24 id=2 cnt=0 pid=1 pos=1 obj=108859 op='TABLE ACCESS FULL S_RET_TICKET_END_REJ (cr=4648 pr=4641 pw=0 time=2518377 us)'
    STAT #24 id=3 cnt=0 pid=1 pos=2 obj=98998 op='TABLE ACCESS BY INDEX ROWID S_SITE_MASTER (cr=0 pr=0 pw=0 time=0 us)'
    STAT #24 id=4 cnt=0 pid=3 pos=1 obj=98999 op='INDEX UNIQUE SCAN PK_SITE_NUM (cr=0 pr=0 pw=0 time=0 us)'
    Sorry for the length of the post.
    Thanks,
    Jafar

    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 B.CITY_CODE||'-'||B.STORE_NO||'-'||B.STORE_SHORT_NAME CITY_STORE,
    RPAD(K1.TDATE,14,' ') TDATE, RPAD(K1.TAMT,14,' ') TAMT, RPAD(K1.NTKT ,9,' ')
    NTKT, K1.POS POS
    FROM
    ( SELECT SUBSTR(STORE_NO,3,6) STNO, TRANS_DATE TDATE, TICKET_AMOUNT TAMT,
    TICKET_NO NTKT, POS_NO POS FROM DEVDBA.S_RET_TICKET_END_REJ WHERE
    TRUNC(RECORD_DATE)=TRUNC(SYSDATE) AND TRAINING_MODE_FLAG=0 AND
    VOID_TICKET_FLAG=0 AND (TICKET_AMOUNT>1000000 OR TICKET_AMOUNT<-1000000 ) )
    K1,DEVDBA.S_SITE_MASTER B WHERE STNO=B.STORE_NO
    call count cpu elapsed disk query current rows
    Parse 1 0.02 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.39 2.51 4641 4648 0 0
    total 3 0.41 2.52 4641 4648 0 0
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 86 (ORADMIN) (recursive depth: 1)
    Rows Row Source Operation
    0 NESTED LOOPS (cr=4648 pr=4641 pw=0 time=2518383 us)
    0 TABLE ACCESS FULL S_RET_TICKET_END_REJ (cr=4648 pr=4641 pw=0 time=2518377 us)
    0 TABLE ACCESS BY INDEX ROWID S_SITE_MASTER (cr=0 pr=0 pw=0 time=0 us)
    0 INDEX UNIQUE SCAN PK_SITE_NUM (cr=0 pr=0 pw=0 time=0 us)(object id 98999)
    Rows Execution Plan
    0 SELECT STATEMENT MODE: ALL_ROWS
    0 NESTED LOOPS
    0 TABLE ACCESS MODE: ANALYZED (FULL) OF 'S_RET_TICKET_END_REJ'
    (TABLE)
    0 TABLE ACCESS MODE: ANALYZED (BY INDEX ROWID) OF
    'S_SITE_MASTER' (TABLE)
    0 INDEX MODE: ANALYZED (UNIQUE SCAN) OF 'PK_SITE_NUM' (INDEX
    (UNIQUE))
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file sequential read 3 0.02 0.04
    db file scattered read 89 0.07 2.19
    BEGIN PROC_RET_REPORT_TEST; END;
    call count cpu elapsed disk query current rows
    Parse 0 0.00 0.00 0 0 0 0
    Execute 1 407.03 714.35 1306018 2069759 0 1
    Fetch 0 0.00 0.00 0 0 0 0
    total 1 407.03 714.35 1306018 2069759 0 1
    Misses in library cache during parse: 0
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 86 (ORADMIN)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    TCP Socket (KGAS) 43 0.11 0.12
    SQL*Net message to client 1 0.00 0.00
    SQL*Net message from client 1 0.20 0.20
    BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 3 0 1
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.00 0.00 0 3 0 1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 86 (ORADMIN)
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    SQL*Net message to client 1 0.00 0.00
    SQL*Net message from client 1 0.03 0.03
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 2 407.03 714.35 1306018 2069762 0 2
    Fetch 0 0.00 0.00 0 0 0 0
    total 3 407.03 714.35 1306018 2069762 0 2
    Misses in library cache during parse: 0
    Misses in library cache during execute: 1
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file scattered read 7444 0.51 106.03
    db file sequential read 9311 0.25 13.64
    TCP Socket (KGAS) 43 0.11 0.12
    SQL*Net message to client 4 0.00 0.00
    SQL*Net message from client 4 201.99 202.27
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call count cpu elapsed disk query current rows
    Parse 22 0.05 0.04 0 0 0 0
    Execute 30 0.03 0.02 0 0 0 0
    Fetch 40 0.40 2.57 4646 4883 0 34
    total 92 0.48 2.64 4646 4883 0 34
    Misses in library cache during parse: 10
    Misses in library cache during execute: 5
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    db file scattered read 89 0.07 2.19
    db file sequential read 8 0.02 0.08
    3 user SQL statements in session.
    31 internal SQL statements in session.
    34 SQL statements in session.
    1 statement EXPLAINed in this session.
    Trace file: odsprod_ora_27486.trc
    Trace file compatibility: 10.01.00
    Sort options: default
    1 session in tracefile.
    3 user SQL statements in trace file.
    31 internal SQL statements in trace file.
    34 SQL statements in trace file.
    13 unique SQL statements in trace file.
    1 SQL statements EXPLAINed using schema:
    ORADMIN.prof$plan_table
    Default table was used.
    Table was created.
    Table was dropped.
    17240 lines in trace file.
    2 elapsed seconds in trace file.Message was edited by:
    Maran Viswarayar
    Message was edited by:
    Maran Viswarayar

  • Query takes more time from client

    Hi,
    I have a select query (which refers to views and calls a function), which fetches results in 2 secs when executed from database. But takes more than 10 mins from the client.
    The tkprof for the call from the client is given below. Could you please suggest, what is going wrong and how this can be addressed?
    The index IDX_table1_1 is on col3.
    Trace file: trace_file.trc
    Sort options: exeela 
    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 ROUND(SUM(NVL((col1-col2),(SYSDATE - col2)
    FROM
    table1 WHERE col3 = :B1 GROUP BY col3
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute   7402      0.27       7.40          0          0          0           0
    Fetch     7402      1.13      59.37       1663      22535          0        7335
    total    14804      1.40      66.77       1663      22535          0        7335
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 32  (ORADBA)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   SORT (GROUP BY NOSORT)
          0    TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF 'table1'
                   (TABLE)
          0     INDEX   MODE: ANALYZED (RANGE SCAN) OF 'IDX_table1_1'
                    (INDEX)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file sequential read                      1663        1.37         57.71
    OVERALL TOTALS FOR ALL NON-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
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file sequential read                     16039        3.09        385.04
      db file scattered read                         34        0.21          1.42
      latch: cache buffers chains                    26        0.34          2.14
      SQL*Net break/reset to client                   2        0.05          0.05
      SQL*Net message to client                       2        0.00          0.00
      SQL*Net message from client                     2       79.99         79.99
      SQL*Net message to dblink                       1        0.00          0.00
      SQL*Net message from dblink                     1        0.00          0.00
    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   7402      0.27       7.40          0          0          0           0
    Fetch     7402      1.13      59.37       1663      22535          0        7335
    total    14804      1.40      66.77       1663      22535          0        7335
    Misses in library cache during parse: 0
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file sequential read                      1663        1.37         57.71
        1  user  SQL statements in session.
        0  internal SQL statements in session.
        1  SQL statements in session.
        1  statement EXPLAINed in this session.
    Trace file: trace_file.trc
    Trace file compatibility: 10.01.00
    Sort options: exeela 
           1  session in tracefile.
           1  user  SQL statements in trace file.
           0  internal SQL statements in trace file.
           1  SQL statements in trace file.
           1  unique SQL statements in trace file.
           1  SQL statements EXPLAINed using schema:
               ORADBA.prof$plan_table
                 Default table was used.
                 Table was created.
                 Table was dropped.
       84792  lines in trace file.
        4152  elapsed seconds in trace file.Edited by: agathya on Feb 26, 2010 8:39 PM

    I have a select query (which refers to views and calls a function), which fetches results in 2 secs when >executed from database. But takes more than 10 mins from the client.You are providing proof for the latter part of your statement above.
    But not for the former part (fetches in 2 secs when exec'd from db).
    It would have been nice if you also provide the sql-trace information for that.
    Without it we cannot help you much. Other than making the observation that you obviously have a query that is I/O bound, and that I/O on your system is rather slow: on average an I/O takes 0.04 seconds (66.77 divided by 1663).

  • Help in understanding TKPROF output

    Hi All,
    Following is the TKPROF output of a user_dump_dest trace file, obtained by setting trace to 10046@level 12.
    select "CHNNL"."CHNNL_BK" "C0", case "GEOG12"."SUB_STATE_PRVNC_CD" when
    *:"SYS_B_000" then :"SYS_B_001" when :"SYS_B_002" then :"SYS_B_003" when*
    *:"SYS_B_004" then :"SYS_B_005" when :"SYS_B_006" then :"SYS_B_007" when*
    *:"SYS_B_008" then :"SYS_B_009" when :"SYS_B_010" then :"SYS_B_011" when*
    *:"SYS_B_012" then :"SYS_B_013" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end*
    *"C1", "TIME_PERIOD13"."MONTH_CD" "C2", lpad(to_char(EXTRACT( MONTH*
    FROM
    *(TIMESTAMP :"SYS_B_014") )), :"SYS_B_015", :"SYS_B_016") "C3", sum(case*
    when "TIME_PERIOD13"."DAY_CLNDR_DATE"=TIMESTAMP :"SYS_B_017" then
    *"SALES_FACT"."EXTND_NET_SALE_AMNT" else :"SYS_B_018" end ) over (partition*
    by "CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_019"
    then :"SYS_B_020" when :"SYS_B_021" then :"SYS_B_022" when :"SYS_B_023"
    then :"SYS_B_024" when :"SYS_B_025" then :"SYS_B_026" when :"SYS_B_027"
    then :"SYS_B_028" when :"SYS_B_029" then :"SYS_B_030" when :"SYS_B_031"
    then :"SYS_B_032" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD") "C4", sum(case when*
    *"TIME_PERIOD13"."DAY_CLNDR_DATE" between (TIMESTAMP :"SYS_B_033" -*
    NUMTODSINTERVAL( EXTRACT( DAY FROM TIMESTAMP :"SYS_B_034" ), :"SYS_B_035" )
    + INTERVAL :"SYS_B_036" DAY) and TIMESTAMP :"SYS_B_037" then
    *"SALES_FACT"."EXTND_NET_SALE_AMNT" else :"SYS_B_038" end ) over (partition*
    by "CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_039"
    then :"SYS_B_040" when :"SYS_B_041" then :"SYS_B_042" when :"SYS_B_043"
    then :"SYS_B_044" when :"SYS_B_045" then :"SYS_B_046" when :"SYS_B_047"
    then :"SYS_B_048" when :"SYS_B_049" then :"SYS_B_050" when :"SYS_B_051"
    then :"SYS_B_052" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD") "C5", sum(case when*
    *"TIME_PERIOD13"."DAY_CLNDR_DATE"=TIMESTAMP :"SYS_B_053" then*
    *"SALES_FACT"."QTY_SOLD_IN_CASES" else :"SYS_B_054" end ) over (partition by*
    *"CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_055"*
    then :"SYS_B_056" when :"SYS_B_057" then :"SYS_B_058" when :"SYS_B_059"
    then :"SYS_B_060" when :"SYS_B_061" then :"SYS_B_062" when :"SYS_B_063"
    then :"SYS_B_064" when :"SYS_B_065" then :"SYS_B_066" when :"SYS_B_067"
    then :"SYS_B_068" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD") "C6", sum(case when*
    *"TIME_PERIOD13"."DAY_CLNDR_DATE" between (TIMESTAMP :"SYS_B_069" -*
    NUMTODSINTERVAL( EXTRACT( DAY FROM TIMESTAMP :"SYS_B_070" ), :"SYS_B_071" )
    + INTERVAL :"SYS_B_072" DAY) and TIMESTAMP :"SYS_B_073" then
    *"SALES_FACT"."QTY_SOLD_IN_CASES" else :"SYS_B_074" end ) over (partition by*
    *"CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_075"*
    then :"SYS_B_076" when :"SYS_B_077" then :"SYS_B_078" when :"SYS_B_079"
    then :"SYS_B_080" when :"SYS_B_081" then :"SYS_B_082" when :"SYS_B_083"
    then :"SYS_B_084" when :"SYS_B_085" then :"SYS_B_086" when :"SYS_B_087"
    then :"SYS_B_088" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD") "C7", sum(case when*
    *"TIME_PERIOD13"."DAY_CLNDR_DATE"=TIMESTAMP :"SYS_B_089" then*
    *"SALES_FACT"."QTY_SOLD_IN_KLGMS" else :"SYS_B_090" end ) over (partition by*
    *"CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_091"*
    then :"SYS_B_092" when :"SYS_B_093" then :"SYS_B_094" when :"SYS_B_095"
    then :"SYS_B_096" when :"SYS_B_097" then :"SYS_B_098" when :"SYS_B_099"
    then :"SYS_B_100" when :"SYS_B_101" then :"SYS_B_102" when :"SYS_B_103"
    then :"SYS_B_104" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD") "C8", sum(case when*
    *"TIME_PERIOD13"."DAY_CLNDR_DATE" between (TIMESTAMP :"SYS_B_105" -*
    NUMTODSINTERVAL( EXTRACT( DAY FROM TIMESTAMP :"SYS_B_106" ), :"SYS_B_107" )
    + INTERVAL :"SYS_B_108" DAY) and TIMESTAMP :"SYS_B_109" then
    *"SALES_FACT"."QTY_SOLD_IN_KLGMS" else :"SYS_B_110" end ) over (partition by*
    *"CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_111"*
    then :"SYS_B_112" when :"SYS_B_113" then :"SYS_B_114" when :"SYS_B_115"
    then :"SYS_B_116" when :"SYS_B_117" then :"SYS_B_118" when :"SYS_B_119"
    then :"SYS_B_120" when :"SYS_B_121" then :"SYS_B_122" when :"SYS_B_123"
    then :"SYS_B_124" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD") "C9", sum("SALES_FACT"."EXTND_GROSS_SALE_AMNT")*
    over (partition by "CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD"
    when :"SYS_B_125" then :"SYS_B_126" when :"SYS_B_127" then :"SYS_B_128"
    when :"SYS_B_129" then :"SYS_B_130" when :"SYS_B_131" then :"SYS_B_132"
    when :"SYS_B_133" then :"SYS_B_134" when :"SYS_B_135" then :"SYS_B_136"
    when :"SYS_B_137" then :"SYS_B_138" else
    *"GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end , "TIME_PERIOD13"."MONTH_CD") "C10",*
    *((sum(case when ("TIME_PERIOD13"."DAY_CLNDR_DATE"=TIMESTAMP :"SYS_B_139")*
    then "SALES_FACT"."EXTND_NET_SALE_AMNT" else :"SYS_B_140" end ) over
    *(partition by "CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when*
    *:"SYS_B_141" then :"SYS_B_142" when :"SYS_B_143" then :"SYS_B_144" when*
    *:"SYS_B_145" then :"SYS_B_146" when :"SYS_B_147" then :"SYS_B_148" when*
    *:"SYS_B_149" then :"SYS_B_150" when :"SYS_B_151" then :"SYS_B_152" when*
    *:"SYS_B_153" then :"SYS_B_154" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end*
    *, "TIME_PERIOD13"."MONTH_CD")+sum(case when*
    *"TIME_PERIOD13"."DAY_CLNDR_DATE" between (TIMESTAMP :"SYS_B_155" -*
    NUMTODSINTERVAL( EXTRACT( DAY FROM TIMESTAMP :"SYS_B_156" ), :"SYS_B_157" )
    + INTERVAL :"SYS_B_158" DAY) and TIMESTAMP :"SYS_B_159" then
    *"SALES_FACT"."EXTND_NET_SALE_AMNT" else :"SYS_B_160" end ) over (partition*
    by "CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_161"
    then :"SYS_B_162" when :"SYS_B_163" then :"SYS_B_164" when :"SYS_B_165"
    then :"SYS_B_166" when :"SYS_B_167" then :"SYS_B_168" when :"SYS_B_169"
    then :"SYS_B_170" when :"SYS_B_171" then :"SYS_B_172" when :"SYS_B_173"
    then :"SYS_B_174" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD"))+(sum(case when*
    *("TIME_PERIOD13"."DAY_CLNDR_DATE"=TIMESTAMP :"SYS_B_175") then*
    *"SALES_FACT"."QTY_SOLD_IN_CASES" else :"SYS_B_176" end ) over (partition by*
    *"CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_177"*
    then :"SYS_B_178" when :"SYS_B_179" then :"SYS_B_180" when :"SYS_B_181"
    then :"SYS_B_182" when :"SYS_B_183" then :"SYS_B_184" when :"SYS_B_185"
    then :"SYS_B_186" when :"SYS_B_187" then :"SYS_B_188" when :"SYS_B_189"
    then :"SYS_B_190" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD")+sum(case when "TIME_PERIOD13"."DAY_CLNDR_DATE"*
    between (TIMESTAMP :"SYS_B_191" - NUMTODSINTERVAL( EXTRACT( DAY FROM
    TIMESTAMP :"SYS_B_192" ), :"SYS_B_193" ) + INTERVAL :"SYS_B_194" DAY) and
    TIMESTAMP :"SYS_B_195" then "SALES_FACT"."QTY_SOLD_IN_CASES" else
    *:"SYS_B_196" end ) over (partition by "CHNNL"."CHNNL_BK", case*
    *"GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_197" then :"SYS_B_198" when*
    *:"SYS_B_199" then :"SYS_B_200" when :"SYS_B_201" then :"SYS_B_202" when*
    *:"SYS_B_203" then :"SYS_B_204" when :"SYS_B_205" then :"SYS_B_206" when*
    *:"SYS_B_207" then :"SYS_B_208" when :"SYS_B_209" then :"SYS_B_210" else*
    *"GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end , "TIME_PERIOD13"."MONTH_CD")))*
    +(sum(case  when ("TIME_PERIOD13"."DAY_CLNDR_DATE"=TIMESTAMP :"SYS_B_211")
    then "SALES_FACT"."QTY_SOLD_IN_KLGMS" else :"SYS_B_212" end ) over
    *(partition by "CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when*
    *:"SYS_B_213" then :"SYS_B_214" when :"SYS_B_215" then :"SYS_B_216" when*
    *:"SYS_B_217" then :"SYS_B_218" when :"SYS_B_219" then :"SYS_B_220" when*
    *:"SYS_B_221" then :"SYS_B_222" when :"SYS_B_223" then :"SYS_B_224" when*
    *:"SYS_B_225" then :"SYS_B_226" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end*
    *, "TIME_PERIOD13"."MONTH_CD")+sum(case when*
    *"TIME_PERIOD13"."DAY_CLNDR_DATE" between (TIMESTAMP :"SYS_B_227" -*
    NUMTODSINTERVAL( EXTRACT( DAY FROM TIMESTAMP :"SYS_B_228" ), :"SYS_B_229" )
    + INTERVAL :"SYS_B_230" DAY) and TIMESTAMP :"SYS_B_231" then
    *"SALES_FACT"."QTY_SOLD_IN_KLGMS" else :"SYS_B_232" end ) over (partition by*
    *"CHNNL"."CHNNL_BK", case "GEOG12"."SUB_STATE_PRVNC_CD" when :"SYS_B_233"*
    then :"SYS_B_234" when :"SYS_B_235" then :"SYS_B_236" when :"SYS_B_237"
    then :"SYS_B_238" when :"SYS_B_239" then :"SYS_B_240" when :"SYS_B_241"
    then :"SYS_B_242" when :"SYS_B_243" then :"SYS_B_244" when :"SYS_B_245"
    then :"SYS_B_246" else "GEOG12"."SUB_STATE_PRVNC_NAME_TXT" end ,
    *"TIME_PERIOD13"."MONTH_CD")) "C11" from "THA_SALES_DBA"."CHNNL" "CHNNL",*
    *(select "GEOG"."GEOG_KEY" "GEOG_KEY", "GEOG"."SUB_STATE_PRVNC_CD"*
    *"SUB_STATE_PRVNC_CD", "GEOG"."SUB_STATE_PRVNC_NAME_TXT"*
    *"SUB_STATE_PRVNC_NAME_TXT" from "THA_SALES_DBA"."GEOG" "GEOG" where*
    *"GEOG"."SUB_STATE_PRVNC_LOAD_DATA_TYPE"=:"SYS_B_247") "GEOG12",*
    *"THA_SALES_DBA"."TIME_PERIOD" "TIME_PERIOD13", "THA_SALES_DBA"."SALES_FACT"*
    *"SALES_FACT", (select "PROD"."PROD_KEY" "PROD_KEY", "PROD"."PROD_DVSN_CD"*
    *"PROD_DVSN_CD", "PROD"."PCKG_SIZE_CD" "PCKG_SIZE_CD" from*
    *"THA_SALES_DBA"."PROD" "PROD" where "PROD"."LOAD_DATA_TYPE_CD"=:"SYS_B_248")*
    *"PROD14", "THA_SALES_DBA"."DSTRBTR" "DSTRBTR" where*
    *"PROD14"."PROD_DVSN_CD"=:"SYS_B_249" and "PROD14"."PCKG_SIZE_CD"=*
    *:"SYS_B_250" and "DSTRBTR"."DSTRBTR_CD"<>:"SYS_B_251" and CASE*
    WHEN("DSTRBTR"."DSTRBTR_CD" IS NULL) OR ("CHNNL"."CHNNL_BK" IS NULL) THEN
    NULL ELSE ("DSTRBTR"."DSTRBTR_CD"||"CHNNL"."CHNNL_BK") END<>:"SYS_B_252"
    and "SALES_FACT"."CHNNL_KEY"="CHNNL"."CHNNL_KEY" and
    *"SALES_FACT"."DSTRBTR_KEY"="DSTRBTR"."DSTRBTR_KEY" and*
    *"SALES_FACT"."GEOG_KEY"="GEOG12"."GEOG_KEY" and "SALES_FACT"."PROD_KEY"=*
    *"PROD14"."PROD_KEY" and "SALES_FACT"."TIME_PERIOD_KEY"=*
    *"TIME_PERIOD13"."TIME_PERIOD_KEY"*
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.01       0.00          0          0          0           0
    Execute      1      0.01       0.01          0          0          0           0
    Fetch     7632    129.92     245.70     406278      12619         35      763042
    total     7634    129.95     245.73     406278      12619         35      763042
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 68
    Rows     Row Source Operation
    *763042 WINDOW BUFFER (cr=12619 pr=406278 pw=257613 time=239232878 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=372409 pw=237458 time=217248824 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=339595 pw=217662 time=194593662 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=307255 pw=198149 time=177438908 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=275292 pw=178940 time=157976971 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=244097 pw=160017 time=139997871 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=213275 pw=141404 time=119675383 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=184170 pw=123525 time=105714100 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=155800 pw=105953 time=88478655 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=128025 pw=88650 time=71243641 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=100871 pw=71641 time=54047210 us)*
    *763042 WINDOW BUFFER (cr=12619 pr=73821 pw=54957 time=35324144 us)*
    *763042 WINDOW SORT (cr=12619 pr=48205 pw=38587 time=18865032 us)*
    *763042 HASH JOIN (cr=12619 pr=0 pw=0 time=3127703 us)*
    *15098 TABLE ACCESS FULL TIME_PERIOD (cr=693 pr=0 pw=0 time=15216 us)*
    *763042 HASH JOIN (cr=11926 pr=0 pw=0 time=2344335 us)*
    *1845 TABLE ACCESS FULL GEOG (cr=92 pr=0 pw=0 time=1910 us)*
    *763194 HASH JOIN (cr=11834 pr=0 pw=0 time=1577327 us)*
    *11 TABLE ACCESS FULL CHNNL (cr=7 pr=0 pw=0 time=47 us)*
    *765432 HASH JOIN (cr=11827 pr=0 pw=0 time=1580849 us)*
    *2 TABLE ACCESS FULL DSTRBTR (cr=7 pr=0 pw=0 time=50 us)*
    *765432 HASH JOIN (cr=11820 pr=0 pw=0 time=814835 us)*
    *313 TABLE ACCESS FULL PROD (cr=174 pr=0 pw=0 time=1195 us)*
    *1045260 TABLE ACCESS FULL SALES_FACT (cr=11646 pr=0 pw=0 time=31 us)*
    Elapsed times include waiting on following events:
    Event waited on                             Times   Max. Wait  Total Waited
    ----------------------------------------   Waited  ----------  ------------
    SQLNet message to client 7633 0.00 0.01*
    SQLNet message from client 7633 1826.57 2334.17*
    SQLNet more data from client 1 0.00 0.00*
    direct path write temp                       5332        0.09          6.23
    direct path read temp                      389239        0.09        115.09
    The query is automatically generated by Cognos 8.2. The database is 64-bit Oracle 10.2.0.4 on Windows 2003 Enterprise Edition R2.
    I am unable to understand the "*WINDOW BUFFER/WINDOW SORT*" statement under the Row Source Operation. Could one of you please explain this operation to me?
    Thanks and Regards,
    Sriraman

    The WINDOW BUFFER/WINDOW SORT operations are used when processing analytical SQLs, you can see these in your SQL statement. In WINDOW BUFFER the SQL engine do calculations above some buffered data subset and in the WINDOW SORT data subsets are being sorted.
    Dusan

  • Tuning a sql using tkprof

    The most important query in our application is:
    SELECT          
          COUNT ( * )
      FROM            I_JOURNAL m
                   INNER JOIN
                      LIU_TYPES lt
                   ON (m.LIU_TYPE = lt.LIU_TYPE)
                INNER JOIN
                   LAWFUL_I li
                ON (m.LIID = li.LIID)
             LEFT OUTER JOIN
                PHONE_BOOK pb
             ON (    m.NORM_CIN = pb.NORM_CIN
                 AND pb.DELETION_DATE IS NULL
                 AND pb.OPERATOR_ID = :"SYS_B_00")
    WHERE   LIU_PRIORITY >= :"SYS_B_01"
             AND (li.ID IN
                        (:"SYS_B_02",
                         :"SYS_B_03",
                         :"SYS_B_04",
                         :"SYS_B_05",
                         :"SYS_B_06",
                         :"SYS_B_07",
                         :"SYS_B_08",
                         :"SYS_B_09",
                         :"SYS_B_59",
                         :"SYS_B_60",
                         :"SYS_B_61",
                         :"SYS_B_62"))
             AND (li.END_VALID_DATE IS NULL
                  OR m.DISPLAY_DATE <= li.END_VALID_DATE)
             AND li.OPERATOR_ID = :"SYS_B_63"It should be fast: response time less than 5 seconds.
    But in some sites, the number of records of the tables is big:
    - I_JOURNAL: 5000000 rows
    - LAWFUL_I: 1000 rows
    - phone_book: 78000 rows
    The worst case we have is when the operator_id is related to a lot of rows in I_JOURNAL, for example 800000.
    In that case the response time is 20 seconds.
    I've traced the query and the output of tkprof is:
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.05       0.04          0          0          0           0
    Fetch        2    105.00     102.69     283093     652774          0           1
    total        4    105.05     102.73     283093     652774          0           1
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 50 
    Rows     Row Source Operation
          1  SORT AGGREGATE (cr=652774 pr=283093 pw=0 time=102690302 us)
    888030   HASH JOIN RIGHT OUTER (cr=652774 pr=283093 pw=0 time=99929786 us)
      28488    INDEX RANGE SCAN OBJ#(45035) (cr=130 pr=0 pw=0 time=142564 us)(object id 45035)
    888030    HASH JOIN  (cr=652644 pr=283093 pw=0 time=85254971 us)
         15     TABLE ACCESS FULL OBJ#(44893) (cr=7 pr=0 pw=0 time=320 us)
    888117     TABLE ACCESS BY INDEX ROWID OBJ#(47625) (cr=652637 pr=283093 pw=0 time=63945559 us)
    888179      NESTED LOOPS  (cr=5389 pr=4986 pw=0 time=23801052 us)
         61       INLIST ITERATOR  (cr=213 pr=1 pw=0 time=8299 us)
         61        TABLE ACCESS BY INDEX ROWID OBJ#(44860) (cr=213 pr=1 pw=0 time=7235 us)
         61         INDEX RANGE SCAN OBJ#(45023) (cr=122 pr=0 pw=0 time=2454 us)(object id 45023)
    888117       INDEX RANGE SCAN OBJ#(52001) (cr=5176 pr=4985 pw=0 time=9904545 us)(object id 52001)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                       2        0.00          0.00
      db file sequential read                    283093        0.02          8.51
      SQL*Net message from client                     2        0.00          0.00
    ********************************************************************************First question: I cannot understand why the fetch count is *2*.
    Second question: could you give me any suggestions to reduce the response time?
    Another question: the cardinality seems wrong:
    SELECT STATEMENT  ALL_ROWSCost: 28,44  Bytes: 130  Cardinality: 1                                          
         11 SORT AGGREGATE  Bytes: 130  Cardinality: 1                                     
              10 HASH JOIN RIGHT OUTER  Cost: 28,44  Bytes: 3.878.940  Cardinality: 29,838                                
                   1 INDEX RANGE SCAN INDEX (UNIQUE) PBK_GET_NORM_CIN_UK Cost: 131  Bytes: 585,051  Cardinality: 25,437                           
                   9 HASH JOIN  Cost: 28,4  Bytes: 3.192.666  Cardinality: 29,838                           
                        2 TABLE ACCESS FULL TABLE LIU_TYPES Cost: 3  Bytes: 160  Cardinality: 16                      
                        8 TABLE ACCESS BY INDEX ROWID TABLE I_JOURNAL Cost: 1,092  Bytes: 58,6  Cardinality: 1,172                      
                             7 NESTED LOOPS  Cost: 28,396  Bytes: 2.973.923  Cardinality: 30,659                 
                                  5 INLIST ITERATOR            
                                       4 TABLE ACCESS BY INDEX ROWID TABLE LAWFUL_I Cost: 11  Bytes: 1,222  Cardinality: 26       
                                            3 INDEX RANGE SCAN INDEX (UNIQUE) MITO.LIN_ID_UK Cost: 2  Cardinality: 61 
                                  6 INDEX RANGE SCAN INDEX IJL_LIN_FK_IX Cost: 30  Cardinality: 5,318  The result of the query is 890403 and in the explain plan you can see *"Cardinality: 29,838"*
    Edited by: user600979 on 11-mar-2010 2.27

    The explain plan without the hint FULL is
    15:08:15 SQL> 15:08:15 SQL> select plan_table_output from TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL,NULL,'TYPICAL'));
    PLAN_TABLE_OUTPUT
    SQL_ID  ffyv1wufuu12v, child number 0
    User has no SELECT privileges on V$SQL
    Plan hash value: 4183643102
    | Id  | Operation                         | Name                  | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                  |                       |       |       | 28440 (100)|          |
    |   1 |  SORT AGGREGATE                   |                       |     1 |   130 |            |          |
    PLAN_TABLE_OUTPUT
    |*  2 |   HASH JOIN RIGHT OUTER           |                       | 29838 |  3788K| 28440   (1)| 00:05:42 |
    |*  3 |    INDEX RANGE SCAN               | PBK_GET_NORM_CIN_UK   | 25437 |   571K|   130   (0)| 00:00:02 |
    |*  4 |    HASH JOIN                      |                       | 29838 |  3117K| 28399   (1)| 00:05:41 |
    |*  5 |     TABLE ACCESS FULL             | LIU_TYPES             |    16 |   160 |     3   (0)| 00:00:01 |
    |*  6 |     TABLE ACCESS BY INDEX ROWID   | I_JOURNAL             |  1172 | 58600 |  1091   (0)| 00:00:14 |
    |   7 |      NESTED LOOPS                 |                       | 30659 |  2904K| 28396   (1)| 00:05:41 |
    |   8 |       INLIST ITERATOR             |                       |       |       |            |          |
    |*  9 |        TABLE ACCESS BY INDEX ROWID| LAWFUL_I              |    26 |  1222 |    10   (0)| 00:00:01 |
    |* 10 |         INDEX RANGE SCAN          | LIN_ID_UK             |    61 |       |     2   (0)| 00:00:01 |
    |* 11 |       INDEX RANGE SCAN            | IJL_LIN_FK_IX         |  5318 |       |    30   (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
       2 - access("M"."NORM_CIN"="PB"."NORM_CIN")
       3 - access("PB"."OPERATOR_ID"=:SYS_B_00 AND "PB"."DELETION_DATE" IS NULL)
           filter("PB"."DELETION_DATE" IS NULL)
       4 - access("M"."LIU_TYPE"="LT"."LIU_TYPE")
       5 - filter("LT"."LIU_PRIORITY">=:SYS_B_01)
       6 - filter(("LI"."END_VALID_DATE" IS NULL OR "M"."DISPLAY_DATE"<="LI"."END_VALID_DATE"))
       9 - filter("LI"."OPERATOR_ID"=:SYS_B_63)
    PLAN_TABLE_OUTPUT
      10 - access(("LI"."ID"=:SYS_B_02 OR "LI"."ID"=:SYS_B_03 OR "LI"."ID"=:SYS_B_04 OR
                  "LI"."ID"=:SYS_B_05 OR "LI"."ID"=:SYS_B_06 OR "LI"."ID"=:SYS_B_07 OR "LI"."ID"=:SYS_B_08 OR
                  "LI"."ID"=:SYS_B_09 OR "LI"."ID"=:SYS_B_10 OR "LI"."ID"=:SYS_B_11 OR "LI"."ID"=:SYS_B_12 OR
                  "LI"."ID"=:SYS_B_13 OR "LI"."ID"=:SYS_B_14 OR "LI"."ID"=:SYS_B_15 OR "LI"."ID"=:SYS_B_16 OR
                  "LI"."ID"=:SYS_B_17 OR "LI"."ID"=:SYS_B_18 OR "LI"."ID"=:SYS_B_19 OR "LI"."ID"=:SYS_B_20 OR
                  "LI"."ID"=:SYS_B_21 OR "LI"."ID"=:SYS_B_22 OR "LI"."ID"=:SYS_B_23 OR "LI"."ID"=:SYS_B_24 OR
                  "LI"."ID"=:SYS_B_25 OR "LI"."ID"=:SYS_B_26 OR "LI"."ID"=:SYS_B_27 OR "LI"."ID"=:SYS_B_28 OR
                  "LI"."ID"=:SYS_B_29 OR "LI"."ID"=:SYS_B_30 OR "LI"."ID"=:SYS_B_31 OR "LI"."ID"=:SYS_B_32 OR
                  "LI"."ID"=:SYS_B_33 OR "LI"."ID"=:SYS_B_34 OR "LI"."ID"=:SYS_B_35 OR "LI"."ID"=:SYS_B_36 OR
                  "LI"."ID"=:SYS_B_37 OR "LI"."ID"=:SYS_B_38 OR "LI"."ID"=:SYS_B_39 OR "LI"."ID"=:SYS_B_40 OR
                  "LI"."ID"=:SYS_B_41 OR "LI"."ID"=:SYS_B_42 OR "LI"."ID"=:SYS_B_43 OR "LI"."ID"=:SYS_B_44 OR
    PLAN_TABLE_OUTPUT
                  "LI"."ID"=:SYS_B_45 OR "LI"."ID"=:SYS_B_46 OR "LI"."ID"=:SYS_B_47 OR "LI"."ID"=:SYS_B_48 OR
                  "LI"."ID"=:SYS_B_49 OR "LI"."ID"=:SYS_B_50 OR "LI"."ID"=:SYS_B_51 OR "LI"."ID"=:SYS_B_52 OR
                  "LI"."ID"=:SYS_B_53 OR "LI"."ID"=:SYS_B_54 OR "LI"."ID"=:SYS_B_55 OR "LI"."ID"=:SYS_B_56 OR
                  "LI"."ID"=:SYS_B_57 OR "LI"."ID"=:SYS_B_58 OR "LI"."ID"=:SYS_B_59 OR "LI"."ID"=:SYS_B_60 OR
                  "LI"."ID"=:SYS_B_61 OR "LI"."ID"=:SYS_B_62))
      11 - access("M"."LIID"="LI"."LIID")----
    The outpout with the FULL hint is:
    PLAN_TABLE_OUTPUT
    SQL_ID  5ksz9j3cdqnjc, child number 0
    User has no SELECT privileges on V$SQL
    Plan hash value: 3482366683
    | Id  | Operation                        | Name                  | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                 |                       |       |       | 57737 (100)|          |
    |   1 |  SORT AGGREGATE                  |                       |     1 |   130 |            |          |
    PLAN_TABLE_OUTPUT
    |*  2 |   HASH JOIN RIGHT OUTER          |                       | 29838 |  3788K| 57737   (1)| 00:11:33 |
    |*  3 |    INDEX RANGE SCAN              | PBK_GET_NORM_CIN_UK   | 25437 |   571K|   130   (0)| 00:00:02 |
    |*  4 |    HASH JOIN                     |                       | 29838 |  3117K| 57697   (1)| 00:11:33 |
    |*  5 |     TABLE ACCESS FULL            | LIU_TYPES             |    16 |   160 |     3   (0)| 00:00:01 |
    |*  6 |     HASH JOIN                    |                       | 30659 |  2904K| 57693   (1)| 00:11:33 |
    |   7 |      INLIST ITERATOR             |                       |       |       |            |          |
    |*  8 |       TABLE ACCESS BY INDEX ROWID| LAWFUL_I              |    26 |  1222 |    10   (0)| 00:00:01 |
    |*  9 |        INDEX RANGE SCAN          | LIN_ID_UK             |    61 |       |     2   (0)| 00:00:01 |
    |  10 |      TABLE ACCESS FULL           | I_JOURNAL             |  4998K|   238M| 57640   (1)| 00:11:32 |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
       2 - access("M"."NORM_CIN"="PB"."NORM_CIN")
       3 - access("PB"."OPERATOR_ID"=:SYS_B_00 AND "PB"."DELETION_DATE" IS NULL)
           filter("PB"."DELETION_DATE" IS NULL)
       4 - access("M"."LIU_TYPE"="LT"."LIU_TYPE")
       5 - filter("LT"."LIU_PRIORITY">=:SYS_B_01)
       6 - access("M"."LIID"="LI"."LIID")
           filter(("LI"."END_VALID_DATE" IS NULL OR "M"."DISPLAY_DATE"<="LI"."END_VALID_DATE"))
       8 - filter("LI"."OPERATOR_ID"=:SYS_B_63)
    PLAN_TABLE_OUTPUT
       9 - access(("LI"."ID"=:SYS_B_02 OR "LI"."ID"=:SYS_B_03 OR "LI"."ID"=:SYS_B_04 OR
                  "LI"."ID"=:SYS_B_05 OR "LI"."ID"=:SYS_B_06 OR "LI"."ID"=:SYS_B_07 OR "LI"."ID"=:SYS_B_08 OR
                  "LI"."ID"=:SYS_B_09 OR "LI"."ID"=:SYS_B_10 OR "LI"."ID"=:SYS_B_11 OR "LI"."ID"=:SYS_B_12 OR
                  "LI"."ID"=:SYS_B_13 OR "LI"."ID"=:SYS_B_14 OR "LI"."ID"=:SYS_B_15 OR "LI"."ID"=:SYS_B_16 OR
                  "LI"."ID"=:SYS_B_17 OR "LI"."ID"=:SYS_B_18 OR "LI"."ID"=:SYS_B_19 OR "LI"."ID"=:SYS_B_20 OR
                  "LI"."ID"=:SYS_B_21 OR "LI"."ID"=:SYS_B_22 OR "LI"."ID"=:SYS_B_23 OR "LI"."ID"=:SYS_B_24 OR
                  "LI"."ID"=:SYS_B_25 OR "LI"."ID"=:SYS_B_26 OR "LI"."ID"=:SYS_B_27 OR "LI"."ID"=:SYS_B_28 OR
                  "LI"."ID"=:SYS_B_29 OR "LI"."ID"=:SYS_B_30 OR "LI"."ID"=:SYS_B_31 OR "LI"."ID"=:SYS_B_32 OR
                  "LI"."ID"=:SYS_B_33 OR "LI"."ID"=:SYS_B_34 OR "LI"."ID"=:SYS_B_35 OR "LI"."ID"=:SYS_B_36 OR
                  "LI"."ID"=:SYS_B_37 OR "LI"."ID"=:SYS_B_38 OR "LI"."ID"=:SYS_B_39 OR "LI"."ID"=:SYS_B_40 OR
                  "LI"."ID"=:SYS_B_41 OR "LI"."ID"=:SYS_B_42 OR "LI"."ID"=:SYS_B_43 OR "LI"."ID"=:SYS_B_44 OR
    PLAN_TABLE_OUTPUT
                  "LI"."ID"=:SYS_B_45 OR "LI"."ID"=:SYS_B_46 OR "LI"."ID"=:SYS_B_47 OR "LI"."ID"=:SYS_B_48 OR
                  "LI"."ID"=:SYS_B_49 OR "LI"."ID"=:SYS_B_50 OR "LI"."ID"=:SYS_B_51 OR "LI"."ID"=:SYS_B_52 OR
                  "LI"."ID"=:SYS_B_53 OR "LI"."ID"=:SYS_B_54 OR "LI"."ID"=:SYS_B_55 OR "LI"."ID"=:SYS_B_56 OR
                  "LI"."ID"=:SYS_B_57 OR "LI"."ID"=:SYS_B_58 OR "LI"."ID"=:SYS_B_59 OR "LI"."ID"=:SYS_B_60 OR
                  "LI"."ID"=:SYS_B_61 OR "LI"."ID"=:SYS_B_62))

  • Tkprof not showing the Execution Plan for Statement

    Hi all
    using oracle 9i release 2
    I have issued the following statements
    alter session set sql_trace
    alter session set events '10046 trace name context forever, level 12';
    --then executed a pl-sql procedure
    after reading the traceout outfile it shows the Execution plan for statements directly wirtten under begin and end block and doesnot displays the plan for the statements written like this
    procedure a is
    cursor b is
    select ename,dname from dept a,emp b
    where a.deptno=b.deptno;
    begin
    for x in a loop --plan not found but stats are written
    select ename into v_ename from emp where empno=300; --does show the plan+stats
    end;
    what I am missing to get the actual plan in trace output file
    thanks in advance

    You have to exit sql*plus after running the procedure, example tkprof is below:
    declare
    cursor c is
    select ename, dname
    from emp, dept
    where emp.deptno = dept.deptno;
    begin
    for v_x in c
    loop
    dbms_output.put_line(v_x.ename || ' ' ||v_x.dname);
    end loop;
    end;
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.06 0 0 0 1
    Fetch 0 0.00 0.00 0 0 0 0
    total 2 0.00 0.06 0 0 0 1
    Misses in library cache during parse: 0
    Optimizer goal: CHOOSE
    Parsing user id: 68
    Elapsed times include waiting on following events:
    Event waited on Times Max. Wait Total Waited
    ---------------------------------------- Waited ---------- ------------
    SQL*Net message to client 1 0.00 0.00
    SQL*Net message from client 1 0.00 0.00
    SELECT ENAME, DNAME
    FROM
    EMP, DEPT WHERE EMP.DEPTNO = DEPT.DEPTNO
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 15 0.01 0.00 0 44 0 14
    total 17 0.01 0.00 0 44 0 14
    Misses in library cache during parse: 0
    Optimizer goal: CHOOSE
    Parsing user id: 68 (recursive depth: 1)
    Rows Row Source Operation
    14 NESTED LOOPS
    14 TABLE ACCESS FULL EMP
    14 TABLE ACCESS BY INDEX ROWID DEPT
    14 INDEX UNIQUE SCAN DEPT_PK (object id 40350)
    Best Regards
    Krystian Zieja / mob

  • Tuning PL/SQL - tkprof shows much more work for RECURSIVE STATEMENTS

    Hi,
    Firstly I'm not sure if this should be in "Database - General" or "SQL and PL/SQL". Since it's more of a performance tuning question than specifically about the PL/SQL, I'm going to put it here in "Database - General". I hope that doesn't offend anyone.
    I've just started looking at a reported performance problem in our app. One of the developers set me up a procedure that replicates the issue, I ran it while tracing the session and then fed the trace file to tkprof. The results at the bottom of my tkprof output file look like this:
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        3      0.01       0.07         10         60          0           0
    Execute      3      0.01       0.01          0          3          0           3
    Fetch        0      0.00       0.00          0          0          0           0
    total        6      0.03       0.08         10         63          0           3
    Misses in library cache during parse: 1
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                       5        0.00          0.00
      SQL*Net message from client                     4        1.68          1.70
      db file sequential read                        18        0.01          0.10
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse      416      0.00       0.01          0          0          2           0
    Execute   1456      0.71       0.75         26       1739        425         590
    Fetch     2932      0.12       2.21        337       6338          0        3061
    total     4804      0.84       2.98        363       8077        427        3651
    Misses in library cache during parse: 25
    Misses in library cache during execute: 24
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file sequential read                       343        0.08          2.09
      db file scattered read                          1        0.00          0.00
       47  user  SQL statements in session.
      888  internal SQL statements in session.
      935  SQL statements in session.
       31  statements EXPLAINed in this session.I'm looking in particular at that relatively high activity for RECURSIVE STATEMENTS, because to me, the NON-RECURSIVE (ie the actual submitted statements that form our code) looks pretty harmless. This is my first experience of trying to tune some complex looking PL/SQL and I've no idea what could be considered more "normal", but from what I think I know, and google searches, the results look quite odd to me.
    Is this high activity for RECURSIVE STATEMENTS a problem, and if so, what should I start looking at to reduce that activity?
    Regards,
    Ados

    If you have a PLSQL block or stored procedure running SQL statements, the SQL statements, too, will appear as RECURSIVE STATEMENTS in the trace file and tkprof.
    It is a misconception that RECURSIVE STATEMENTS are only SYS statements doing data dictionary lookups / updates.
    For example, I ran this :
    SQL> create or replace procedure test_procedure as
      2  begin
      3  insert into my_emp_table select * from my_emp_table;
      4  dbms_output.put_line('Rows Inserted :  ' || sql%rowcount);
      5  insert into my_emp_table select * from my_emp_table where emplid=1;
      6  dbms_output.put_line('Rows Inserted :  ' || sql%rowcount);
      7  end;
      8  /
    Procedure created.
    SQL> alter session set events '10046 trace name context forever, level 8';
    Session altered.
    SQL> execute test_procedure;
    PL/SQL procedure successfully completed.
    SQL> commit;
    Commit complete.
    SQL> select 'x' from dual;
    x
    SQL> exitThe tkprof shows ;
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        3      0.00       0.00          0          0          0           0
    Execute      3      0.00       0.00          0          0          1           1
    Fetch        2      0.00       0.00          0          0          0           1
    total        8      0.00       0.00          0          0          1           2
    Misses in library cache during parse: 2
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                       5        0.00          0.00
      SQL*Net message from client                     5        5.31         11.97
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        4      0.00       0.00          0          2          0           0
    Execute      4      0.00       0.00          2         16          7           5
    Fetch        2      0.00       0.00          0         14          0           2
    total       10      0.01       0.01          2         32          7           7
    Misses in library cache during parse: 2
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file sequential read                         2        0.00          0.00
        7  user  SQL statements in session.
        0  internal SQL statements in session.
        7  SQL statements in session.Which were the Non-Recursive statements ?
    BEGIN test_procedure; END;
    commit
    select 'x' from  dualWhich were the RECURSIVE statements (which you can identify by the keywords : (recursive depth) ?
    SELECT /* OPT_DYN_SAMP */ /*+ ALL_ROWS IGNORE_WHERE_CLAUSE
      NO_PARALLEL(SAMPLESUB) opt_param('parallel_execution_enabled', 'false')
      NO_PARALLEL_INDEX(SAMPLESUB) NO_SQL_TUNE */ NVL(SUM(C1),:"SYS_B_0"),
      NVL(SUM(C2),:"SYS_B_1")
    FROM
    (SELECT /*+ NO_PARALLEL("MY_EMP_TABLE") FULL("MY_EMP_TABLE")
      NO_PARALLEL_INDEX("MY_EMP_TABLE") */ :"SYS_B_2" AS C1, :"SYS_B_3" AS C2
      FROM "MY_EMP_TABLE" "MY_EMP_TABLE") SAMPLESUB
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        1      0.00       0.00          0          7          0           1
    total        3      0.00       0.00          0          7          0           1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 64     (recursive depth: 2)
    INSERT INTO MY_EMP_TABLE SELECT * FROM MY_EMP_TABLE
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          1          0           0
    Execute      1      0.00       0.00          2          8          4           3
    Fetch        0      0.00       0.00          0          0          0           0
    total        2      0.00       0.00          2          9          4           3
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 64     (recursive depth: 1)
    SELECT /* OPT_DYN_SAMP */ /*+ ALL_ROWS IGNORE_WHERE_CLAUSE
      NO_PARALLEL(SAMPLESUB) opt_param('parallel_execution_enabled', 'false')
      NO_PARALLEL_INDEX(SAMPLESUB) NO_SQL_TUNE */ NVL(SUM(C1),:"SYS_B_0"),
      NVL(SUM(C2),:"SYS_B_1")
    FROM
    (SELECT /*+ IGNORE_WHERE_CLAUSE NO_PARALLEL("MY_EMP_TABLE")
      FULL("MY_EMP_TABLE") NO_PARALLEL_INDEX("MY_EMP_TABLE") */ :"SYS_B_2" AS C1,
      CASE WHEN "MY_EMP_TABLE"."EMPLID"=:"SYS_B_3" THEN :"SYS_B_4" ELSE
      :"SYS_B_5" END AS C2 FROM "MY_EMP_TABLE" "MY_EMP_TABLE") SAMPLESUB
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        1      0.00       0.00          0          7          0           1
    total        3      0.00       0.00          0          7          0           1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 64     (recursive depth: 2)
    INSERT INTO MY_EMP_TABLE SELECT * FROM MY_EMP_TABLE WHERE EMPLID=1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          1          0           0
    Execute      1      0.00       0.00          0          8          3           2
    Fetch        0      0.00       0.00          0          0          0           0
    total        2      0.00       0.00          0          9          3           2
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 64     (recursive depth: 1)The INSERT statments are recursive depth 1 while the SELECTS they cause are recursive depth 2.
    Note that neither of these are are actually SYS statements agaisnt the data dictionary !!
    Edit :
    IF you read the last few lines, it would become evident that some (in my case all) the RECURSIVE STATEMENTS are non-SYS statements, actually being my code, not Oracle's code.
           1  session in tracefile.
           7  user  SQL statements in trace file.
           0  internal SQL statements in trace file.
           7  SQL statements in trace file.
           7  unique SQL statements in trace file.
          87  lines in trace file.
           6  elapsed seconds in trace file.I have 3 non-recursive and 4 "RECURSIVE" statements. All 7 are correctly identified as "user SQL statements in trace file".
    Hemant K Chitale
    http://hemantoracledba.blogspot.com
    Edited by: Hemant K Chitale on Jul 29, 2009 11:44 PM
    Edited by: Hemant K Chitale on Jul 29, 2009 11:47 PM

  • Tkprof output -- 10.2.0.4

    Hi All,
    I am facing a problem at the client side.The EOD process is taking long time.The database version is 10.2.0.4 and the OS is windows server 2003 R1
    03:57:20database >show parameter optimizer
    NAME                                 TYPE                             VALUE
    optimizer_dynamic_sampling           integer                          2
    optimizer_features_enable            string                           10.2.0.4
    optimizer_index_caching              integer                          0
    optimizer_index_cost_adj             integer                          10
    optimizer_mode                       string                           ALL_ROWS
    optimizer_secure_view_merging        boolean                          TRUE
    03:57:20database >
    03:57:20database >show parameter db_file_multi
    NAME                                 TYPE                             VALUE
    db_file_multiblock_read_count        integer                          64
    03:57:20database >
    03:57:20database >show parameter db_block_size
    NAME                                 TYPE                             VALUE
    db_block_size                        integer                          8192
    03:57:20database >
    03:57:20database >column sname format a20
    03:57:20database >column pname format a20
    03:57:20database >column pval2 format a20
    03:57:20database >
    03:57:20database >select
    03:57:20   2  sname
    03:57:20   3  , pname
    03:57:20   4  , pval1
    03:57:20   5  , pval2
    03:57:20   6  from
    03:57:20   7  sys.aux_stats$;
    SNAME                PNAME                     PVAL1 PVAL2
    SYSSTATS_INFO        STATUS                          COMPLETED
    SYSSTATS_INFO        DSTART                          03-14-2008 19:37
    SYSSTATS_INFO        DSTOP                           03-14-2008 19:37
    SYSSTATS_INFO        FLAGS                         1
    SYSSTATS_MAIN        CPUSPEEDNW           1171.76471
    SYSSTATS_MAIN        IOSEEKTIM                    10
    SYSSTATS_MAIN        IOTFRSPEED                 4096
    SYSSTATS_MAIN        SREADTIM
    SYSSTATS_MAIN        MREADTIM
    SYSSTATS_MAIN        CPUSPEED
    SYSSTATS_MAIN        MBRC
    SYSSTATS_MAIN        MAXTHR
    SYSSTATS_MAIN        SLAVETHR
    13 rows selected.
    04:01:38database >sho sga
    Total System Global Area  872415232 bytes
    Fixed Size                  1299660 bytes
    Variable Size             327158580 bytes
    Database Buffers          536870912 bytes
    Redo Buffers                7086080 bytes
    SGA_TARGET is set to 876609536
    ============================================================
    TKPROF: Release 10.2.0.4.0 - Production on Fri Apr 3 20:00:02 2009
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Trace file: E:\oracle\product\10.2.0\admin\user\udump\user_ora_456.trc
    Sort options: default
    SELECT *
    FROM
    CITY_CODES_UTI
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute   7750      5.39       5.06          0          0          0           0
    Fetch     7750     14.48      14.35          0      23250          0       31000
    total    15500     19.87      19.42          0      23250          0       31000
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   TABLE ACCESS   MODE: ANALYZED (FULL) OF 'CITY_CODES_UTI' (TABLE)
    SELECT BIN,BANK_CODE
    FROM
    BIN_BANK ORDER BY BANK_CODE
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute   7750      5.53       5.55          0          0          0           0
    Fetch     7750     14.60      14.07          0       7750          0       69750
    total    15500     20.14      19.63          0       7750          0       69750
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   SORT (ORDER BY)
          0    INDEX   MODE: ANALYZED (FULL SCAN) OF 'BIN_BANK_IDX' (INDEX)
    SELECT *
    FROM
    BANK_CURRENCY WHERE BANK_CODE=:B2 AND CUR_CODE=:B1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute   7750      5.48       4.97          0          0          0           0
    Fetch     7750      4.29       3.85          0       7750          0        7750
    total    15500      9.78       8.83          0       7750          0        7750
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   INDEX   MODE: ANALYZED (UNIQUE SCAN) OF 'PK_BANK_CUR_CODE'
                  (INDEX (UNIQUE))
    SELECT CARD_NO
    FROM
    TEST_CARDS WHERE CARD_NO=:B1 ORDER BY CARD_NO
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute  54346     45.56      41.30          0          0          0           0
    Fetch    54346    124.48     122.01          0     163038          0          70
    total   108692    170.04     163.31          0     163038          0          70
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   SORT (ORDER BY)
          0    TABLE ACCESS   MODE: ANALYZED (FULL) OF 'TEST_CARDS' (TABLE)
    SELECT NVL(DCC_FLAG,'N')
    FROM
    BANK_MASTER WHERE BANK_CODE = :B1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute  27208     18.57      17.01          0          0          0           0
    Fetch    27208     15.62      13.78          0      54416          0       27208
    total    54416     34.20      30.80          0      54416          0       27208
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF 'BANK_MASTER'
                  (TABLE)
          0    INDEX   MODE: ANALYZED (UNIQUE SCAN) OF 'SYS_C006437' (INDEX
                   (UNIQUE))
    SELECT DQP_VALIDATION
    FROM
    BANK_RPTFORMAT WHERE BANK_CODE = :B1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute  27208     17.87      16.04          0          0          0           0
    Fetch    27208     30.71      29.51          0      81624          0       27208
    total    54416     48.59      45.55          0      81624          0       27208
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   TABLE ACCESS   MODE: ANALYZED (FULL) OF 'BANK_RPTFORMAT' (TABLE)
    SELECT SUBSTR(TRANS, 4, 2)
    FROM
    RAW_BTH WHERE BTHSEQ = :B1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute  42708     30.01      27.46          0          0          0           0
    Fetch    42708     82.06    6168.61       2014     170918          0       42708
    total    85416    112.07    6196.08       2014     170918          0       42708
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF 'RAW_BTH'
                  (TABLE)
          0    INDEX   MODE: ANALYZED (RANGE SCAN) OF 'RAW_BTH_IDX' (INDEX)
    SELECT BTH_KEY,BTH_NO
    FROM
    BTH_REG WHERE BTH_KEY = :B1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute   8219      6.09       5.21          0          0          0           0
    Fetch     8219      4.60       4.54          0      16559          0        1266
    total    16438     10.70       9.75          0      16559          0        1266
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   INDEX   MODE: ANALYZED (RANGE SCAN) OF 'BTH_REG_BTH_KEY_IDX'
                  (INDEX)
    SELECT COUNT(*)
    FROM
    BTH_REG WHERE BTH_KEY=:B2 ||:B1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute   8195      6.93       6.52          0          0          0           0
    Fetch     8195      5.70       4.88          0      16454          0        8195
    total    16390     12.64      11.41          0      16454          0        8195
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   SORT (AGGREGATE)
          0    INDEX   MODE: ANALYZED (RANGE SCAN) OF 'BTH_REG_IDX' (INDEX)
    SELECT *
    FROM
    ME_UTI WHERE MID_UTI=:B1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute   8195      6.37       6.20          0          0          0           0
    Fetch     8195   8983.73    9067.57          0   13595505          0        7750
    total    16390   8990.10    9073.78          0   13595505          0        7750
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   VIEW OF 'index$_join$_002' (VIEW)
          0    HASH JOIN
          0     INDEX   MODE: ANALYZED (RANGE SCAN) OF 'COMP' (INDEX)
          0     INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                    'CMPPK_MERCHANT_MASTER' (INDEX (UNIQUE))
    SELECT TRANS,BANK_CODE,BTHSEQ,VALIDITY_FLAG
    FROM
    RAW_BTH ORDER BY BANK_CODE,BTHSEQ
    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      536     12.39      13.24       1819          0          0       53600
    total      536     12.39      13.24       1819          0          0       53600
    Misses in library cache during parse: 0
    Parsing user id: 61  (user)   (recursive depth: 1)
    UPDATE BTH_REG SET BTH_NO=:B3
    WHERE
    BTH_KEY=:B2 ||:B1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute   1242      5.78       5.52          0       2504       8755        1242
    Fetch        0      0.00       0.00          0          0          0           0
    total     1242      5.78       5.52          0       2504       8755        1242
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  UPDATE STATEMENT   MODE: ALL_ROWS
          0   UPDATE OF 'BTH_REG'
          0    INDEX   MODE: ANALYZED (RANGE SCAN) OF 'BTH_REG_BTH_KEY_IDX'
                   (INDEX)
    SELECT TRANS,BANK_CODE,BTHSEQ
    FROM
    RAW_BTH WHERE BTHSEQ >= :B2 AND BTHSEQ <= :B1 ORDER BY BANK_CODE,BTHSEQ
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute    469      0.28       0.33          0          0          0           0
    Fetch      472    154.29     156.48        124     495389          0        3146
    total      941    154.57     156.81        124     495389          0        3146
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   FILTER
          0    TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF 'RAW_BTH'
                   (TABLE)
          0     INDEX   MODE: ANALYZED (FULL SCAN) OF
                    'RAW_BTH_BKCODE_SEQ_IDX' (INDEX)
    ********************************************************************************Especially in the below query the logical I/O is alot along with the elapsed time
    SELECT *
    FROM
    ME_UTI WHERE MID_UTI=:B1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute   8195      6.37       6.20          0          0          0           0
    Fetch     8195   8983.73    9067.57          0   13595505          0        7750
    total    16390   8990.10    9073.78          0   13595505          0        7750
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 61  (user)   (recursive depth: 1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   VIEW OF 'index$_join$_002' (VIEW)
          0    HASH JOIN
          0     INDEX   MODE: ANALYZED (RANGE SCAN) OF 'COMP' (INDEX)
          0     INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                    'CMPPK_MERCHANT_MASTER' (INDEX (UNIQUE))
    04:16:43database >@index_col
    Enter value for table_name: ACQ_MERCHANT_MASTER
    Enter value for owner: user
    TABLE_NAME           INDEX_NAME                     COLUMN_NAME          COLUMN_POSITION
    ACQ_MERCHANT_MASTER  COMP                           DBANAME                            2
    ACQ_MERCHANT_MASTER  COMP                           MCC                                3
    ACQ_MERCHANT_MASTER  COMP                           BRANCH_CODE                        4
    ACQ_MERCHANT_MASTER  COMP                           MISC10                             5
    ACQ_MERCHANT_MASTER  COMP                           FIRC_FLAG                          6
    ACQ_MERCHANT_MASTER  COMP                           MCA_FLAG                           7
    ACQ_MERCHANT_MASTER  MEMASTTERMINALID               TERMINAL_ID                        1
    ACQ_MERCHANT_MASTER  CMPPK_MERCHANT_MASTER          MERCHANT_CODE                      1
    ACQ_MERCHANT_MASTER  CMPPK_MERCHANT_MASTER          BANK_CODE                          2
    ACQ_MERCHANT_MASTER  COMP                           BANK_CODE                          1
    10 rows selected.The ME_UTI is a view. The text of the view is
    04:07:41database >select VIEW_NAME,TEXT from  dba_views where view_name='ME_UTI';
    VIEW_NAME                      TEXT
    ME_UTI                         Select substr(lpad(merchant_code,15,'0'),4,12) MID_UTI,substr(dbaname,1,40) ME_NAME
                                  from ACQ_MERCHANT_MASTER
                                   where bank_code='00013'What are your suggestions????? What can be done.
    Anand

    >
    Anand,
    first of all I think that the row-by-row processing issue identified by others is much more significant to your batch processing run time than any of the things that I've mentioned. So you quite likely achieve the biggest gain in performance by re-writing the process to use plain SQL as much as possible instead of PL/SQL loops.
    That said, the parameters that I've questioned might be very reasonable for your particular environment. I just wanted to ask how you arrived at these values, e.g. measured your average index / block caching pattern to arrive at these values or similar.
    I agree with you.Higher db_file_multiblock_read_count and lower optimizer_index_cost_adj will make FTS more cheaper.No, not really. Your index based costs are 10 times lower, but your FTS costs are not even two times lower compared to default settings, so your current settings actually favor index access significantly.
    Consider:
    SQL>
    SQL> exec dbms_random.seed(0)
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.01
    SQL>
    SQL> drop table t1 purge;
    Table dropped.
    Elapsed: 00:00:00.16
    SQL>
    SQL> create table t1
      2  pctfree 99
      3  pctused 1
      4  -- tablespace test_2k
      5  -- tablespace test_4k
      6  tablespace test_8k
      7  -- tablespace test_16k
      8  as
      9  with generator as (
    10            select  --+ materialize
    11                 rownum  id
    12            from    all_objects
    13            where   rownum <= 3000
    14  )
    15  select
    16            /*+ ordered use_nl(v2) */
    17            rownum                         id,
    18            trunc(100 * dbms_random.normal)          val,
    19            rpad('x',100)                    padding
    20  from
    21            generator          v1,
    22            generator          v2
    23  where
    24            rownum <= 10000
    25  ;
    Table created.
    Elapsed: 00:00:02.53
    SQL>
    SQL> begin
      2            dbms_stats.gather_table_stats(
      3                 user,
      4                 't1',
      5                 cascade => true,
      6                 estimate_percent => null,
      7                 method_opt => 'for all columns size 1'
      8            );
      9  end;
    10  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:02.58
    SQL>
    SQL> select
      2            sum(bytes)/1024/1024 as size_mb
      3  from
      4            user_segments
      5  where
      6            segment_name = 'T1';
       SIZE_MB
            79
    Elapsed: 00:00:00.24
    SQL>
    SQL> -- default NOWORKLOAD system statistics
    SQL> column sname format a20
    SQL> column pname format a20
    SQL> column pval2 format a20
    SQL>
    SQL> select
      2             sname
      3           , pname
      4           , pval1
      5           , pval2
      6  from
      7           sys.aux_stats$;
    SNAME                PNAME                     PVAL1 PVAL2
    SYSSTATS_INFO        STATUS                          COMPLETED
    SYSSTATS_INFO        DSTART                          03-19-2009 18:28
    SYSSTATS_INFO        DSTOP                           03-19-2009 18:28
    SYSSTATS_INFO        FLAGS                         0
    SYSSTATS_MAIN        CPUSPEEDNW              408,478
    SYSSTATS_MAIN        IOSEEKTIM                    10
    SYSSTATS_MAIN        IOTFRSPEED                 4096
    SYSSTATS_MAIN        SREADTIM
    SYSSTATS_MAIN        MREADTIM
    SYSSTATS_MAIN        CPUSPEED
    SYSSTATS_MAIN        MBRC
    SYSSTATS_MAIN        MAXTHR
    SYSSTATS_MAIN        SLAVETHR
    13 rows selected.
    Elapsed: 00:00:00.03
    SQL>
    SQL> alter session set db_file_multiblock_read_count = 8;
    Session altered.
    Elapsed: 00:00:00.01
    SQL>
    SQL> explain plan for
      2  select
      3            max(val)
      4  from
      5            t1;
    Explained.
    Elapsed: 00:00:00.01
    SQL>
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 3724264953
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |     1 |     4 |  2725   (1)| 00:00:33 |
    |   1 |  SORT AGGREGATE    |      |     1 |     4 |            |          |
    |   2 |   TABLE ACCESS FULL| T1   | 10000 | 40000 |  2725   (1)| 00:00:33 |
    9 rows selected.
    Elapsed: 00:00:00.12
    SQL>
    SQL> rollback;
    Rollback complete.
    Elapsed: 00:00:00.01
    SQL>
    SQL> alter session set db_file_multiblock_read_count = 64;
    Session altered.
    Elapsed: 00:00:00.01
    SQL>
    SQL> explain plan for
      2  select
      3            max(val)
      4  from
      5            t1;
    Explained.
    Elapsed: 00:00:00.02
    SQL>
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 3724264953
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |      |     1 |     4 |  1814   (1)| 00:00:22 |
    |   1 |  SORT AGGREGATE    |      |     1 |     4 |            |          |
    |   2 |   TABLE ACCESS FULL| T1   | 10000 | 40000 |  1814   (1)| 00:00:22 |
    9 rows selected.
    Elapsed: 00:00:00.12
    SQL>
    SQL> rollback;
    Rollback complete.
    Elapsed: 00:00:00.01
    SQL>
    SQL> create index t1_idx on t1 (id);
    Index created.
    Elapsed: 00:00:01.70
    SQL>
    SQL> alter table t1 modify id not null;
    Table altered.
    Elapsed: 00:00:01.63
    SQL>
    SQL> alter session set optimizer_index_cost_adj = 100;
    Session altered.
    Elapsed: 00:00:00.00
    SQL>
    SQL> explain plan for
      2  select   /*+ index (t1) */
      3             *
      4  from
      5             t1
      6  order by
      7             id;
    Explained.
    Elapsed: 00:00:00.07
    SQL>
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 510677707
    | Id  | Operation                   | Name   | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |        | 10000 |  1054K| 10037   (1)| 00:02:01 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T1     | 10000 |  1054K| 10037   (1)| 00:02:01 |
    |   2 |   INDEX FULL SCAN           | T1_IDX | 10000 |       |    22   (0)| 00:00:01 |
    9 rows selected.
    Elapsed: 00:00:00.14
    SQL>
    SQL> rollback;
    Rollback complete.
    Elapsed: 00:00:00.01
    SQL>
    SQL> alter session set optimizer_index_cost_adj = 10;
    Session altered.
    Elapsed: 00:00:00.00
    SQL>
    SQL> -- no hint required, will use index anyway
    SQL> explain plan for
      2  select
      3             *
      4  from
      5             t1
      6  order by
      7             id;
    Explained.
    Elapsed: 00:00:00.01
    SQL>
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 510677707
    | Id  | Operation                   | Name   | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT            |        | 10000 |  1054K|  1004   (1)| 00:00:13 |
    |   1 |  TABLE ACCESS BY INDEX ROWID| T1     | 10000 |  1054K|  1004   (1)| 00:00:13 |
    |   2 |   INDEX FULL SCAN           | T1_IDX | 10000 |       |     2   (0)| 00:00:01 |
    9 rows selected.
    Elapsed: 00:00:00.10
    SQL>
    SQL> rollback;
    Rollback complete.
    Elapsed: 00:00:00.00
    SQL> As you can see the index costs are lower by an order of magnitude, making the optimizer favor the index full scan instead of the FTS (full table scan) when using the OICA (optimizer_index_cost_adj) setting of 10, even when using the MBRC (db_file_multiblock_read_count) setting of 64, because the higher MBRC setting reduces the FTS costs only from ~2700 to ~1800.
    The moderate reduction in FTS costs is caused by the formula used by the NOWORKLOAD system statistics to derive the MREADTIM and SREADTIM values from the IOSEEKTIM, MBRC, DB_BLOCK_SIZE and IOTFRSPEED values.
    When MBRC = 8:
    SREADTIM = IOSEEKTIM + DB_BLOCK_SIZE/IOTFRSPEED = 10 + 8192 / 4096 = 10 + 2 = 12ms
    MREADTIM = IOSEEKTIM + MBRC * DB_BLOCK_SIZE/IOTFRSPEED = 10 + 8 * 8192 / 4096 = 10 + 16 = 26ms
    FTS cost for reading 10,000 blocks (80MB):
    10,000 / 8 * MREADTIM / SREADTIM = 1,250 * 26 / 12 = 2,709 (+ CPU cost)
    When MBRC = 64:
    SREADTIM = IOSEEKTIM + DB_BLOCK_SIZE/IOTFRSPEED = 10 + 8192 / 4096 = 10 + 2 = 12ms
    MREADTIM = IOSEEKTIM + MBRC * DB_BLOCK_SIZE/IOTFRSPEED = 10 + 64 * 8192 / 4096 = 10 + 128 = 138ms
    FTS cost for reading 10,000 blocks (80MB):
    10,000 / 64 * MREADTIM / SREADTIM = 157 * 138 / 12 = 1,806 (+ CPU cost)
    So in a nutshell using NOWORKLOAD system statistics the derived MREADTIM is quite large, therefore the net reduction in cost is moderate when increasing the MBRC.
    Furthermore when using a low OICA setting you have the inherent risk that due to the reduction in index cost multiple indexes can end up with the same cost making the optimizer choose a bad index over an good index since indexes having the same cost will be chosen by index name...
    That's one of the major drawbacks of low OICA settings.
    How did you know that we are using default NOWORKLOAD system statistics.
    SYSSTATS_MAIN        IOSEEKTIM                    10
    SYSSTATS_MAIN        IOTFRSPEED                 4096These are the default settings, a seek time of 10ms and 4096 bytes per millisecond transfer speed, which is a very conservative assumption (4MB/sec. transfer speed)
    because it looks like that your trace file doesn't contain any STATS lines because all cursors were still held open when the tracing was disabledCan you elaborate more.Up to 10.2 Oracle writes STAT lines into the trace file only if the corresponding cursor got closed. Since your PL/SQL procedure obviously benefits from the PL/SQL cursor cache I assume that the cursors have not been closed. You can check the generated trace file for STAT lines representing the actual row source operation statistics.
    Note that 11g changes this, and the default behaviour is to write the STAT lines at first execution, which is basically a good idea but it can be misleading (as STAT statistics for further executions of the same child cursor might be missing from the trace file). For more information, see e.g. here:
    http://antognini.ch/2009/02/11g-new-feature-in-dbms_monitor/
    You don't need to use the EXPLAIN option of TKPROF, having the "Row Source Operations" recorded in the trace file is of much more valueWhy?The "Row Source Operation" tells you for each operation of the actual execution plan used the number of logical I/Os, physical I/Os and elapsed time, which tells you very exactly which step of the execution caused what kind of work.
    The EXPLAIN PLAN output of TKPROF only shows an EXPLAIN PLAN, therefore it can be quite different from the actual execution plan used, especially if bind variables are used, which is the default when using static SQL in PL/SQL.
    Can i have your email id.Follow the provided links, these include contact information if required.
    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/

  • 11g Client result set caching in OCI

    I'm trying out this feature in the 11.1.0.6 release. My understanding of this feature is that when enabled with the appropriate server-side init.ora parameters, a 11g OCI client connecting to the instance will cache SQL results locally in some fixed amount of RAM on the client. The idea is that network roundtrips would simply disappear in this situation.
    I'm not sure if it's working--or how to tell if it is. I have a 11g instance running and put the 11g client incl. sqlplus on a separate box, setting up TNS connectivity from client to server. Pretty standard stuff. I can connect fine and run the same query over and over, but I see incrementing execution counts on the database side and network traffic between the client and server so I'm guessing that the client-side caching isn't happening. There doesn't seem to be a ton of clear documentation on this feature so I wanted to see if anyone else has kicked it around.
    Bob

    I am also facing the same issue (enabling client result set caching). I am using Oracle Database 11g Release 11.2.0.2.0.
    I have made the below configuration changes
    1. Enabled the client result set cache by setting the server side parameter 'client_result_cache_size' to 10485760 (10 MB)
    2. Restarted the oracle instance after setting the above parameter
    3. Added a table annotation by executing the statement ALTER TABLE emp RESULT_CACHE (MODE FORCE). I verified that the annotation is applied by query the user table later.
    4. Enabled statement caching on the client side i.e. on the JDBC driver.
    5. Used prepared statements to execute the query so that statement caching kicks in. From the driver logs I verified that execution of subsequent queries after the first one used the same statement handle.
    After executing the select prepared statement query for three times I checked the CLIENT_RESULT_CACHE_STATS$ view. But this view didn't result in any rows.
    As part of troubleshooting I even tried adding the /*+ RESULT_CACHE */ hint to the query but the view didn't gave any result.
    Also on enabling sql trace I could see from tkprof that every execution of the query increased the number of rows fetched on the server which indicates that the client result set caching in OCI isn't working.
    Are there any steps which I have missed?
    Thanks in advance.

  • We have a set of oracle clients running on T5220 zones that need some help

    Greetings all -
    We have a set of oracle clients running on T5220 zones that need some help.
    If, for example, I execute the query "select (all) from dba_objects", trace output reports 90% of the elapsed time spent under "SQLNet message from client".
    Here are OS details for the clients: Solaris 10 5/08 s10s_u5wos_10 SPARC
    Running "uname -a" from the client gives:
    (SunOS bmc-ste-app 5.10 Generic_127127-11 sun4v sparc SUNW,SPARC-Enterprise-T5220)
    Here are OS details for the dataserver: Enterprise Linux Enterprise Linux Server release 5.2
    Running "uname -a" from the dataserver gives:
    (2.6.18-92.1.6.0.2.el5 #1 SMP Thu Jun 26 17:44:55 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux)
    The RDBMS is 10.2.0.4
    Again, please note, there is no application in the picture here. We are just running a simple catalog query (select * from dba_objects) from sqlplus. Why the wait on something like this? The wait also occurs when a different query is used (select (all) from SYS.COL$ where rownum < 50000). And it doesn't matter if I used the full client or the instant client. I still get the same high-wait.
    We had thought - maybe this is a network thing - so we put a test client on the same subnet as the dataserver. This helped - but not enough. The wait is still way too high even with firewalls taken out of the equation.
    We've also looked at arraysize, SDU, kernel settings. And we've spent time going over tkprof, truss and sqlnet-tracing.
    Has anyone ever had to solve this HIGH WAIT ON CLIENT issue? Is there a work around or some tweak I'm missing.
    Is anyone configured like we are (linux dataserver, solaris clients)? If so - did you see anything like this?
    tia -
    Jim
    Edited by: jim1768 on Mar 31, 2010 1:47 PM
    Edited by: jim1768 on Mar 31, 2010 2:12 PM
    Edited by: jim1768 on Mar 31, 2010 2:13 PM

    Hello,
    We have the exact same issue. Did you ever solve this issue? We have a t5220 and have just upgraded our 11.5.10.2 11i system on it from 9.2.0.8 32-bit sparc to 11.2.0.1 64-bit sparc. Things should be faster but arent, and our consultant has tracked it down to high wait times when the apps tier using forms connects to the database tier on the same box. So even though the t5220 is both server and client, there is something about the client sql connection.through TNS that his having trouble. Thanks for any information. We've also created an S/R with Oracle.
    Note: I am well aware of the other issues with the CMT server series but this particular issue seems independent of the regular / known issues and remains a mystery to us. Other known issues with the CMT servers for SPARC:
    Metalink Note 781763.1 (Migration from fast single threaded CPU machine to CMT UltraSPARC T1 & T2)
    http://blogs.sun.com/glennf/resource/Optimizing_Oracle_CMT_v1.pdf
    http://blogs.sun.com/glennf/tags/throughput
    http://blogs.sun.com/glennf/entry/getting_past_go_with_sparc
    http://www.oracle.com/apps_benchmark/doc/E-Bus-11i-PAY_ORA_SUN-T5220.pdf (this paper has some oracle init settings at the end. The kernel settings have been included in the OS upgrade)
    http://blogs.sun.com/mandalika/entry/siebel_on_sun_cmt_hardware

Maybe you are looking for