Tuning the sql query when we have 30 Million records

Hi Friends,
I have query which takes around 25 to 30 Minutes to retrieve 9 Million records.
Oracle version=11.2.0.2
OS=Solaris 10 64bit
query details
CREATE OR REPLACE VIEW TIBEX_ORDERSBYQSIDVIEW
AS 
SELECT  A."ORDERID", A."USERORDERID", A."ORDERSIDE", A."ORDERTYPE",
          A.ORDERSTATUS, A.BOARDID, A.TIMEINFORCE, A.INSTRUMENTID,
          A.REFERENCEID, A.PRICETYPE, A.PRICE, A.AVERAGEPRICE,
          A.QUANTITY, A.MINIMUMFILL, A.DISCLOSEDQTY, A.REMAINQTY,
          A.AON, A.PARTICIPANTID, A.ACCOUNTTYPE, A.ACCOUNTNO,
          A.CLEARINGAGENCY, A.LASTINSTRESULT, A.LASTINSTMESSAGESEQUENCE,
          A.LASTEXECUTIONID, A.NOTE, A.TIMESTAMP, A.QTYFILLED, A.MEID,
          A.LASTINSTREJECTCODE, A.LASTEXECPRICE, A.LASTEXECQTY,
          A.LASTINSTTYPE, A.LASTEXECUTIONCOUNTERPARTY, A.VISIBLEQTY,
          A.STOPPRICE, A.LASTEXECCLEARINGAGENCY, A.LASTEXECACCOUNTNO,
          A.LASTEXECCPCLEARINGAGENCY, A.MESSAGESEQUENCE,
          A.LASTINSTUSERALIAS, A.BOOKTIMESTAMP, A.PARTICIPANTIDMM,
          A.MARKETSTATE, A.PARTNEREXID, A.LastExecSETTLEMENTCYCLE,
          A.LASTEXECPOSTTRADEVENUETYPE, A.PRICELEVELPOSITION,
          A.PREVREFERENCEID, A.EXPIRYTIMESTAMP, matchType,
          a.lastExecutionRole, a.MDEntryID, a.PegOffset,
          a.haltReason, A.COMPARISONPRICE, A.ENTEREDPRICETYPE,
          A.ISPEX, A.CLEARINGHANDLING, B.qsid
    FROM  tibex_Order A,
          tibex_Participant b
    WHERE a.participantID = b.participantID
      AND (A.MessageSequence, A.OrderID) IN (
            SELECT  max(C.MessageSequence), C.OrderID
              FROM  tibex_Order C
              WHERE LastInstRejectCode = 'OK'
              GROUP By C.OrderID
      AND a.OrderStatus IN (
            SELECT OrderStatus
              FROM  tibex_orderStatusEnum
              WHERE ShortDesc IN (
                      'ORD_OPEN', 'ORD_EXPIRE', 'ORD_CANCEL', 'ORD_FILLED','ORD_CREATE','ORD_PENDAMD','ORD_PENDCAN'
  UNION ALL
  SELECT  A.ORDERID, A.USERORDERID, A.ORDERSIDE, A.ORDERTYPE,
          A.ORDERSTATUS, A.BOARDID, A.TIMEINFORCE, A.INSTRUMENTID,
          A.REFERENCEID, A.PRICETYPE, A.PRICE, A.AVERAGEPRICE,
          A.QUANTITY, A.MINIMUMFILL, A.DISCLOSEDQTY, A.REMAINQTY,
          A.AON, A.PARTICIPANTID, A.ACCOUNTTYPE, A.ACCOUNTNO,
          A.CLEARINGAGENCY, A.LASTINSTRESULT, A.LASTINSTMESSAGESEQUENCE,
          A.LASTEXECUTIONID, A.NOTE, A.TIMESTAMP, A.QTYFILLED, A.MEID,
          A.LASTINSTREJECTCODE, A.LASTEXECPRICE, A.LASTEXECQTY,
          A.LASTINSTTYPE, A.LASTEXECUTIONCOUNTERPARTY, A.VISIBLEQTY,
          A.STOPPRICE, A.LASTEXECCLEARINGAGENCY, A.LASTEXECACCOUNTNO,
          A.LASTEXECCPCLEARINGAGENCY, A.MESSAGESEQUENCE,
          A.LASTINSTUSERALIAS, A.BOOKTIMESTAMP, A.PARTICIPANTIDMM,
          A.MARKETSTATE, A.PARTNEREXID, A.LastExecSETTLEMENTCYCLE,
          A.LASTEXECPOSTTRADEVENUETYPE, A.PRICELEVELPOSITION,
          A.PREVREFERENCEID, A.EXPIRYTIMESTAMP, matchType,
          a.lastExecutionRole, A.MDEntryID, a.PegOffset,
          a.haltReason, A.COMPARISONPRICE, A.ENTEREDPRICETYPE,
          A.ISPEX, A.CLEARINGHANDLING, B.qsid
    FROM  tibex_Order A,
          tibex_Participant b
    WHERE a.participantID = b.participantID
      AND orderstatus in (
            SELECT  orderstatus
              FROM  tibex_orderStatusEnum
              WHERE ShortDesc in ('ORD_REJECT')
      AND 1 IN (
              SELECT count(*)
                FROM tibex_order c
                WHERE c.orderid=a.orderid
                  AND c.instrumentID=a.instrumentID
/Tried by modifying the query but same result was not retrieved but it was Quicker 6 min.Can Somebody check where i am going wrong.
CREATE OR REPLACE VIEW TIBEX_ORDERSBYQSIDVIEW
AS   
WITH REJ AS
SELECT ROWID RID
FROM   TIBEX_ORDER
WHERE  ORDERSTATUS = (SELECT ORDERSTATUS
                      FROM   TIBEX_ORDERSTATUSENUM
                      WHERE  SHORTDESC = 'ORD_REJECT')
REJ1 AS
SELECT ROWID RID
FROM   TIBEX_ORDER
WHERE  ORDERSTATUS NOT IN (SELECT ORDERSTATUS
                           FROM   TIBEX_ORDERSTATUSENUM
                           WHERE  SHORTDESC = 'ORD_NOTFND'
                           OR     SHORTDESC = 'ORD_REJECT')
SELECT O.*,
       P.QSID
FROM   TIBEX_ORDER O,
       TIBEX_PARTICIPANT P
WHERE  O.PARTICIPANTID = P.PARTICIPANTID
AND    O.ROWID IN (
                   SELECT RID
                   FROM   (
                           SELECT   ROWID RID,
                                    ORDERSTATUS,
                                    RANK () OVER (PARTITION BY ORDERID ORDER BY MESSAGESEQUENCE ASC) R
                           FROM     TIBEX_ORDER
                   WHERE  R = 1
                   AND    RID IN (SELECT RID FROM REJ)
UNION ALL
SELECT O.*,
       P.QSID
FROM   TIBEX_ORDER O,
       TIBEX_PARTICIPANT P
WHERE  O.PARTICIPANTID = P.PARTICIPANTID
AND    O.ROWID IN (
                   SELECT RID
                   FROM   (
                           SELECT   ROWID RID,
                                    ORDERSTATUS,
                                    RANK () OVER (PARTITION BY ORDERID ORDER BY MESSAGESEQUENCE DESC) R
                           FROM     TIBEX_ORDER
                   WHERE  R = 1
                   AND    RID IN (SELECT RID FROM REJ1)
                  );Regards
NM

Hi Satish,
CREATE OR REPLACE VIEW TIBEX_ORDERSBYQSIDVIEW
(ORDERID, USERORDERID, ORDERSIDE, ORDERTYPE, ORDERSTATUS,
BOARDID, TIMEINFORCE, INSTRUMENTID, REFERENCEID, PRICETYPE,
PRICE, AVERAGEPRICE, QUANTITY, MINIMUMFILL, DISCLOSEDQTY,
REMAINQTY, AON, PARTICIPANTID, ACCOUNTTYPE, ACCOUNTNO,
CLEARINGAGENCY, LASTINSTRESULT, LASTINSTMESSAGESEQUENCE, LASTEXECUTIONID, NOTE,
TIMESTAMP, QTYFILLED, MEID, LASTINSTREJECTCODE, LASTEXECPRICE,
LASTEXECQTY, LASTINSTTYPE, LASTEXECUTIONCOUNTERPARTY, VISIBLEQTY, STOPPRICE,
LASTEXECCLEARINGAGENCY, LASTEXECACCOUNTNO, LASTEXECCPCLEARINGAGENCY, MESSAGESEQUENCE, LASTINSTUSERALIAS,
BOOKTIMESTAMP, PARTICIPANTIDMM, MARKETSTATE, PARTNEREXID, LASTEXECSETTLEMENTCYCLE,
LASTEXECPOSTTRADEVENUETYPE, PRICELEVELPOSITION, PREVREFERENCEID, EXPIRYTIMESTAMP, MATCHTYPE,
LASTEXECUTIONROLE, MDENTRYID, PEGOFFSET, HALTREASON, COMPARISONPRICE,
ENTEREDPRICETYPE, ISPEX, CLEARINGHANDLING, QSID)
AS
SELECT  A."ORDERID", A."USERORDERID", A."ORDERSIDE", A."ORDERTYPE",
          A.ORDERSTATUS, A.BOARDID, A.TIMEINFORCE, A.INSTRUMENTID,
          A.REFERENCEID, A.PRICETYPE, A.PRICE, A.AVERAGEPRICE,
          A.QUANTITY, A.MINIMUMFILL, A.DISCLOSEDQTY, A.REMAINQTY,
          A.AON, A.PARTICIPANTID, A.ACCOUNTTYPE, A.ACCOUNTNO,
          A.CLEARINGAGENCY, A.LASTINSTRESULT, A.LASTINSTMESSAGESEQUENCE,
          A.LASTEXECUTIONID, A.NOTE, A.TIMESTAMP, A.QTYFILLED, A.MEID,
          A.LASTINSTREJECTCODE, A.LASTEXECPRICE, A.LASTEXECQTY,
          A.LASTINSTTYPE, A.LASTEXECUTIONCOUNTERPARTY, A.VISIBLEQTY,
          A.STOPPRICE, A.LASTEXECCLEARINGAGENCY, A.LASTEXECACCOUNTNO,
          A.LASTEXECCPCLEARINGAGENCY, A.MESSAGESEQUENCE,
          A.LASTINSTUSERALIAS, A.BOOKTIMESTAMP, A.PARTICIPANTIDMM,
          A.MARKETSTATE, A.PARTNEREXID, A.LastExecSETTLEMENTCYCLE,
          A.LASTEXECPOSTTRADEVENUETYPE, A.PRICELEVELPOSITION,
          A.PREVREFERENCEID, A.EXPIRYTIMESTAMP, matchType,
          a.lastExecutionRole, a.MDEntryID, a.PegOffset,
          a.haltReason, A.COMPARISONPRICE, A.ENTEREDPRICETYPE,
          A.ISPEX, A.CLEARINGHANDLING, B.qsid
    FROM  tibex_Order A,
          tibex_Participant b
    WHERE a.participantID = b.participantID
      AND (A.MessageSequence, A.OrderID) IN ( SELECT MAX (C.MessageSequence), C.OrderID
           FROM tibex_Order C
             WHERE c.LastInstRejectCode = 'OK'
             and a.OrderID=c.OrderID
               GROUP BY C.OrderID)
      AND a.OrderStatus IN (2,4,5,6,1,9,10)
  UNION ALL
  SELECT  A.ORDERID, A.USERORDERID, A.ORDERSIDE, A.ORDERTYPE,
          A.ORDERSTATUS, A.BOARDID, A.TIMEINFORCE, A.INSTRUMENTID,
          A.REFERENCEID, A.PRICETYPE, A.PRICE, A.AVERAGEPRICE,
          A.QUANTITY, A.MINIMUMFILL, A.DISCLOSEDQTY, A.REMAINQTY,
          A.AON, A.PARTICIPANTID, A.ACCOUNTTYPE, A.ACCOUNTNO,
          A.CLEARINGAGENCY, A.LASTINSTRESULT, A.LASTINSTMESSAGESEQUENCE,
          A.LASTEXECUTIONID, A.NOTE, A.TIMESTAMP, A.QTYFILLED, A.MEID,
          A.LASTINSTREJECTCODE, A.LASTEXECPRICE, A.LASTEXECQTY,
          A.LASTINSTTYPE, A.LASTEXECUTIONCOUNTERPARTY, A.VISIBLEQTY,
          A.STOPPRICE, A.LASTEXECCLEARINGAGENCY, A.LASTEXECACCOUNTNO,
          A.LASTEXECCPCLEARINGAGENCY, A.MESSAGESEQUENCE,
          A.LASTINSTUSERALIAS, A.BOOKTIMESTAMP, A.PARTICIPANTIDMM,
          A.MARKETSTATE, A.PARTNEREXID, A.LastExecSETTLEMENTCYCLE,
          A.LASTEXECPOSTTRADEVENUETYPE, A.PRICELEVELPOSITION,
          A.PREVREFERENCEID, A.EXPIRYTIMESTAMP, matchType,
          a.lastExecutionRole, A.MDEntryID, a.PegOffset,
          a.haltReason, A.COMPARISONPRICE, A.ENTEREDPRICETYPE,
          A.ISPEX, A.CLEARINGHANDLING, B.qsid
    FROM  tibex_Order A,
          tibex_Participant b
    WHERE a.participantID = b.participantID
      AND orderstatus=3
      AND 1 IN (
              SELECT count(*)
                FROM tibex_order c
                WHERE c.orderid=a.orderid
                  AND c.instrumentID=a.instrumentID
select * from TIBEX_ORDERSBYQSIDVIEW where participantid='NITE';
Current SQL using Temp Segment and Look for Column TEMPSEG_SIZE_MB
       SID TIME                OPERATION                 ESIZE        MEM    MAX MEM       PASS TEMPSEG_SIZE_MB
       183 11/10/2011:13:38:44 HASH-JOIN                    43         43       1556          1            1024
       183 11/10/2011:13:38:44 GROUP BY (HASH)            2043       2072       2072          0            4541Edited by: NM on 11-Oct-2011 04:38

Similar Messages

  • Tuning the sql query

    Hi All,
    I have query in using oracle report , its taking long time to run the report when we run for 1 month period , even its taking time trying with 1 or 2 days also .
    below is the query , here we are using most of the VIew also , please help me how to improve the perfomance of this.what needs to concentrate mainly here . please help me out. Thanks in advance.
    SELECT                                                                  
             pd.segment20 discipline,
               ppx.employee_number,
             SUBSTR (ppx.full_name, 1, 50) fullname,
               pj.NAME designation,
             horg.NAME department,
               SUM (a.measure) hours,
             d.segment1 projectnumber,
               d.NAME projectname,
               pat.task_name    
    FROM     per_analysis_criteria pd,
             per_people_x ppx,
             per_jobs_v pj,
             hr_all_organization_units horg,
             hxc_time_building_blocks a,
               pa_projects_all d,
               pa_tasks pat,
             hxc_time_attribute_usages b,
             hxc_time_attributes c,
             hxc_time_building_blocks DAY,
             hxc_time_building_blocks TIME,
             per_assignments_x pax,
             hxc_timecard_summary summary,
             per_person_analyses pe,
             per_special_info_types_v pf
       WHERE pax.organization_id  = horg.organization_id
         AND pd.id_flex_num                  = pf.id_flex_num
         AND pd.analysis_criteria_id        = pe.analysis_criteria_id
         AND pax.job_id          = pj.job_id
         AND c.attribute1        = pat.project_id
         AND c.attribute2        = pat.task_id
         AND a.time_building_block_id = b.time_building_block_id
         AND d.project_id        = c.attribute1
         AND pat.task_id         = c.attribute2
         AND b.time_attribute_id = c.time_attribute_id
         AND a.parent_building_block_id   = DAY.time_building_block_id
         AND a.parent_building_block_ovn  = DAY.object_version_number
         AND DAY.parent_building_block_id = TIME.time_building_block_id
         AND DAY.parent_building_block_ovn= TIME.object_version_number
         AND TIME.time_building_block_id  = summary.timecard_id
         AND TIME.object_version_number   = summary.timecard_ovn
         AND a.resource_id                = ppx.person_id
         AND ppx.person_id                       = pax.person_id
         AND pf.id_flex_num                  = pe.id_flex_num
         AND pe.person_id                       = ppx.person_id
         AND pf.business_group_id             = pe.business_group_id
         AND a.object_version_number        = b.time_building_block_ovn
         AND pax.primary_flag                  = 'Y'
         AND summary.approval_status        = 'APPROVED'
         AND a.SCOPE                            = 'DETAIL'
         AND pf.NAME                            = 'SEC Staff Movement'
         AND c.attribute_category             = 'PROJECTS'
         AND d.segment1 LIKE '905%'
         AND DAY.start_time                      >= :p_start_date
         AND TRUNC (DAY.stop_time, 'DD')  <= :p_end_date
         AND SYSDATE BETWEEN a.date_from    AND a.date_to
         AND SYSDATE BETWEEN DAY.date_from  AND DAY.date_to
         AND SYSDATE BETWEEN TIME.date_from AND TIME.date_to
         AND a.object_version_number =
                      (SELECT MAX (b.object_version_number)
                         FROM hxc_time_building_blocks b
                        WHERE b.time_building_block_id = a.time_building_block_id)
         AND pe.date_from = (SELECT MAX (xsm.date_from)
                               FROM xsec_staff_movement xsm
                              WHERE xsm.emp_person_id = ppx.person_id)
    GROUP BY pd.segment20,
             ppx.employee_number,
             SUBSTR (ppx.full_name, 1, 50),
             pj.NAME,
             horg.NAME,
             d.segment1,
             d.NAME,
             pat.task_name
    [\pre]
    Thanks
    RG
    Message was edited by:
            user549459                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Hi Rob , I managed to recreate the plan table and below is the out put. please help me out
    PLAN_TABLE_OUTPUT
    | Id  | Operation                                                |  Name                          | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT                                         |                                |     1 |   573 |   383 |
    |   1 |  SORT GROUP BY                                           |                                |     1 |   573 |   380 |
    |*  2 |   FILTER                                                 |                                |       |       |       |
    |   3 |    NESTED LOOPS                                          |                                |     1 |   573 |   355 |
    |   4 |     NESTED LOOPS                                         |                                |     1 |   554 |   353 |
    |   5 |      NESTED LOOPS                                        |                                |     1 |   529 |   351 |
    |   6 |       NESTED LOOPS                                       |                                |     1 |   484 |   349 |
    |   7 |        NESTED LOOPS                                      |                                |     1 |   461 |   348 |
    |   8 |         NESTED LOOPS                                     |                                |     1 |   417 |   347 |
    |   9 |          NESTED LOOPS                                    |                                |     1 |   394 |   345 |
    |  10 |           NESTED LOOPS                                   |                                |     1 |   379 |   342 |
    |  11 |            NESTED LOOPS                                  |                                |     1 |   328 |   181 |
    |  12 |             NESTED LOOPS                                 |                                |     1 |   305 |   180 |
    |  13 |              NESTED LOOPS                                |                                |     1 |   297 |   179 |
    |  14 |               NESTED LOOPS                               |                                |     1 |   287 |   178 |
    |  15 |                NESTED LOOPS                              |                                |     1 |   256 |   177 |
    |  16 |                 NESTED LOOPS                             |                                |     1 |   215 |   173 |
    PLAN_TABLE_OUTPUT
    |  17 |                  NESTED LOOPS                            |                                |     1 |    97 |   171 |
    |  18 |                   NESTED LOOPS                           |                                |     1 |    71 |   169 |
    |* 19 |                    HASH JOIN                             |                                |     1 |    59 |     5 |
    |  20 |                     NESTED LOOPS                         |                                |     1 |    51 |     2 |
    |* 21 |                      TABLE ACCESS BY INDEX ROWID         | FND_ID_FLEX_STRUCTURES_TL      |     1 |    37 |     2 |
    |* 22 |                       INDEX RANGE SCAN                   | FND_ID_FLEX_STRUCTURES_TL_N1   |     1 |       |     1 |
    |* 23 |                      INDEX UNIQUE SCAN                   | FND_ID_FLEX_STRUCTURES_U1      |     1 |    14 |       |
    |  24 |                     TABLE ACCESS FULL                    | PER_SPECIAL_INFO_TYPES         |    45 |   360 |     2 |
    |  25 |                    TABLE ACCESS BY INDEX ROWID           | PER_ANALYSIS_CRITERIA          |  1527 | 18324 |   164 |
    |* 26 |                     INDEX RANGE SCAN                     | PER_ANALYSIS_CRITERIA_N1       |  1768 |       |     6 |
    |* 27 |                   TABLE ACCESS BY INDEX ROWID            | PER_PERSON_ANALYSES            |     1 |    26 |     2 |
    |* 28 |                    INDEX RANGE SCAN                      | PER_PERSON_ANALYSES_FK2        |     3 |       |     1 |
    |* 29 |                  TABLE ACCESS BY INDEX ROWID             | PER_ALL_PEOPLE_F               |     1 |   118 |     2 |
    |* 30 |                   INDEX RANGE SCAN                       | PER_PEOPLE_F_PK                |     1 |       |     1 |
    |  31 |                    SORT AGGREGATE                        |                                |     1 |   417 |       |
    |  32 |                     NESTED LOOPS OUTER                   |                                |     1 |   417 |    25 |
    |  33 |                      NESTED LOOPS OUTER                  |                                |     1 |   319 |    23 |
    |  34 |                       NESTED LOOPS OUTER                 |                                |     1 |   221 |    21 |
    |  35 |                        NESTED LOOPS OUTER                |                                |     1 |   217 |    21 |
    |  36 |                         NESTED LOOPS OUTER               |                                |     1 |   213 |    21 |
    |  37 |                          NESTED LOOPS OUTER              |                                |     1 |   209 |    21 |
    PLAN_TABLE_OUTPUT
    |  38 |                           NESTED LOOPS OUTER             |                                |     1 |   205 |    21 |
    |* 39 |                            HASH JOIN                     |                                |     1 |   201 |    21 |
    |  40 |                             NESTED LOOPS                 |                                |     1 |   177 |    18 |
    |  41 |                              NESTED LOOPS                |                                |     1 |    51 |    17 |
    |* 42 |                               TABLE ACCESS BY INDEX ROWID| PER_ALL_ASSIGNMENTS_F          |     1 |    33 |     5 |
    |* 43 |                                INDEX RANGE SCAN          | PER_ASSIGNMENTS_F_N12          |     3 |       |     2 |
    |  44 |                               TABLE ACCESS BY INDEX ROWID| PER_PERSON_ANALYSES            |     1 |    18 |    12 |
    |* 45 |                                INDEX RANGE SCAN          | PER_PERSON_ANALYSES_N3         |     1 |       |     1 |
    |  46 |                              TABLE ACCESS BY INDEX ROWID | PER_ANALYSIS_CRITERIA          |     1 |   126 |     1 |
    |* 47 |                               INDEX UNIQUE SCAN          | PER_ANALYSIS_CRITERIA_PK       |     1 |       |       |
    |* 48 |                             TABLE ACCESS FULL            | FND_ID_FLEX_STRUCTURES         |     1 |    24 |     2 |
    |* 49 |                            INDEX UNIQUE SCAN             | PA_TASKS_U1                    |     1 |     4 |       |
    |* 50 |                           INDEX UNIQUE SCAN              | PA_TASKS_U1                    |     1 |     4 |       |
    |* 51 |                          INDEX UNIQUE SCAN               | PA_TASKS_U1                    |     1 |     4 |       |
    |* 52 |                         INDEX UNIQUE SCAN                | PA_PROJECTS_U1                 |     1 |     4 |       |
    |* 53 |                        INDEX UNIQUE SCAN                 | PA_PROJECTS_U1                 |     1 |     4 |       |
    |* 54 |                       TABLE ACCESS BY INDEX ROWID        | PER_ALL_PEOPLE_F               |     1 |    98 |     2 |
    |* 55 |                        INDEX RANGE SCAN                  | PER_PEOPLE_F_PK                |     1 |       |     1 |
    |* 56 |                      TABLE ACCESS BY INDEX ROWID         | PER_ALL_PEOPLE_F               |     1 |    98 |     2 |
    |* 57 |                       INDEX RANGE SCAN                   | PER_PEOPLE_F_PK                |     1 |       |     1 |
    |* 58 |                 TABLE ACCESS BY INDEX ROWID              | PER_ALL_ASSIGNMENTS_F          |     1 |    41 |     4 |
    PLAN_TABLE_OUTPUT
    |* 59 |                  INDEX RANGE SCAN                        | PER_ASSIGNMENTS_F_N12          |     3 |       |     1 |
    |  60 |                TABLE ACCESS BY INDEX ROWID               | HR_ALL_ORGANIZATION_UNITS      |     1 |    31 |     1 |
    |* 61 |                 INDEX UNIQUE SCAN                        | HR_ORGANIZATION_UNITS_PK       |     1 |       |       |
    |  62 |               TABLE ACCESS BY INDEX ROWID                | PER_JOBS                       |     1 |    10 |     1 |
    |* 63 |                INDEX UNIQUE SCAN                         | PER_JOBS_PK                    |     1 |       |       |
    |* 64 |              TABLE ACCESS BY INDEX ROWID                 | PER_JOB_GROUPS                 |     1 |     8 |     1 |
    |* 65 |               INDEX UNIQUE SCAN                          | PER_JOB_GROUPS_PK              |     1 |       |       |
    |  66 |             TABLE ACCESS BY INDEX ROWID                  | PER_JOBS_TL                    |     1 |    23 |     1 |
    |* 67 |              INDEX UNIQUE SCAN                           | PER_JOBS_TL_PK                 |     1 |       |       |
    |* 68 |            TABLE ACCESS BY INDEX ROWID                   | HXC_TIME_BUILDING_BLOCKS       |     8 |   408 |   161 |
    |* 69 |             INDEX RANGE SCAN                             | HXC_TIME_BUILDING_BLOCKS_FK2   |   543 |       |     5 |
    |  70 |           TABLE ACCESS BY INDEX ROWID                    | HXC_TIME_ATTRIBUTE_USAGES      |     1 |    15 |     3 |
    |* 71 |            INDEX RANGE SCAN                              | HXC_TIME_ATTRIBUTE_USAGES_FK2  |     1 |       |     2 |
    |* 72 |          TABLE ACCESS BY INDEX ROWID                     | HXC_TIME_ATTRIBUTES            |     1 |    23 |     2 |
    |* 73 |           INDEX UNIQUE SCAN                              | HXC_TIME_ATTRIBUTES_PK         |     1 |       |     1 |
    |* 74 |         TABLE ACCESS BY INDEX ROWID                      | PA_PROJECTS_ALL                |     1 |    44 |     1 |
    |* 75 |          INDEX UNIQUE SCAN                               | PA_PROJECTS_U1                 |     1 |       |       |
    |* 76 |        TABLE ACCESS BY INDEX ROWID                       | PA_TASKS                       |     1 |    23 |     1 |
    |* 77 |         INDEX UNIQUE SCAN                                | PA_TASKS_U1                    |     1 |       |       |
    |* 78 |       TABLE ACCESS BY INDEX ROWID                        | HXC_TIME_BUILDING_BLOCKS       |     1 |    45 |     2 |
    |* 79 |        INDEX UNIQUE SCAN                                 | HXC_TIME_BUILDING_BLOCKS_PK    |     1 |       |     1 |
    PLAN_TABLE_OUTPUT
    |* 80 |      TABLE ACCESS BY INDEX ROWID                         | HXC_TIME_BUILDING_BLOCKS       |     1 |    25 |     2 |
    |* 81 |       INDEX UNIQUE SCAN                                  | HXC_TIME_BUILDING_BLOCKS_PK    |     1 |       |     1 |
    |* 82 |     TABLE ACCESS BY INDEX ROWID                          | HXC_TIMECARD_SUMMARY           |     1 |    19 |     2 |
    |* 83 |      INDEX UNIQUE SCAN                                   | HXC_TIMECARD_SUMMARY_PK        |     1 |       |     1 |
    |  84 |    SORT AGGREGATE                                        |                                |     1 |     9 |       |
    |  85 |     FIRST ROW                                            |                                |     1 |     9 |     3 |
    |* 86 |      INDEX RANGE SCAN (MIN/MAX)                          | HXC_TIME_BUILDING_BLOCKS_PK    |    10M|       |     3 |
    Predicate Information (identified by operation id):
       2 - filter("SYS_ALIAS_1"."OBJECT_VERSION_NUMBER"= (SELECT /*+ */ MAX("B"."OBJECT_VERSION_NUMBER")
                  "HXC"."HXC_TIME_BUILDING_BLOCKS" "B" WHERE "B"."TIME_BUILDING_BLOCK_ID"=:B1))
      19 - access("X"."ID_FLEX_NUM"="B"."ID_FLEX_NUM")
      21 - filter("T"."ID_FLEX_CODE"='PEA')
      22 - access("T"."ID_FLEX_STRUCTURE_NAME"='SEC Staff Movement' AND "T"."LANGUAGE"=:B1)
      23 - access("B"."APPLICATION_ID"="T"."APPLICATION_ID" AND "B"."ID_FLEX_CODE"="T"."ID_FLEX_CODE" AN
                  "B"."ID_FLEX_NUM"="T"."ID_FLEX_NUM")
           filter("B"."ID_FLEX_CODE"='PEA')
      26 - access("PD"."ID_FLEX_NUM"="X"."ID_FLEX_NUM")
    PLAN_TABLE_OUTPUT
      27 - filter("X"."ID_FLEX_NUM"="PE"."ID_FLEX_NUM" AND "X"."BUSINESS_GROUP_ID"="PE"."BUSINESS_GROUP_
      28 - access("PD"."ANALYSIS_CRITERIA_ID"="PE"."ANALYSIS_CRITERIA_ID")
      29 - filter(DECODE("APPS"."HR_SECURITY"."VIEW_ALL"(),'Y','TRUE',"APPS"."HR_SECURITY"."SHOW_PERSON"
                  ID","SYS_ALIAS_2"."CURRENT_APPLICANT_FLAG","SYS_ALIAS_2"."CURRENT_EMPLOYEE_FLAG","SYS_ALIAS_2
                  S_2"."EMPLOYEE_NUMBER","SYS_ALIAS_2"."APPLICANT_NUMBER","SYS_ALIAS_2"."NPW_NUMBER"))='TRUE' A
                  "SYS_ALIAS_2"."BUSINESS_GROUP_ID"=DECODE("APPS"."HR_GENERAL"."GET_XBG_PROFILE"(),'Y',"SYS_ALI
                  S"."HR_GENERAL"."GET_BUSINESS_GROUP_ID"()))
      30 - access("PE"."PERSON_ID"="SYS_ALIAS_2"."PERSON_ID" AND "SYS_ALIAS_2"."EFFECTIVE_END_DATE">=TRU
                  "SYS_ALIAS_2"."EFFECTIVE_START_DATE"<=TRUNC(SYSDATE@!))
           filter("SYS_ALIAS_2"."EFFECTIVE_START_DATE"<=TRUNC(SYSDATE@!) AND
                  "SYS_ALIAS_2"."EFFECTIVE_END_DATE">=TRUNC(SYSDATE@!) AND "PE"."DATE_FROM"= (SELECT /*+ */ MAX
                  "PA"."PA_TASKS" "PAT3","PA"."PA_TASKS" "PAT2","PA"."PA_TASKS" "PAT1","HR"."PER_ALL_PEOPLE_F"
                  "PAP","PA"."PA_PROJECTS_ALL" "PAP2","PA"."PA_PROJECTS_ALL" "PAP1","APPLSYS"."FND_ID_FLEX_STRU
                  "D","HR"."PER_ALL_ASSIGNMENTS_F" "PAA","HR"."PER_PERSON_ANALYSES" "B","HR"."PER_ANALYSIS_CRIT
                  "A"."ANALYSIS_CRITERIA_ID"="B"."ANALYSIS_CRITERIA_ID" AND "B"."PERSON_ID"="PAA"."PERSON_ID" A
                  "PAA"."PERSON_ID"=:B2 AND "PAA"."PRIMARY_FLAG"='Y' AND DECODE("APPS"."HR_SECURITY"."VIEW_ALL"
                  ITY"."SHOW_RECORD"('PER_ALL_ASSIGNMENTS_F',"PAA"."ASSIGNMENT_ID",TO_CHAR("PAA"."PERSON_ID"),"
                  ' AND "PAA"."BUSINESS_GROUP_ID"=DECODE("APPS"."HR_GENERAL"."GET_XBG_PROFILE"(),'Y',"PAA"."BUS
                  ERAL"."GET_BUSINESS_GROUP_ID"()) AND "PAA"."EFFECTIVE_START_DATE"<=TRUNC(SYSDATE@!) AND
                  "PAA"."EFFECTIVE_END_DATE">=TRUNC(SYSDATE@!) AND "A"."ID_FLEX_NUM"="D"."ID_FLEX_NUM" AND
                  "D"."ID_FLEX_STRUCTURE_CODE"='SEC_STAFF_MOVEMENT' AND "PAP1"."PROJECT_ID"(+)=TO_NUMBER("A"."S
    PLAN_TABLE_OUTPUT
                  "PAP2"."PROJECT_ID"(+)=TO_NUMBER("A"."SEGMENT3") AND "PAP"."PERSON_ID"(+)=TO_NUMBER("A"."SEGM
                  DECODE("APPS"."HR_SECURITY"."VIEW_ALL"(),'Y','TRUE',"APPS"."HR_SECURITY"."SHOW_PERSON"("PAP".
                  APPLICANT_FLAG"(+),"PAP"."CURRENT_EMPLOYEE_FLAG"(+),"PAP"."CURRENT_NPW_FLAG"(+),"PAP"."EMPLOY
                  NUMBER"(+),"PAP"."NPWNUMBER"(+)))='TRUE' AND "PAP"."BUSINESS_GROUP_ID"(+)=DECODE("APPS"."HR
                  'Y',"PAP"."BUSINESS_GROUP_ID"(+),"APPS"."HR_GENERAL"."GET_BUSINESS_GROUP_ID"()) AND
                  "PAP"."EFFECTIVE_START_DATE"(+)<=TRUNC(SYSDATE@!) AND "PAP"."EFFECTIVE_END_DATE"(+)>=TRUNC(SY
                  "PAP"."PERSON_ID"(+)=TO_NUMBER("A"."SEGMENT11") AND DECODE("APPS"."HR_SECURITY"."VIEW_ALL"(),
                  "."SHOW_PERSON"("PAP"."PERSON_ID"(+),"PAP"."CURRENT_APPLICANT_FLAG"(+),"PAP"."CURRENT_EMPLOYE
                  FLAG"(+),"PAP"."EMPLOYEE_NUMBER"(+),"PAP"."APPLICANT_NUMBER"(+),"PAP"."NPW_NUMBER"(+)))='TRUE
                  "PAP"."BUSINESS_GROUP_ID"(+)=DECODE("APPS"."HR_GENERAL"."GET_XBG_PROFILE"(),'Y',"PAP"."BUSINE
                  ERAL"."GET_BUSINESS_GROUP_ID"()) AND "PAP"."EFFECTIVE_START_DATE"(+)<=TRUNC(SYSDATE@!) AND
                  "PAP"."EFFECTIVE_END_DATE"(+)>=TRUNC(SYSDATE@!) AND "PAT1"."TASK_ID"(+)=TO_NUMBER("A"."SEGMEN
                  "PAT2"."TASK_ID"(+)=TO_NUMBER("A"."SEGMENT18") AND "PAT3"."TASK_ID"(+)=TO_NUMBER("A"."SEGMENT
      39 - access("A"."ID_FLEX_NUM"="D"."ID_FLEX_NUM")
      42 - filter("PAA"."PRIMARY_FLAG"='Y' AND DECODE("APPS"."HR_SECURITY"."VIEW_ALL"(),'Y','TRUE',"APPS
                  ECORD"('PER_ALL_ASSIGNMENTS_F',"PAA"."ASSIGNMENT_ID",TO_CHAR("PAA"."PERSON_ID"),"PAA"."ASSIGN
                  "PAA"."BUSINESS_GROUP_ID"=DECODE("APPS"."HR_GENERAL"."GET_XBG_PROFILE"(),'Y',"PAA"."BUSINESS_
                  "GET_BUSINESS_GROUP_ID"()))
      43 - access("PAA"."PERSON_ID"=:B1 AND "PAA"."EFFECTIVE_END_DATE">=TRUNC(SYSDATE@!) AND
                  "PAA"."EFFECTIVE_START_DATE"<=TRUNC(SYSDATE@!))
           filter("PAA"."EFFECTIVE_START_DATE"<=TRUNC(SYSDATE@!) AND "PAA"."EFFECTIVE_END_DATE">=TRUNC(S
    PLAN_TABLE_OUTPUT
      45 - access("B"."PERSON_ID"="PAA"."PERSON_ID")
           filter("B"."PERSON_ID"=:B1)
      47 - access("A"."ANALYSIS_CRITERIA_ID"="B"."ANALYSIS_CRITERIA_ID")
      48 - filter("D"."ID_FLEX_STRUCTURE_CODE"='SEC_STAFF_MOVEMENT')
      49 - access("PAT3"."TASK_ID"(+)=TO_NUMBER("A"."SEGMENT21"))
      50 - access("PAT2"."TASK_ID"(+)=TO_NUMBER("A"."SEGMENT18"))
      51 - access("PAT1"."TASK_ID"(+)=TO_NUMBER("A"."SEGMENT2"))
      52 - access("PAP2"."PROJECT_ID"(+)=TO_NUMBER("A"."SEGMENT3"))
      53 - access("PAP1"."PROJECT_ID"(+)=TO_NUMBER("A"."SEGMENT1"))
      54 - filter(DECODE("APPS"."HR_SECURITY"."VIEW_ALL"(),'Y','TRUE',"APPS"."HR_SECURITY"."SHOW_PERSON"
                  PAP"."CURRENT_APPLICANT_FLAG"(+),"PAP"."CURRENT_EMPLOYEE_FLAG"(+),"PAP"."CURRENT_NPW_FLAG"(+)
                  AP"."APPLICANT_NUMBER"(+),"PAP"."NPW_NUMBER"(+)))='TRUE' AND "PAP"."BUSINESS_GROUP_ID"(+)=DEC
                  BG_PROFILE"(),'Y',"PAP"."BUSINESS_GROUP_ID"(+),"APPS"."HR_GENERAL"."GET_BUSINESS_GROUP_ID"())
      55 - access("PAP"."PERSON_ID"(+)=TO_NUMBER("A"."SEGMENT11") AND "PAP"."EFFECTIVE_END_DATE"(+)>=TRU
                  "PAP"."EFFECTIVE_START_DATE"(+)<=TRUNC(SYSDATE@!))
           filter("PAP"."EFFECTIVE_START_DATE"(+)<=TRUNC(SYSDATE@!) AND "PAP"."EFFECTIVE_END_DATE"(+)>=T
      56 - filter(DECODE("APPS"."HR_SECURITY"."VIEW_ALL"(),'Y','TRUE',"APPS"."HR_SECURITY"."SHOW_PERSON"
                  PAP"."CURRENT_APPLICANT_FLAG"(+),"PAP"."CURRENT_EMPLOYEE_FLAG"(+),"PAP"."CURRENT_NPW_FLAG"(+)
                  AP"."APPLICANT_NUMBER"(+),"PAP"."NPW_NUMBER"(+)))='TRUE' AND "PAP"."BUSINESS_GROUP_ID"(+)=DEC
                  BG_PROFILE"(),'Y',"PAP"."BUSINESS_GROUP_ID"(+),"APPS"."HR_GENERAL"."GET_BUSINESS_GROUP_ID"())
      57 - access("PAP"."PERSON_ID"(+)=TO_NUMBER("A"."SEGMENT4") AND "PAP"."EFFECTIVE_END_DATE"(+)>=TRUN
    PLAN_TABLE_OUTPUT
                  "PAP"."EFFECTIVE_START_DATE"(+)<=TRUNC(SYSDATE@!))
           filter("PAP"."EFFECTIVE_START_DATE"(+)<=TRUNC(SYSDATE@!) AND "PAP"."EFFECTIVE_END_DATE"(+)>=T
      58 - filter("PAA"."PRIMARY_FLAG"='Y' AND DECODE("APPS"."HR_SECURITY"."VIEW_ALL"(),'Y','TRUE',"APPS
                  ECORD"('PER_ALL_ASSIGNMENTS_F',"PAA"."ASSIGNMENT_ID",TO_CHAR("PAA"."PERSON_ID"),"PAA"."ASSIGN
                  "PAA"."BUSINESS_GROUP_ID"=DECODE("APPS"."HR_GENERAL"."GET_XBG_PROFILE"(),'Y',"PAA"."BUSINESS_
                  "GET_BUSINESS_GROUP_ID"()))
      59 - access("SYS_ALIAS_2"."PERSON_ID"="PAA"."PERSON_ID" AND "PAA"."EFFECTIVE_END_DATE">=TRUNC(SYSD
                  "PAA"."EFFECTIVE_START_DATE"<=TRUNC(SYSDATE@!))
           filter("PAA"."EFFECTIVE_START_DATE"<=TRUNC(SYSDATE@!) AND "PAA"."EFFECTIVE_END_DATE">=TRUNC(S
      61 - access("PAA"."ORGANIZATION_ID"="HORG"."ORGANIZATION_ID")
      63 - access("PAA"."JOB_ID"="JOB"."JOB_ID")
      64 - filter("JGR"."INTERNAL_NAME"='HR_'||TO_CHAR("JOB"."BUSINESS_GROUP_ID"))
      65 - access("JOB"."JOB_GROUP_ID"="JGR"."JOB_GROUP_ID")
      67 - access("JBT"."JOB_ID"="JOB"."JOB_ID" AND "JBT"."LANGUAGE"=:B1)
      68 - filter("SYS_ALIAS_1"."PARENT_BUILDING_BLOCK_ID" IS NOT NULL AND "SYS_ALIAS_1"."PARENT_BUILDIN
                  NULL AND "SYS_ALIAS_1"."DATE_FROM"<=SYSDATE@! AND "SYS_ALIAS_1"."DATE_TO">=SYSDATE@!)
      69 - access("SYS_ALIAS_1"."RESOURCE_ID"="SYS_ALIAS_2"."PERSON_ID" AND "SYS_ALIAS_1"."SCOPE"='DETAI
      71 - access("SYS_ALIAS_1"."TIME_BUILDING_BLOCK_ID"="B"."TIME_BUILDING_BLOCK_ID" AND
                  "SYS_ALIAS_1"."OBJECT_VERSION_NUMBER"="B"."TIME_BUILDING_BLOCK_OVN")
      72 - filter("C"."ATTRIBUTE_CATEGORY"='PROJECTS')
      73 - access("B"."TIME_ATTRIBUTE_ID"="C"."TIME_ATTRIBUTE_ID")
    PLAN_TABLE_OUTPUT
      74 - filter("D"."SEGMENT1" LIKE '905%')
      75 - access("D"."PROJECT_ID"=TO_NUMBER("C"."ATTRIBUTE1"))
      76 - filter("PAT"."PROJECT_ID"=TO_NUMBER("C"."ATTRIBUTE1"))
      77 - access("PAT"."TASK_ID"=TO_NUMBER("C"."ATTRIBUTE2"))
      78 - filter("DAY"."PARENT_BUILDING_BLOCK_ID" IS NOT NULL AND "DAY"."PARENT_BUILDING_BLOCK_OVN" IS
                  "DAY"."START_TIME">=:Z AND TRUNC("DAY"."STOP_TIME",'fmdd')<=:Z AND "DAY"."DATE_FROM"<=SYSDATE
                  "DAY"."DATE_TO">=SYSDATE@!)
      79 - access("SYS_ALIAS_1"."PARENT_BUILDING_BLOCK_ID"="DAY"."TIME_BUILDING_BLOCK_ID" AND
                  "SYS_ALIAS_1"."PARENT_BUILDING_BLOCK_OVN"="DAY"."OBJECT_VERSION_NUMBER")
      80 - filter("TIME"."DATE_FROM"<=SYSDATE@! AND "TIME"."DATE_TO">=SYSDATE@!)
      81 - access("DAY"."PARENT_BUILDING_BLOCK_ID"="TIME"."TIME_BUILDING_BLOCK_ID" AND
                  "DAY"."PARENT_BUILDING_BLOCK_OVN"="TIME"."OBJECT_VERSION_NUMBER")
      82 - filter("TIME"."OBJECT_VERSION_NUMBER"="SUMMARY"."TIMECARD_OVN" AND "SUMMARY"."APPROVAL_STATUS
      83 - access("TIME"."TIME_BUILDING_BLOCK_ID"="SUMMARY"."TIMECARD_ID")
      86 - access("B"."TIME_BUILDING_BLOCK_ID"=:B1)
    [\pre]
    Note: cpu costing is off
    Message was edited by:
            user549459                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  

  • How to find out which Tables have been accessed without looking at the SQL query ?

    Hi,
    I would like to know is there a way to find out what queries have been executed and on which tables without looking at the SQL query.
    I have an old C++ code which calls some library functions to access the Oracle database. The source code for the library is not available to me yet. The functions selects/updates/deletes and inserts based on some input parameters I give. I do not know which tables it affects. How do I find out the actual SQL query and/or the tables it accesses ? I was told about V$SQL table that
    has the most recently executed queries, but
    I did'nt see any queries connected to my process.
    Could anybody help me on this ?
    Thanks
    Jagdeep
    [email protected]
    null

    PRECISE/SQL can help you if you have access to it
    2nd option can be that turn on SQL_TRACE
    Run executable of ur c++ program
    it will create a trace file in user_dump_dest
    and then using TKPROF u can see all quesries and their plan also.
    HTH
    Gagan Deep Singh
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by (jagdeeps):
    Hi,
    I would like to know is there a way to find out what queries have been executed and on which tables without looking at the SQL query.
    I have an old C++ code which calls some library functions to access the Oracle database. The source code for the library is not available to me yet. The functions selects/updates/deletes and inserts based on some input parameters I give. I do not know which tables it affects. How do I find out the actual SQL query and/or the tables it accesses ? I was told about V$SQL table that
    has the most recently executed queries, but
    I did'nt see any queries connected to my process.
    Could anybody help me on this ?
    Thanks
    Jagdeep
    [email protected]<HR></BLOCKQUOTE>
    null

  • How to get cm:search to use the max attribute when creating the SQL query?

    When we use the max attribute in the cm:search tag, it does not seem to honor the max attribute when creating the SQL query. However, the result returned from the tag is limited to the number specified by the max attribute. Then the tag seems to work as intended, but the performance will be sub optimal when the SQL query returns unnecessary rows to the application.
    We use the cm:search tag to list the latest news (ordered by date), and with the current implementation we have to expect a decrease in performance over time as more news is published. But we can’t live with that. We need to do the constraint in the SQL query, not in the application.
    The sortBy attribute of cm:search is translated to “order by” in the SQL query, as expected.
    Is it possible to get cm:search to generate the SQL query with an addition of “where rownum <= maxRows”?

    Hi Erik,
    The behavior of a repository in regards to the search tag's max results parameter is dependent on the underlying repository's implementation. That said, the OOTB repository in WLP does augment the generated SQL to limit the number of rows returned from the database. This is done in the parsing logic. This behavior may differ with other repository implementations.
    -Ryan

  • Oracle Apex - when I open a page the sql query runs

    What do I need to change to stop the sql query running when a page is opened in Apex
    the page accepts a value to search a table for relevant data. I have set a default value
    every time I open the page it runs the sql query using the default value

    Does it need a default value?  Why I am asking is, you could add a conditional display to your report region that would not show the report until the item has a value entered by the user..
    Thank you,
    Tony Miller
    LuvMuffin Software
    Salt Lake City, UT

  • The SQL query is not executing

    Hi
    I have the following situation: In a project we designed our reports calling a stored procedure the exits in a MS SQL Server 200 database. The Stored Procedures works fine and when they are used in the report everything works perfectly.
    The reports are being made with CR DEsigner 11, when the designer ends them, ha pass them to me and we put them in our java web application. I open them and even preview them since the Crystal Reprots Perspective of Eclipse and I can see the data, so everything to this point is OK.
    The problem comes when I change of connection, I'm trying to connect every report to the same host and database, and when the reprot is displayed in the browser there is no data. I profile the SQL commands that are executed when the report is requested and I found that the reprot is not executing the stored procedure.
    I guess because i'm connectring the report to the same database and host that was used when the report is created and i'm also passing exactly the same parameters of the stored procedure, then report thinks that it doesn't have executing again becuase it will be the same information.
    SO, i wonder if there is a way to request to the report to execute the sql query every time i have to display it.
    thanks for any help.

    What happens when you try to view the report using a simple viewer.jsp?without changing the connection?
    2009-05-25 14:06:09,250 ERROR com.businessobjects.reports.sdk.JRCCommunicationAdapter -  detected an exception: Error de conexión: [SQLServer 2000 Driver for JDBC]Error establishing socket.
    But the database server is ok, so i think the rpt needs more information to be connect to the database.
    Also what happens if you dont use the data bean and give everything there only?
    The same, the rpt is not executing the stored procedure.
    Did anything change on the RDBMS side? Additional packages, changes to the schema, ownership, etc?
    No, the server is ok and the database is ok.
    If you configure Log4J logging to DEBUG, you should see the database invokes from the Crystal Java engine, specifically the queries sent and the number of rowsets returned. Do you notice any errors?
    I have a problem here with log4j. In my project i'm using spring and with the help of spring i configure log4j, basically with spring is easier to configure log4j.
    I'm telling you this because i have log4j working but when my application reaches the code to change the connection to the rerport, log4j dies and stop sending any message to the stdout or to a log file. I haven't since this behavior in any other app o library. So i want to guess i have something wrong with my log4j or maybe with log4j+spring.
    So, i remove all the code of spring referring to log4j, but the problem with log4j wasn't solved.
    What i will try now is to remove spring from the project.
    This is my log4j.properties:
    log4j.rootLogger=DEBUG, stdout
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n

  • ADF BC / Why bind variables are mandatory in the sql query

    I got this error during view object excecution in the component browser :
    (oracle.jbo.SQLStmtException) JBO-27122: Erreur SQL lors de la préparation d'une instruction. Instruction : SELECT * FROM (Select distinct(socialgroup.socialgroup_i) from socialgroup, socialgroupmember, lodgingallocation, lodge
    where socialgroup.socialgroup_i = socialgroupmember.socialgroup_i and socialgroupmember.t_socialgrouprole_i = t_rolegroup_ipar.fgetflextypologyclassitem_i(t_rolegroup_ipar.fisbeneficiary) and socialgroupmember.datefrom <= :DateTo and nvl(socialgroupmember.dateto, :DateFrom) >= :DateFrom and socialgroupmember.requester_i = lodgingallocation.requester_i and lodgingallocation.datefrom <= :DateTo and nvl(lodgingAllocation.DateTo, :DateFrom) >= :DateFrom and lodgingallocation.lodge_i = lodge.lodge_i) QRSLT ORDER BY "SOCIALGROUP_I"
    ----- LEVEL 1: DETAIL 0-----
    (java.sql.SQLException) Tentative de définition d'un nom de paramètre qui ne se trouve pas dans le SQL: T_SICategory_I
    The bind variables T_SICategory_I is not yet use in the sql query but will be used later so i defined it for the view object.
    Is it a reason that the run time check this ? It would be more convenient to set the bind variables early when defining the view object and add them later during the development iteration.

    Design-time defined named bind variables can be marked as required, or not.
    This is decided by the use in the where clause or in view criteria. In my case the bind variable was not used in where clause neither in view criteria and that causes the error.
    May be i would be nice to add a check box (a flag) that enable or disable the bind variables for this checking so we will be able to let it defined even we removed some part of the query corresponding to the corresponding restriction or we defined it earlier for a part of the query that is not yet defined.
    In my current case i fully defined the bind variables but would refine my query later ... in that cause i would have to remove this bind variable and loose all the definitions to run this view object.
    sorry for my english ...

  • XSU  and CURSOR expression in the sql query

    Platform: oracle 8.X on ibm aix and java client code from
    windows NT.
    JDBC DRIVER: JDBC Oracle thin driver version 1.2.
    when i execute a Sql satement with Cursor expression from the
    java client code with XSU it returns an XML DOM But if the
    CURSOR EXPRESSION IN THE SQL QUERY RETURNS EMPTY ROWS i get
    back an error node with "ORA-01001 Invalid Cursor" error
    message.i had aslo set the setNullAttributes(true) property
    on oraclexmlquery.
    Interestingly, if i exceute the same query in the SQL plus
    it returns the column names with no rows.
    is there any way where i can get xml document with table
    structure, when there are no rows instead of ORA error message.

    Ok.
    I assume that you have for one activity several asset PNR and for one asset several activity.
    The factPNR is on this way a real bridge table. It's a way to be able to design a many-to-many relationship.
    Have a look here for more detail on how to build a many-to-many relationship :
    http://gerardnico.com/wiki/dw/data_quality/relationships#many-to-many
    Therefore I assume that you want this design :
    DimActivity -< FactActivity >- < FactPNR >- DimPNR  and you will have :
    DimActivity -< FactActivity >- < BridgeTable >- DimPNR  How to build your bridge table ?
    In the physical layer, :
    * create a new table BridgeActivityPNR, open it and select "statement"
    * enter your sql statement
    SELECT DISTINCT A.ROW_WID ACTIVIDAD_WID, B.ROW_WID ASSET_WID
    FROM W_ACTIVITY_F A,
    W_ASSET_D B,
    W_SRVREQ_D C,
    X_S_CMPT_MTRC_F D,
    X_S_ASSET_FEA_D E
    WHERE A.X_SRA_SR_ID=C.INTEGRATION_ID AND
    C.X_VLG_FLIGHT_ID=D.X_ROW_ID AND
    D.X_ROW_ID=E.X_CM_ID AND
    E.X_ASSET_ID=B.X_ROW_ID* add two columns in the column tab : ACTIVIDAD_WID and ASSET_WID
    * create the physical join with the table FactActivity and DimPNR
    * drag and drop in the business model your table BridgeActivityPNR
    * in the BMM, create the complex join like this :
    DimActivity -< FactActivity >- < BridgeTable >- DimPNR  * open your logical bridge table and check the bridge table option.
    And you are done if I didn't forget anything.
    A complete example here :
    http://gerardnico.com/wiki/dat/obiee/obiee_bridge_table

  • Modifying the sql query in doDML of entity

    I am using Jdev 11.1.1.4.0 and SQLServer Database
    I want to modify the sql query in "doDML(int operation, TransactionEvent e)"
    I could check what kind of operation like (operation == DML_UPDATE) and do some additional stuff.. But I want to edit the query because of which we entered doDML..
    I want to edit the query because when i use SQLServer database with SQLBuilder as SQL92, the update statement will have table alias like "update table <table alias>" which the SQLServer is not recognizing.. So I want to remove that alias from sql query in doDML..

    It isn't possible.
    However as per the following MSDN page a table alias is fine in an UPDATE statement so are you sure this is your problem?: http://msdn.microsoft.com/en-us/library/aa260662(v=sql.80).aspx
    CM.

  • Report data  does not reflect the SQL Query?

    Hi,
    I have a report which does not seem to be processing all records returned from the database. When I run the SQL Query produced by crystal manually against the SQL Server all data is returned correctly in crystal not. Does this mean my links are not set up correctly in the Database Expert? or is there another issue, I use a Crystal Syntax selection formulae which is based on a couple of paramters to filter the database records.
    Help is appreciated
    K

    <p>I agree with Rahul on checking the record count on the report vs. the record count from the query.  Conditional suppression and Group selection formula will hide records that are actually being returned.</p><p>It sounds like (from your question) that you are using the database linking expert in CR.  You can also check the SQL that CR is sending by going to Database -> Show SQL Query... compare this with the query you are using for validation, this will give you some clues as to whether your linking structure has an issue. </p>

  • Storing the SQL Query results as XML

    Hi All,
    I have a proc to select all the data from emp table and insert into another table. For some reason it inserts only one column and one record.
    I don't have any row limit or skip ...
    CREATE OR REPLACE procedure Convert_Data_Into_XML1
    as
    -- Var Declartion
    qryCtx DBMS_XMLGEN.ctxHandle;
    result CLOB;
    BEGIN
    qryCtx := dbms_xmlgen.newContext('SELECT * from emp');
    -- set the row header to be EMPLOYEE
    DBMS_XMLGEN.setRowTag(qryCtx, 'Employee-ROW');
    DBMS_XMLGEN.setRowsetTag(qryCtx, 'Employee-rowset');
    LOOP
    -- now get the result
    result := DBMS_XMLGEN.getXML(qryCtx);
    DBMS_OUTPUT.PUT_LINE ('In the Loop');
    EXIT WHEN DBMS_XMLGEN.getNumRowsProcessed(qryCtx) = 0;
    INSERT INTO temp_clob_tab VALUES (result);
    END LOOP;
    COMMIT;
    --close context
    DBMS_XMLGEN.closeContext(qryCtx);
    exception
    when others then
    dbms_output.put_line(TO_CHAR(sqlerrm));
    END;
    Basically I got this sample proc from Oracle website. As per the website I should be able to store all the records from emp table.
    How can I debug this.
    Here is the output from SQLPLUS&gt;
    SQL&gt; select result from temp_clob_tab;
    RESULT
    &lt;?xml version="1.0"?&gt;
    &lt;Employee-rowset&gt;
    &lt;Employee-ROW&gt;
    &lt;EMPNO&gt;7369&lt;/EMPNO&gt;
    &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;
    Thanks in advance
    Siva

    I am able to convert the SQL query output and I am able to store it in a XMLTYPE column.
    But the code doesn't work when I took the same code and try to Implement inside a Trigger. The reason I am doing this is, when there is an update or delete, I want to store the whole record as a XMLTYPE doc (before and After). But the code compiles fine, but when I tried to update a record it gives error.
    CREATE OR REPLACE TRIGGER INS_UPDDEV_EMP3_F
    BEFORE UPDATE OR DELETE ON EMP
    FOR EACH ROW
    DECLARE
    V_DBUSER VARCHAR2(50);
    V_CHANGETYPE VARCHAR2(20) := 'INSERT' ;
    QRYCTX DBMS_XMLGEN.CTXHANDLE ;
    OLDVALUE XMLTYPE;
    NEWVALUE XMLTYPE;
    BEGIN
    IF :OLD.EMPNO &lt;&gt; :NEW.EMPNO or DELETING then
    ---------- old Value
    QRYCTX := DBMS_XMLGEN.NEWCONTEXT ('SELECT :OLD.EMPNO, :OLD.ENAME, :OLD.JOB, :OLD.MGR, :OLD.HIREDATE, :OLD.SAL, :OLD.COMM, :OLD.DEPTNO FROM EMP WHERE EMPNO=:OLD.EMPNO ');
    DBMS_XMLGEN.SETROWTAG (QRYCTX, 'DEPTROW');
    DBMS_XMLGEN.SETROWSETTAG(QRYCTX, 'DEPTSET');
    OLDVALUE := XMLTYPE(DBMS_XMLGEN.GETXML(QRYCTX));
    ------------------------- new Value
    QRYCTX := DBMS_XMLGEN.NEWCONTEXT ('Select * WHERE EMPNO=:NEW.EMPNO '); -- WHERE :OLD.EMPNO
         DBMS_XMLGEN.SETROWTAG (QRYCTX, 'DEPTROW');
    DBMS_XMLGEN.SETROWSETTAG(QRYCTX, 'DEPTSET');
    NEWVALUE := XMLTYPE(DBMS_XMLGEN.GETXML(QRYCTX));
    V_CHANGETYPE := 'UPDATE' ;
    INSERT INTO ADM_RECAUDITHISTORY VALUES ('table emp', 'fIELD all', OLDVALUE, OLDVALUE,
    V_CHANGETYPE , SYSDATE, 'TIGER TRIG');
    commit;
    END IF;
    END;
    I am getting the following error while updating the record.
    &gt;&gt;&gt;&gt;
    ERROR at line 1:
    ORA-19206: Invalid value for query or REF CURSOR parameter
    ORA-06512: at "SYS.DBMS_XMLGEN", line 83
    ORA-06512: at "SCOTT.INS_UPDDEV_EMP3_F", line 13
    ORA-04088: error during execution of trigger 'SCOTT.INS_UPDDEV_EMP3_F'
    &gt;&gt;&gt;&gt;&gt;
    Is anyone knows why I am getting this error.
    Thanks
    Siva

  • Limits to the SQL Statement when creating External Dictionaries

    Limits to the SQL Statement when creating External Dictionaries
    Does RC not provide the ability to concatenate multiple db columns into a single dictionary field?  When trying a query like:  SELECT Col1 + Col2 AS NewCol1 FROM Tbl1 we get an error("Unknown internal error") after clicking to save/create the new  dictionary.  This is on version 2008.3

    What if you created a buffer table in your external database, that is populated by your field-merging query, and then invoke that from Newscale? The temporary table would be updatable by newscale (although, presumably, you wouldn't actually have newscale update it), so then it'd accept that connection.
    For example, I think you could do something like that by creating a View in MS SQL Server. Likewise, in other database brands you could create a Trigger that would update the buffer table each time data in the real tables are changed.

  • Overflow the SQL query string buffer

    Hello,
    I have a report that is using a query to determine values for a parameter. In Report Builder everything renders fine, but when I publish the report on the Report Server, it will not render if too many values are entered for the parameter, including "Select
    All". The reason for this behavior is likely due to the number of possible values for the parameter being over 2500. My research has shown that this is causing an overflow of the SQL query string buffer. The obvious fix is to not use that column as a
    parameter, but the power that be are insisting. My system administrator says he can likely increase the buffer size, but has asked me to find out how and where to do that. Any help would be much appreciated.

    Hi CrazyAlligator,
    According to your description, you have more than 2500 values within a parameter. It throws overflow exception when selecting all values. Right?
    Microsoft security update MS11-100 limits the maximum number of form keys, files, and JSON members to
    1000 in an HTTP request. Because of this change, ASP.NET applications reject requests that have more than
    1000 of these elements. HTTP clients that make these kinds of requests will be denied, and an error message will appear in the web browser. The error message will usually have an HTTP 500 status code. This new limit can be configured on a per-application
    basis. Please see the "Resolution" section for configuration instructions. Please refer the KB article:
    https://support2.microsoft.com/kb/2661403?wa=wsignin1.0
    In this scenario, we need add the setting in the web.config file. Please follow the steps below:
    Go to the reporting services installation folder.
    Go to the report server folder and make a backup of the file “Web.config”. Once you have the backup, open the original file in notepad and add the following entry under the Configuration section:
        <appSettings>
                    <add key="aspnet:MaxHttpCollectionKeys" value="10000"/>
        </appSettings>
    Go to the Report Manager folder and again make a backup of the file “Web.config”. Once you have the backup, open the original file in notepad and add the following entry under the appSettings tag:
    <add key="aspnet:MaxHttpCollectionKeys" value="10000"/
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • How to view the sql query?

    hi,
      how to view the sql query formed from the xml structure in the receiver jdbc?

    You can view SAP Note at
    http://service.sap.com/notes
    But you require SMP login ID for this which you should get from your company. The content of the notes are as follows:
    Reason and Prerequisites
    You are looking for additional parameter settings. There are two possible reasons why a feature is available via the "additional parameters" table in the "advanced mode" section of the configuration, but not as documented parameter in the configuration UI itself:
    Category 1: The parameter has been introduced for a patch or a SP upgrade where no UI upgrade and/or documentation upgrade was possible. In this case, the parameter will be moved to the UI and the documentation as soon as possible. The parameter in the "additional parameters" table will be deprecated after this move, but still be working. The parameter belongs to the supported adapter functionality and can be used in all, also productive, scenarios.
    Category 2. The parameter has been introduced for testing purposes, proof-of-concept scenarios, as workaround or as pre-released functionality. In this case, the parameter may or may not be moved to the UI and documentation, and the functionality may be changed, replaced or removed. For this parameter category there is no guaranteed support and usage in productive scenarios is not supported.
    When you want to use a parameter documented here, please be aware to which category it belongs!
    Solution
    The following list shows all available parameters of category 1 or 2. Please note:
    Parameter names are always case-sensitive! Parameter values may be case-sensitive, this is documented for each parameter.
    Parameter names and values as documented below must be used always without quotaton marks ("), if not explicitly stated otherwise.
    The default value of a parameter is always chosen that it does not change the standard functionality
    JDBC Receiver Adapter Parameters
    1. Parameter name: "logSQLStatement"
                  Parameter type: boolean
                  Parameter value: true for any string value, false only for empty string
                  Parameter value default: false (empty String)
                  Available with: SP9
                  Category: 2
                  Description:
                  When implementing a scenario with the JDBC receiver adapter, it may be helpful to see which SQL statement is generated by the JDBC adapter from the XI message content for error analysis. Before SP9, this can only be found in the trace of the JDBC adapter if trace level DEBUG is activated. With SP9, the generated SQL statement will be shown in the details page (audit protocol) of the message monitor for each message directly.
                  This should be used only during the test phase and not in productive scenarios.
    Regards,
    Prateek

  • Find out the sql query for special characters.

    Hi,
    I have the emp table with column name first_name.In that table i have lot records with first_name inlcudes the below mentioned special characters.
    ¡ , ¿, ,Ä,Å,ä,ª,À,Á,Ã,à,á,ã,å,Æ,æ,Ç,ç,È,É,Ê,Ë,è,é,ê,ë,Ì,Í,Î, Ï,ì,í,î,ï, Ñ,ñ, ô, º, Ò, Ó, Ô, Õ, Ö, Ø, ò, ó, õ, ö, ø, ß, Û, Ù, Ú, Ü,ù, ú, û, ü, ÿ,
    I am looking for the records with includes the above mentioned special characters in the first_name column.
    Can u please give the sql query to find out the records.
    Thanks&Regards
    N.Sivaraman

    I am looking for the records with includes the above mentioned special characters in the first_name column.One way would be:
    select emp.*
      from emp,
           table (
             sys.odcivarchar2list ('¡',
                                   'Ä',
                                   'Å',
                                   'ä',
                                   'ª',
                                   'À',
                                   'Á',
                                   'Ã',
                                   'à',
                                   'á',
                                   'ã',
                                   'å',
                                   'Æ',
                                   'æ',
                                   'Ç',
                                   'ç',
                                   'È',
                                   'É',
                                   'Ê',
                                   'Ë',
                                   'è',
                                   'é',
                                   'ê',
                                   'ë',
                                   'Ì',
                                   'Í',
                                   'Î',
                                   'Ï',
                                   'ì',
                                   'í',
                                   'î',
                                   'ï',
                                   'Ñ',
                                   'ñ',
                                   'ô',
                                   'º',
                                   'Ò',
                                   'Ó',
                                   'Ô',
                                   'Õ',
                                   'Ö',
                                   'Ø',
                                   'ò',
                                   'ó',
                                   'õ',
                                   'ö',
                                   'ø',
                                   'ß',
                                   'Û',
                                   'Ù',
                                   'Ú',
                                   'Ü',
                                   'ù',
                                   'ú',
                                   'û',
                                   'ü',
                                   'ÿ'
    where instr (ename, column_value) > 0

Maybe you are looking for

  • Can't download/watch images, videos, files, websites...

    Hello, My problem started 2 days ago when i switched internet (from my parents house to my room close to school). Immediately these problems occurred: * Very slow internet (with moments) * I have to reload websites 3-10 or more times until i can view

  • Join engine stop

    I have a problem with Join engine. It stop sometimes whithout logs, .... I have a Windows 2000 server.

  • Numbers crash on launch

    Hi, today I have tried to launch NUMBERS but my application didn't start; not a very crash but Numbers remain in stand-by and didn't start; I have tried to solve problem with SHIFT button, then REPAIR permission on disk. Last action was uninstall on

  • Wifi connected but no internet

    All of a sudden i was watching hulu and it went to 'there is no java enabled for the ads' than i refreshed and tried to to go google and no connection, my laptop was connected at the same time with no issues. I restarted and still it connects but no

  • How to nat subnets before establishing site to site ipsec vpn tunnel?

    Hello, Coming across requirement which is new to me as I have not done this setup. Details as follows. Hope some1 can help. Requirement: nat existing subnets to 192.168.50.0/24 subnet which is allowed at another firewall. Existing device: Cisco 5510