Rule hint based query being fired by DB in AWR rpt ??

I am looking into AWR report and i see the below sql statment being executed 58000 in 5 hour period...
the application guy said, its not being fired from the app....is the making making some
recursive calls or what ??? as its a pretty big amount of time that its being fired...
and also this is a 10.2.0.3 database ....why would it use the rule hint if its being fired
by the database ?? below is the query....
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

funny thing we do have a user called DBSNMP on our database and we do not have grid control agent on it either...or even database control...then why we getting this sql ???
$ ./emctl status agent
EM Configuration issue. /oracle/app/product/10.2.0/xxxxxxx_nimsprod not found.

Similar Messages

  • Rule based query

    Hi all,
    please forward information about Rule Based Query, actually i am nott getting what is rule based query, please help me out....
    Thanks and Regards,
    Santosh

    rule based optimizer is a older technique and cannot be used efficiently to optimize a query, now -a- days only cost based optimization would be effective and these are categories under which a query can be tuned. usually explain plan on a query would fetch you the rule or cost based information....Thank you

  • Use of an Oracle Hint for a WebI-Universe BEX based-Query  ?

    Hi,
    can I use an Oracle Optimizer Hint like /*+ PARALLEL(MyFacttable, 8) */
    for a WebI- ./. Universe- ./.  BEX based-Query ?
    Is this possible  ?
    If Yes: How and where to implement this  ?
    Thank You !
    Martin

    Hi,
    BusinessObjects only communictates with the MDX Interface by way of SAP's OLAP BAPI over RFC.
    Everything else, OLAP engine, Data Manager, etc etc Cube abstraction over a Relational schema is handled by the BW application.
    so No, BO can't "inject" any cleverness into BW processing architecture.
    Regards,
    H

  • RULE HINT 11.2

    Version Details
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE 11.2.0.3.0 Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    I have inherited this code in a package and was looking at the explain plan contains a Hint that is RULE , the database is 11.2 is it still valid, can anyone give me some advice on how to improve the below query?
    | Id  | Operation                        | Name                       |
    |   0 | SELECT STATEMENT                 |                            |
    |   1 |  SORT AGGREGATE                  |                            |
    |*  2 |   INDEX RANGE SCAN               | PARCEL_HISTORY_HOLDING_PF1 |
    |   3 |  NESTED LOOPS OUTER              |                            |
    |   4 |   NESTED LOOPS OUTER             |                            |
    |   5 |    NESTED LOOPS OUTER            |                            |
    |*  6 |     FILTER                       |                            |
    |   7 |      NESTED LOOPS OUTER          |                            |
    |   8 |       TABLE ACCESS BY INDEX ROWID| PARCEL_HISTORY_HOLDING     |
    |   9 |        INDEX FULL SCAN           | PARCEL_HISTORY_HOLDING_PF1 |
    |  10 |       TABLE ACCESS BY INDEX ROWID| PARCELS                    |
    |* 11 |        INDEX UNIQUE SCAN         | PARCELS_PK                 |
    |  12 |     TABLE ACCESS BY INDEX ROWID  | PARCEL_ADDRESSES           |
    |* 13 |      INDEX UNIQUE SCAN           | PARCEL_ADDRESSES_PK        |
    |  14 |    TABLE ACCESS BY INDEX ROWID   | PARCEL_ADDRESSES           |
    |* 15 |     INDEX UNIQUE SCAN            | PARCEL_ADDRESSES_PK        |
    |* 16 |   INDEX UNIQUE SCAN              | PARCEL_HISTORY_PIVOT_PK    |
    Predicate Information (identified by operation id):
       2 - access("PH"."PARCEL_ID"=:B1)
       6 - filter("P"."PARCEL_ID" IS NOT NULL)
      11 - access("PHH"."PARCEL_ID"="P"."PARCEL_ID"(+))
      13 - access("PAC"."PARCEL_ID"(+)="P"."PARCEL_ID" AND
                  "PAC"."ADDRESS_TYPE"(+)='COL')
      15 - access("PAD"."PARCEL_ID"(+)="P"."PARCEL_ID" AND
                  "PAD"."ADDRESS_TYPE"(+)='DEL')
      16 - access("PHH"."PARCEL_ID"="PP"."PARCEL_ID"(+))
    Note
       - rule based optimizer used (consider using cbo)
    QUERY
         SELECT   /*+ rule */
                         phh.ROWID tabrow
                        ,phh.parcel_id
                        ,phh.scan_date
                        ,phh.status_code
                        ,phh.reason_code
                        ,phh.app_code
                        ,phh.scan_id
                        ,phh.location_code
                        ,phh.card_id
                        ,phh.signature_captured
                        ,phh.signature_reference
                        ,phh.geo_latitude
                        ,phh.geo_longitude
                        ,phh.geo_date
                        ,phh.geo_signal_strength
                        ,phh.app_create_date
                        ,phh.e2e_create_date
                        ,phh.driver_comments
                        ,p.client_account
                        ,p.client_contract
                        ,p.courier_type
                        ,p.service_code
                        ,p.col_depot
                        ,p.col_tour
                        ,p.del_depot
                        ,p.del_tour
                        ,p.traffic_type
                        ,p.signature_reqd
                        ,p.nom_del_date
                        ,p.exp_del_channel
                        ,p.exp_del_tour
                        ,p.exp_del_date
                        ,p.exp_col_tour
                        ,p.exp_col_date
                        ,pad.geo_latitude del_geo_latitude
                        ,pad.geo_longitude del_geo_longitude
                        ,pad.post_code delivery_postcode
                        ,pac.post_code collection_postcode
                        ,CASE
                             WHEN phh.scan_date =
                                               (SELECT MIN (scan_date)
                                                  FROM parcel_history_holding ph
                                                 WHERE ph.parcel_id = phh.parcel_id)
                             AND pp.parcel_id IS NULL THEN 1
                             ELSE 0
                         END not_in_pp_insert_flag
                        ,get_tt_status (app_code, status_code || reason_code)
                                                                          tt_status_reason
                FROM     parcel_history_holding phh
                        ,parcel_history_pivot pp
                        ,parcels p
                        ,parcel_addresses pad
                        ,parcel_addresses pac
                   WHERE phh.parcel_id = pp.parcel_id(+)
                     AND phh.parcel_id = p.parcel_id(+)
                     AND pad.parcel_id(+) = p.parcel_id
                     AND pad.address_type(+) = 'DEL'
                     AND pac.parcel_id(+) = p.parcel_id
                     AND pac.address_type(+) = 'COL'
                   --  AND p_thread = pkg_utils.get_thread (phh.parcel_id, v_num_threads)
                     AND p.parcel_id IS NOT NULL
                ORDER BY phh.parcel_id
                        ,phh.scan_date;

    As Manik shows with the documentation link, the RULE hint was deprecated ages ago, especially with the CBO becoming the prominent optimizer in 10g.
    And as oracle no longer support Rule based optimization, you could end up with odd 'side effects' if you use it.
    Optimizer hints are something you shouldn't really be using in production code anyway...
    Comments
    Hints were introduced in Oracle7, when users had little recourse if the optimizer generated suboptimal plans. Now Oracle provides a number of tools, including the SQL Tuning Advisor, SQL plan management, and SQL Performance Analyzer, to help you address performance problems that are not solved by the optimizer. Oracle strongly recommends that you use those tools rather than hints. The tools are far superior to hints, because when used on an ongoing basis, they provide fresh solutions as your data and database environment change.
    Hints should be used sparingly, and only after you have collected statistics on the relevant tables and evaluated the optimizer plan without hints using the EXPLAIN PLAN statement. Changing database conditions as well as query performance enhancements in subsequent releases can have significant impact on how hints in your code affect performance.
    (my highlight)

  • SQL 문장이 RULE 에서 COST-BASED로 전환되는 경우

    제품 : ORACLE SERVER
    작성날짜 : 2004-05-28
    SQL 문장이 RULE에서 COST-BASED로 전환되는 경우
    ==============================================
    PURPOSE
    SQL statement 문장이 자동으로 cost-based mode로 전환되는 경우에 대해
    알아보자.
    Explanation
    Rule-based mode에서 sql statement를 실행하더라도 Optimizer에 의해
    cost-based mode로 전환되는 경우가 있다.
    이런 경우는 해당 SQL이 아래와 같은 경우로 사용되는 경우 가능하다.
    - Partitioned tables
    - Index-organized tables
    - Reverse key indexes
    - Function-based indexes
    - SAMPLE clauses in a SELECT statement
    - Parallel execution and parallel DML
    - Star transformations
    - Star joins
    - Extensible optimizer
    - Query rewrite (materialized views)
    - Progress meter
    - Hash joins
    - Bitmap indexes
    - Partition views (release 7.3)
    - Hint (RULE 또는 DRIVING_SITE제외한 Hint가 왔을경우)
    - FIRST_ROWS,ALL_ROWS Optimizer의 경우는 통계정보가 없어도 CBO로 동작
    - TABLE 또는 INDEX에 Parallel degree가 설정되어 있거나,
    INSTANCE가 설정되어 있는 경우(DEFAULT도 해당)
    - Table에 domain index(Text index등) 이 생성되어 있는 경우

  • Cost Based Query

    i have removed the RULE hints and tried the below query in 2 different databases both same version(10g)
    In one of the database query completed in 4hrs and in another database it completed in 3 days.
    Both databases has similar data.
    where i am doing wrong?
    Any feeedbacks?
    Any optimizer parameters needs to be set?
    lect /*+ RULE */ 'PO_COMMITMENT' record_type,
    b.org_id,
    NULL invoice_number,
    a.PO_NUMBER,
    a.PO_REVISION,
    a.RELEASE_NUMBER,
    a.CREATION_DATE,
    a.APPROVED_DATE,
    b.NEED_BY_DATE,
    b.PROMISED_DATE,
    a.BUYER_NAME,
    a.VENDOR_NAME,
    a.PO_LINE,
    replace(a.ITEM_DESCRIPTION, chr(10),' ') item_description,
    a.QUANTITY_ORDERED,
    a.AMOUNT_ORDERED,
    a.QUANTITY_CANCELLED,
    a.AMOUNT_CANCELLED,
    a.QUANTITY_DELIVERED,
    a.AMOUNT_DELIVERED,
    a.QUANTITY_INVOICED ,
    a.AMOUNT_INVOICED*nvl(pod.rate,1) AMOUNT_INVOICED,
    a.Amount_outstanding_invoice,
    a.PROJECT_ID,
    a.TASK_ID,
    a.EXPENDITURE_ITEM_DATE,
    a.ACCT_EXCHANGE_RATE,
    a.denom_CURRENCY_CODE,
    a.PO_HEADER_ID,
    a.PO_RELEASE_ID,
    pod.po_line_id REQUISITION_HEADER_ID,
    a.po_line_location_id REQUISITION_LINE_ID ,
    pod.po_distribution_id invoice_id,
    EXPENDITURE_ORGANIZATION ,
    null po_status,
    pod.accrue_on_receipt_flag po_line_status,
    null requisioner_name,
    0 commitment_amt,
    pod.po_header_id xpo_header_id,
    pod.po_distribution_id xpo_distribution_id,
    pod.distribution_num DISTRIBUTION_LINE_NUMBER
    from pa_proj_appr_po_distributions a,
    po_distributions pod,
    po_line_locations b
    where a.PO_LINE_LOCATION_ID = b.LINE_LOCATION_ID
    and a.po_distribution_id = pod.po_distribution_id
    and b.line_location_id = pod.line_location_id
    and b.org_id = :p_org_id
    and a.project_id > 0
    UNION ALL
    SELECT /*+ RULE */ 'REQ_COMMITMENT' ,
    :p_org_id,
    NULL,
    REQ_NUMBER ,
    NULL ,
    NULL,
    CREATION_DATE ,
    to_date(null),
    NEED_BY_DATE ,
    to_date(null),
    null,
    vendor_name,
    REQ_LINE ,
    replace(ITEM_DESCRIPTION, chr(10), ' '),
    QUANTITY ,
    AMOUNT ,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    PROJECT_ID ,
    TASK_ID ,
    EXPENDITURE_ITEM_DATE ,
    ACCT_EXCHANGE_RATE ,
    denom_CURRENCY_CODE,
    0,
    0,
    REQUISITION_HEADER_ID,
    REQUISITION_LINE_ID ,
    0 invoice_id,
    EXPENDITURE_ORGANIZATION ,
    null po_status,
    null po_line_status,
    REQUESTOR_NAME requisioner_name,
    AMOUNT ,
    0,
    0,
    0 DISTRIBUTION_LINE_NUMBER
    FROM pa_proj_appr_req_distributions
    union all
    select /*+ RULE */ 'INVOICE_COMMITMENT' ,
    :p_org_id,
    b.INVOICE_NUM,
    NULL,
    NULL,
    NULL,
    b.creation_date,
    a.INVOICE_DATE,
    a.GL_DATE ,
    to_date(null),
    NULL,
    a.VENDOR_NAME,
    0,
    replace(a.DESCRIPTION,chr(10),' '),
    0,
    0,
    0,
    0,
    0,
    0,
    a.QUANTITY,
    a.AMOUNT ,
    0,
    a.PROJECT_ID ,
    a.TASK_ID ,
    a.EXPENDITURE_ITEM_DATE ,
    a.ACCT_EXCHANGE_RATE ,
    a.denom_CURRENCY_CODE ,
    0,
    0,
    aid.po_distribution_id,
    aid.invoice_distribution_id,
    a.invoice_id,
    a.EXPENDITURE_ORGANIZATION ,
    null,
    null,
    null,
    a.amount ,
    0,
    0,
    a.DISTRIBUTION_LINE_NUMBER
    FROM
    pa_proj_ap_inv_distributions a,
    ap_invoices b,
    ap_invoice_distributions aid
    where a.invoice_id = b.invoice_id
    and aid.invoice_id = b.invoice_id
    and a.distribution_line_number = aid.distribution_line_number

    Hello,
    It's duplicate post, please close this and provide requested information in your previous post.
    Regards

  • Regarding RULE Hint Removal

    Hi ..
    We have an application having 40+ SQL's using RULE Hint. (11g R2).
    Now we have a plan to upgrade to 12c and we want to come out of these RULE Hints.
    Anyone faced similar kind of issue? what are do's and don't do's to remove RULE Hint. Please advise.
    Thank you!
    Regards
    Siva
    Edited by: 985936 on Feb 4, 2013 3:33 AM

    It looks like the /*+ RULE */ hint can still have an impact in 11.2.0.3:
    07:23:12 SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for Solaris: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    5 rows selected.
    Elapsed: 00:00:00.04
    07:23:20 SQL> create table test_rule_optimizer  as select * from dba_objects;
    Table created.
    Elapsed: 00:00:03.04
    07:23:23 SQL> create index TEST_RULE_OPTIMIZER_IDX on TEST_RULE_OPTIMIZER(object_type, owner, object_name);
    Index created.
    Elapsed: 00:00:01.32
    07:23:24 SQL>
    07:23:24 SQL> begin
    07:23:25   2    dbms_stats.gather_table_stats(ownname => user, tabname => 'TEST_RULE_OPTIMIZER');
    07:23:25   3  end;
    07:23:25   4  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:03.91
    07:23:29 SQL>
    07:23:45 SQL> set autotrace on
    07:23:45 SQL> --
    07:23:45 SQL> -- Choosing these object types because they comprise over 50% of the objects in my table
    07:23:45 SQL> select count(*), max(last_ddl_time)
    07:23:45   2  from TEST_RULE_OPTIMIZER
    07:23:45   3  where object_type in ('INDEX','SYNONYM','INDEX PARTITION','LOB PARTITION');
      COUNT(*) MAX(LAST_DDL_TIME)
        136189 2013/02/04 04:17:04
    1 row selected.
    Elapsed: 00:00:00.12
    Execution Plan
    Plan hash value: 166585403
    | Id  | Operation          | Name                | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |                     |     1 |    19 |  1078   (2)| 00:00:01 |
    |   1 |  SORT AGGREGATE    |                     |     1 |    19 |            |          |
    |*  2 |   TABLE ACCESS FULL| TEST_RULE_OPTIMIZER | 19721 |   365K|  1078   (2)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - filter("OBJECT_TYPE"='INDEX' OR "OBJECT_TYPE"='INDEX PARTITION' OR
                  "OBJECT_TYPE"='LOB PARTITION' OR "OBJECT_TYPE"='SYNONYM')
    Statistics
              1  recursive calls
              0  db block gets
           3850  consistent gets
              0  physical reads
              0  redo size
            275  bytes sent via SQL*Net to client
            248  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    07:23:46 SQL>
    07:23:46 SQL> select /*+ rule */ count(*), max(last_ddl_time)
    07:23:46   2  from TEST_RULE_OPTIMIZER
    07:23:46   3  where object_type in ('INDEX','SYNONYM','INDEX PARTITION','LOB PARTITION');
      COUNT(*) MAX(LAST_DDL_TIME)
        136189 2013/02/04 04:17:04
    1 row selected.
    Elapsed: 00:00:00.29
    Execution Plan
    Plan hash value: 316642056
    | Id  | Operation                     | Name                    |
    |   0 | SELECT STATEMENT              |                         |
    |   1 |  SORT AGGREGATE               |                         |
    |   2 |   CONCATENATION               |                         |
    |   3 |    TABLE ACCESS BY INDEX ROWID| TEST_RULE_OPTIMIZER     |
    |*  4 |     INDEX RANGE SCAN          | TEST_RULE_OPTIMIZER_IDX |
    |   5 |    TABLE ACCESS BY INDEX ROWID| TEST_RULE_OPTIMIZER     |
    |*  6 |     INDEX RANGE SCAN          | TEST_RULE_OPTIMIZER_IDX |
    |   7 |    TABLE ACCESS BY INDEX ROWID| TEST_RULE_OPTIMIZER     |
    |*  8 |     INDEX RANGE SCAN          | TEST_RULE_OPTIMIZER_IDX |
    |   9 |    TABLE ACCESS BY INDEX ROWID| TEST_RULE_OPTIMIZER     |
    |* 10 |     INDEX RANGE SCAN          | TEST_RULE_OPTIMIZER_IDX |
    Predicate Information (identified by operation id):
       4 - access("OBJECT_TYPE"='LOB PARTITION')
       6 - access("OBJECT_TYPE"='INDEX PARTITION')
       8 - access("OBJECT_TYPE"='SYNONYM')
      10 - access("OBJECT_TYPE"='INDEX')
    Note
       - rule based optimizer used (consider using cbo)
    Statistics
              1  recursive calls
              0  db block gets
          37884  consistent gets
              3  physical reads
              0  redo size
            276  bytes sent via SQL*Net to client
            248  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              1  rows processed
    07:23:46 SQL>
    07:23:47 SQL>

  • Replacement for 'Rule' hint in 10g

    Hi,
    We have upgraded database from 9i to 10g. We have some sql queries which are using 'RULE' hints, but 10g is not supporting 'RULE' hints, can you please suggest me any replacement hint for 'RULE' hint in 10g or alternative ways to tune the sql query so that it will work same as 9i in 10g also in performance.
    Kindly help me.
    Thanks

    Query:
    SELECT HOU.NAME EMPRESA,
    PAPF.FULL_NAME COMPRADOR,
    NVL(SUBSTR(CAEV.DE_CODE, 1, 10), ' ') DE_COMPRADOR,
    NVL(SUBSTR(CAEV.DI_CODE, 1, 10), ' ') DI_COMPRADOR,
    NVL(SUBSTR(CAEV.GG_CODE, 1, 10), ' ') GG_COMPRADOR,
    NVL(SUBSTR(CAEV.GA_CODE, 1, 10), ' ') GA_COMPRADOR,
    PH.SEGMENT1 ORDEM_COMPRA,
    PV.VENDOR_NAME FORNECEDOR,
    DECODE(PVSA.GLOBAL_ATTRIBUTE9,
    1,
    PVSA.GLOBAL_ATTRIBUTE10 || '' || PVSA.GLOBAL_ATTRIBUTE12,
    2,
    PVSA.GLOBAL_ATTRIBUTE10 || '' || PVSA.GLOBAL_ATTRIBUTE11 || '' ||
    PVSA.GLOBAL_ATTRIBUTE12,
    3,
    LPAD(PV.SEGMENT1 || REPLACE(PVSA.VENDOR_SITE_CODE, '-', ''),
    15,
    '0'),
    PVSA.GLOBAL_ATTRIBUTE10 || '' || PVSA.GLOBAL_ATTRIBUTE11 || '' ||
    PVSA.GLOBAL_ATTRIBUTE12) CNPJ,
    PVSA.VENDOR_SITE_CODE LOCAL,
    REPLACE(REPLACE(REPLACE(REPLACE(PH.COMMENTS, CHR(13) || CHR(10) || CHR(9), ' '),
    CHR(9), ' '), CHR(10), ' '), '#', '')
    DESCRIÇÃO,
    (SELECT LAST_NAME
    FROM APPS.PER_PEOPLE_F
    WHERE EMPLOYEE_NUMBER = PH.ATTRIBUTE1
    AND EFFECTIVE_END_DATE >= SYSDATE) GESTOR_DO_CONTRATO,
    NVL(SUBSTR(CAEV2.DE_CODE, 1, 10), ' ') DE_GESTOR,
    NVL(SUBSTR(CAEV2.DI_CODE, 1, 10), ' ') DI_GESTOR,
    NVL(SUBSTR(CAEV2.GG_CODE, 1, 10), ' ') GG_GESTOR,
    NVL(SUBSTR(CAEV2.GA_CODE, 1, 10), ' ') GA_GESTOR,
    NVL(CAEV2.GA_NOME, ' ') GA_NOME,
    PDT.TYPE_NAME TIPO,
    TO_CHAR(PH.START_DATE, 'DD/MM/YYYY') DATA_INICIAL_EFETIVAÇÃO,
    TO_CHAR(PH.END_DATE, 'DD/MM/YYYY') DATA_FINAL_EFETIVAÇÃO,
    NVL(PH.CLOSED_CODE, 'OPEN') STATUS_DO_FECHAMENTO,
    PH.BLANKET_TOTAL_AMOUNT VALOR_DO_CONTRATO,
    (SELECT EMAIL_ADDRESS
    FROM APPS.PER_PEOPLE_F
    WHERE EMPLOYEE_NUMBER = PH.ATTRIBUTE1
    AND EFFECTIVE_END_DATE >= SYSDATE) EMAIL_GESTOR_DO_CONTRATO
    ,FLV.MEANING STATUS_DA_APROVAÇÃO
    ,NVL((SELECT MCB.SEGMENT1 || '.' ||
    MCB.SEGMENT2 || '.' ||
    MCB.SEGMENT3 || '.' ||
    MCB.SEGMENT4 || '.' ||
    MCB.SEGMENT5
    FROM PO.PO_HEADERS_ALL PAI,
    PO.PO_HEADERS_ALL FILHO,
    PO.PO_LINES_ALL PLA,
    INV.MTL_CATEGORIES_B MCB
    WHERE MCB.CATEGORY_ID = PLA.CATEGORY_ID
    AND PAI.TYPE_LOOKUP_CODE = 'CONTRACT'
    AND PLA.CONTRACT_ID = PAI.PO_HEADER_ID
    AND PLA.PO_HEADER_ID = FILHO.PO_HEADER_ID
    AND PAI.PO_HEADER_ID = PH.PO_HEADER_ID
    AND NVL(PLA.CANCEL_FLAG, 'N') = 'N'
    AND MCB.SEGMENT1 = 'SV'
    AND ROWNUM = 1) ,
    (SELECT MCB.SEGMENT1 || '.' ||
    MCB.SEGMENT2 || '.' ||
    MCB.SEGMENT3 || '.' ||
    MCB.SEGMENT4 || '.' ||
    MCB.SEGMENT5
    FROM PO.PO_HEADERS_ALL PAI,
    PO.PO_HEADERS_ALL FILHO,
    PO.PO_LINES_ALL PLA,
    INV.MTL_CATEGORIES_B MCB
    WHERE MCB.CATEGORY_ID = PLA.CATEGORY_ID
    AND PAI.TYPE_LOOKUP_CODE = 'CONTRACT'
    AND PLA.CONTRACT_ID = PAI.PO_HEADER_ID
    AND PLA.PO_HEADER_ID = FILHO.PO_HEADER_ID
    AND PAI.PO_HEADER_ID = PH.PO_HEADER_ID
    AND NVL(PLA.CANCEL_FLAG, 'N') = 'N'
    AND MCB.SEGMENT1 = 'SE'
    AND ROWNUM = 1)) CATEGORIA,
    PH.ATTRIBUTE2 TIPO_DE_CONTRATO
    FROM ---
    (SELECT DISTINCT
    PAPF.PERSON_ID,
    PAPF.EMPLOYEE_NUMBER,
    PAPF.FULL_NAME,
    PAPF.EMAIL_ADDRESS,
    HAOU_GA.ATTRIBUTE10 GA_CODE,
    HAOU_GA.ATTRIBUTE11 GA_NOME,
    HAOU_GG.ATTRIBUTE10 GG_CODE,
    HAOU_GG.ATTRIBUTE11 GG_NOME,
    HAOU_DI.ATTRIBUTE10 DI_CODE,
    HAOU_DI.ATTRIBUTE11 DI_NOME,
    HAOU_DE.ATTRIBUTE10 DE_CODE,
    HAOU_DE.ATTRIBUTE11 DE_NOME
    FROM APPS.PER_ALL_PEOPLE_F PAPF,
    APPS.PER_ALL_ASSIGNMENTS_F PAAP,
    APPS.PER_ALL_POSITIONS PAP,
    APPS.HR_ALL_ORGANIZATION_UNITS HAOU_GA,
    APPS.HR_ALL_ORGANIZATION_UNITS HAOU_GG,
    APPS.HR_ALL_ORGANIZATION_UNITS HAOU_DI,
    APPS.HR_ALL_ORGANIZATION_UNITS HAOU_DE
    WHERE PAPF.PERSON_ID = PAAP.PERSON_ID
    AND PAAP.POSITION_ID = PAP.POSITION_ID(+)
    AND PAPF.EFFECTIVE_END_DATE = TO_DATE('31/12/4712', 'DD/MM/YYYY')
    AND PAAP.EFFECTIVE_END_DATE = TO_DATE('31/12/4712', 'DD/MM/YYYY')
    AND SUBSTR(PAP.NAME, 1, 12) = HAOU_GA.ATTRIBUTE9 (+)
    AND SUBSTR(PAP.NAME, 1, 10) = HAOU_GG.ATTRIBUTE9 (+)
    AND SUBSTR(PAP.NAME, 1, 8) = HAOU_DI.ATTRIBUTE9 (+)
    AND SUBSTR(PAP.NAME, 1, 6) = HAOU_DE.ATTRIBUTE9 (+)) CAEV2,
    APPS.PO_VENDORS PV,
    APPS.PO_VENDOR_SITES_ALL PVSA,
    APPS.PER_ALL_PEOPLE_F PAPF,
    APPS.PO_DOCUMENT_TYPES_ALL_TL PDT,
    APPS.HR_ALL_ORGANIZATION_UNITS HOU,
    (SELECT DISTINCT
    PAPF.PERSON_ID,
    PAPF.EMPLOYEE_NUMBER,
    PAPF.FULL_NAME,
    PAPF.EMAIL_ADDRESS,
    HAOU_GA.ATTRIBUTE10 GA_CODE,
    HAOU_GA.ATTRIBUTE11 GA_NOME,
    HAOU_GG.ATTRIBUTE10 GG_CODE,
    HAOU_GG.ATTRIBUTE11 GG_NOME,
    HAOU_DI.ATTRIBUTE10 DI_CODE,
    HAOU_DI.ATTRIBUTE11 DI_NOME,
    HAOU_DE.ATTRIBUTE10 DE_CODE,
    HAOU_DE.ATTRIBUTE11 DE_NOME
    FROM APPS.PER_ALL_PEOPLE_F PAPF,
    APPS.PER_ALL_ASSIGNMENTS_F PAAP,
    APPS.PER_ALL_POSITIONS PAP,
    APPS.HR_ALL_ORGANIZATION_UNITS HAOU_GA,
    APPS.HR_ALL_ORGANIZATION_UNITS HAOU_GG,
    APPS.HR_ALL_ORGANIZATION_UNITS HAOU_DI,
    APPS.HR_ALL_ORGANIZATION_UNITS HAOU_DE
    WHERE PAPF.PERSON_ID = PAAP.PERSON_ID
    AND PAAP.POSITION_ID = PAP.POSITION_ID(+)
    AND PAPF.EFFECTIVE_END_DATE = TO_DATE('31/12/4712', 'DD/MM/YYYY')
    AND PAAP.EFFECTIVE_END_DATE = TO_DATE('31/12/4712', 'DD/MM/YYYY')
    AND SUBSTR(PAP.NAME, 1, 12) = HAOU_GA.ATTRIBUTE9 (+)
    AND SUBSTR(PAP.NAME, 1, 10) = HAOU_GG.ATTRIBUTE9 (+)
    AND SUBSTR(PAP.NAME, 1, 8) = HAOU_DI.ATTRIBUTE9 (+)
    AND SUBSTR(PAP.NAME, 1, 6) = HAOU_DE.ATTRIBUTE9 (+)) CAEV,
    APPS.PO_HEADERS_ALL PH,
    APPS.FND_LOOKUP_VALUES FLV
    WHERE PV.VENDOR_ID(+) = PH.VENDOR_ID
    AND PVSA.VENDOR_ID(+) = PH.VENDOR_ID
    AND PVSA.VENDOR_SITE_ID(+) = PH.VENDOR_SITE_ID
    AND PVSA.GLOBAL_ATTRIBUTE9 <> 1
    AND PAPF.EFFECTIVE_END_DATE > SYSDATE
    AND PAPF.PERSON_ID(+) = PH.AGENT_ID
    AND PH.AGENT_ID = CAEV.PERSON_ID(+)
    AND PH.ATTRIBUTE1 = CAEV2.EMPLOYEE_NUMBER(+)
    AND PDT.LANGUAGE = 'PTB'
    AND PDT.ORG_ID(+) = PH.ORG_ID
    AND PDT.DOCUMENT_TYPE_CODE IN ('PO', 'PA')
    AND PDT.DOCUMENT_SUBTYPE(+) = PH.TYPE_LOOKUP_CODE
    AND HOU.ORGANIZATION_ID(+) = PH.ORG_ID
    AND PH.ORG_ID                       IN (90, 91, 92, 93, 94, 410, 414, 19626, 19628, 137) CVRD, HISPANOBRAS, KOBRASCO, NIBRASCO, ITABRASCO,CPBS,FGC,FCA,SALOBO,FVRD
    AND PH.ORG_ID                      IN (90,19626) CVRD,FCA
    AND NVL(PH.FROZEN_FLAG, 'N') = 'N'
    AND NVL(PH.CANCEL_FLAG, 'N') = 'N'
    AND NVL(PH.AUTHORIZATION_STATUS, 'INCOMPLETE') IN ('APPROVED', 'PRE-APPROVED', 'IN PROCESS', 'REQUIRES REAPPROVAL')
    AND PH.TYPE_LOOKUP_CODE = 'CONTRACT'
    AND EXISTS (SELECT 1
    FROM PO.PO_HEADERS_ALL PAI,
    PO.PO_HEADERS_ALL FILHO,
    PO.PO_LINES_ALL PLA,
    INV.MTL_CATEGORIES_B MCB
    WHERE MCB.CATEGORY_ID = PLA.CATEGORY_ID
    AND PAI.TYPE_LOOKUP_CODE = 'CONTRACT'
    AND PLA.CONTRACT_ID = PAI.PO_HEADER_ID
    AND PLA.PO_HEADER_ID = FILHO.PO_HEADER_ID
    AND PAI.PO_HEADER_ID = PH.PO_HEADER_ID
    AND NVL(PLA.CANCEL_FLAG, 'N') = 'N'
    AND MCB.SEGMENT1 IN ('SE', 'SV'))
    -- AND PH.ATTRIBUTE2 IN ('CUSTEIO (SERVIÇO)', 'INVESTIMENTO (SERVIÇO)')
    AND ((NVL(PH.CLOSED_CODE, 'OPEN') = 'OPEN') OR
    (NVL(PH.CLOSED_CODE, 'OPEN') = 'CLOSED' AND
    PH.END_DATE BETWEEN TO_DATE(:DATA_INICIO||' 00:00:00', 'DD/MM/YYYY HH24:MI:SS') AND
    TO_DATE(:DATA_FIM||' 23:59:59', 'DD/MM/YYYY HH24:MI:SS')))
    and flv.language = 'PTB'
    and flv.lookup_type = 'AUTHORIZATION STATUS'
    and flv.lookup_code = nvl(ph.authorization_status,'INCOMPLETE')

  • The apexafterrefresh event not being fired in Chart IR's

    Hi all,
    I am adding additional functionality to IR reports using the plug-in architecture in Apex 4.1.1. A Dynamic action has been added to the "After Refresh" event for the #apexir_WORKSHEET_REGION jQuery selector.
    This works fine in all cases except when no data is found in the report. This has been fixed in 4.2 so I can live with this until the upgrade. However, it also does not work when a chart is created in the report, the apexafterrefresh event does not get raised. Therefore my dynamic action will not fire. Looking at the apex_interactive_reports_4_1.js this event gets raised for the table element with an ID stored in apexir_WORKSHEET_ID ie:
    apex.jQuery('#' + $v("apexir_WORKSHEET_ID")).trigger('apexafterrefresh', that.report_id);However this table element does not get rendered when a Chart is displayed and therefore the apexafterrefresh will not get raised.
    In apex 4.2 the widget.interactiveReport.js has been modified to handle the no data found but not charts:
    var lTriggeringElement$, lWorksheetId;
                            lWorksheetId = $v( "apexir_WORKSHEET_ID" );
                            if ( $x( lWorksheetId ) ) {
                                // If the table element containing data exists (ie when the report returns rows),
                                // use that to trigger the event.
                                lTriggeringElement$ = apex.jQuery( '#' + lWorksheetId );
                            } else {
                                // Otherwise, use the span holding the no data found message.
                                lTriggeringElement$ = apex.jQuery( '#apexir_NO_DATA_FOUND_MSG' );
                            lTriggeringElement$.trigger( 'apexafterrefresh', that.report_id );I have created a test case on apex.oracle.com - http://apex.oracle.com/pls/apex/f?p=41357:1 In this example I simply display an alert from a Dynamic action with the following attributes:
    Event - After Refresh
    Selection Type - Region
    Region - Interactive Report
    As can be seen when the user navigates to the report the alert displays, however when you navigate to the Chart the alert does not display.
    In my mind this is a bug and the IR reports JavaScript should be modified to raise the event apexir_WORKSHEET DIV Element instead. This would fix both issues.
    Any ideas on how to overcome this issue?
    Thanks
    Chris.

    For everyone's information Bug 16029272 - ALERT (APEXAFTERREFRESH EVENT) NOT BEING FIRED IN CHART OF INTERACTIVE REPORTS has been raised regarding this issue.

  • (view hint or Query  writing method) using views in Select Query

    Need Assistance,
    Hi all,
    My database having many views. while i am joining the views in a select query increase the cost of the querys due to the complex joins in the conditions.
    While checking the select query with views individualy taking less cost.
    Does any hint or query writing method is availabe to avoid the merging of the execution plan of the views?
    I have browsed many related to the mentioned issues,couldn't found any thing that helps me.
    Please help me on this issue,it will be very much helpfull for me.
    Thanks,
    Senthur

    Please read the two threads linked to in the FAQ: {message:id=9360003} and post the relevant details they request, so that people can help you better with your issue.
    We cannot help if you just say "my query is slow what do I do to fix it" as we cannot see your queries, your data, or any other information we would need to help. If the answer was that simple, it would be built into oracle so that the optimiser would fix it for you.

  • Problem in block based Query

    Respected Guru's
    I have a problem eith block bassed query.i have already used this block based query and it is working too.
    But here i am facing the the problem.why becuz i have used a global variable to pass value for execute it.
    and used 'set_block_property' to execute this query ..
    go_block('block name ')
    execute_query;
    But it si showing unable to perform the query..
    How i do this?? plez help me out...

    Dear...........
    There are some possible reasons.
    1- The items that are in data block , there is some field data is not database field and you set the property of this item is
    "Data Base Item" = 'Yes' , means this field is not in table.
    2- user right problem
    3- see the block property where set the property QUERY = NO\
    THX.

  • Infoset based Query creating locks on DSO Activations

    Hello Experts,
    We are current on SAP NetWeaver 7.3 on ORACLE data base version 11.2.0.3.0.
    We have a query thats built on top of an infoset ( Based on left outer join on 0material and 0mat_plant) when user executes the query its causing locks on DSO activations.
    DSO activations are on hold due to locks on following table RSRNEWSIDS. when BASIS investigated this issue they came up with following reason
    executing this infoset based query is causing the locks and if we kill this job the DSO Activations run fine.
    The design is as follows
    Infoset(0material --Lefter outer Join -- 0mat_plant) ---> MP ---> BEx Query.
    Question 1) Is it possible for a query to create locks and cause holds on DSO Activations? if so what would be the reason?
    Question 2) Any solution or any of you faced similar issue?
    any solution is highly appreciated and rewarded.
    Regards,
    Vamsi.

    Question 1) Is it possible for a query to create locks and cause holds on DSO Activations? if so what would be the reason?
    It all comes down to SID if a query needs an association between fact and dimensions it will use SID and if you doing an activation it readjusts the SIDS so needs to be locked for the most up to date data.
    Question 2) Any solution or any of you faced similar issue?
    Do your query execution before or after DSO activation.
    Cheers!
    Suyash

  • Use of hints in query performance

    Hi
    Please let me know actual usage of hints in query tunging, how do we write hints of increase performnace.
    let me know below query will gives better performnce. if hints are not use query will degrade performance.
    SELECT /*+ ORDERED INDEX (b, jl_br_balances_n1) USE_NL (j b)
    USE_NL (glcc glf) USE_MERGE (gp gsb) */
    b.application_id ,
    b.set_of_books_id ,
    b.personnel_id,
    p.vendor_id Personnel,
    p.segment1 PersonnelNumber,
    p.vendor_name Name
    FROM jl_br_journals j,
    jl_br_balances b,
    gl_code_combinations glcc,
    fnd_flex_values_vl glf,
    gl_periods gp,
    gl_sets_of_books gsb,
    po_vendors p

    942919 wrote:
    Please let me know actual usage of hints in query tunging, how do we write hints of increase performnace.The majority of hints would be used to diagnose a performance problem by identifying a better query plan and fixing the underlying reason that the optimizer did not select that plan automatically. Hints used in this way would be removed from the query after the cause of the performance problem was fixed.
    http://docs.oracle.com/cd/E11882_01/server.112/e16638/hintsref.htm#i8327
    Hints change the access paths and methods the optimizer chooses, so before using a hint, you need to understand what the optimizer does, what access methods are, when they are chosen, and what they are best used for.
    To do that you need to read the Performance Tuning Guide
    http://docs.oracle.com/cd/E11882_01/server.112/e16638/toc.htm
    At a minimum reading and understanding these sections -
    http://docs.oracle.com/cd/E11882_01/server.112/e16638/perf_overview.htm#i1006218
    http://docs.oracle.com/cd/E11882_01/server.112/e16638/optimops.htm#i21299
    http://docs.oracle.com/cd/E11882_01/server.112/e16638/ex_plan.htm#i19260
    http://docs.oracle.com/cd/E11882_01/server.112/e16638/stats.htm#i13546
    Then you should be able to use a hint safely.
    let me know below query will gives better performnce. if hints are not use query will degrade performance.Not true, hints change the performance of queries they can make them slower as well as faster. Here is an example of an index hint slowing down a query
    {message:id=1989089}

  • Can I use a OID rule for a Query SQL Lov of BIP?

    Hi. Can I use OID data (rules) for a query sql lov in BIP? Ex. filters users/store.
    Thank you.
    R.

    Hi,
    I didn't look at the example, but if you want to secure your application then you should use container managed security. Read this .
    Anyway, you could add this before return "good"; in your login_action()
    FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("username", user);Then, you can access this from anywhere in the application by using #{sessionScope.username}.
    Pedja

  • RULE hint and 11g

    Oracle Standard Edition 11.1.0.7.0
    We all know that the RULE hint is not longer supported, so in that case why would Oracle themselves want to use it ?
    select parsing_schema_id,sql_Text from v$sqlarea where upper(sql_text) like '%+ RULE%' or upper(sql_text) like '%+RULE%'
    I get 7 rows back from my 11gR1 database (and many more from 10gR2)
    Basically, we have a bunch of issues with parsing SQL in a 10gR2 environment, upgrading from 9iR2, setting optimizer_features_enable down at lower releases, as far as the minimum 8.0.3, does provide quicker parses with still acceptable plans, but RULE hint gives the best parse, so wondering about the support situation if we deplot it tactically. Oracle can hardly object if the RDBMS itself uses the hint, surely ?

    It was already in version 10g that the OPTIMIZER_MODE=RULE was desupported.
    "Desupported" does not mean it is no longer technically possible to use RULE nor does it mean that we do not use it anymore internally. It just means that it is no longer supported that you use this optimizer mode.
    In other words: Almost no testing was done with OPTIMIZER_MODE=RULE, and if you turn it on and you get any problems, our support will not be responsible to help you because of that setting.
    If on the other hand it turns out that for troubleshooting purpose it is necessary to go with that mode for certain statements (because our support came to that conclusion), it will be possible to use it of course without you losing further support.
    Kind regards
    Uwe
    http://uhesse.wordpress.com

Maybe you are looking for