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>

Similar Messages

  • 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

  • Does RULE hint cause ORA-01555 errors ?

    DB Version:9.2.0.5.0
    OS:SunOS 5.9
    Our DBA is saying that the RULE hint in the below SQL might be causing ORA-01555 error. Is it true? Does RULE hint cause ORA-01555 errors
    SELECT /*+ RULE */  COUNT(*)
      FROM ( SELECT /*+ RULE */  DISTINCT CAR_HDR.CAR_NBR AS A1, CAR_HDR.PLT_ID AS A29,
      CAR_HDR.PKT_CTRL_NBR AS A2, CAR_HDR.TOTAL_QTY AS A21, CAR_HDR.STAT_CODE AS A6,
      CAR_HDR.CURR_LOCN_ID AS A12,
      CAR_HDR.CAR_NBR  AS A145,
      CAR_HDR.WN_NBR AS A4, CAR_HDR.PCALL_NBR AS A7, CAR_HDR.CHAIN_CNT AS A119,
      CAR_HDR.SHPMT_NBR AS A35, LPN_HDR.WHSE AS A105, CAR_HDR.MISC_CAR AS A146, ''  AS A138,
      CAR_HDR.CHUTE_ID AS A132, CAR_HDR.MOD_DATE_TIME AS A82, LPN_HDR.LOCN_CLASS AS A106,
      LPN_HDR.AREA AS A107, LPN_HDR.ZONE AS A108, LPN_HDR.AISLE AS A109, LPN_HDR.BAY AS A110,
      LPN_HDR.LVL AS A111, LPN_HDR.POSN AS A112
          FROM INV_MASTER , CAR_DTL , LPN_HDR , CAR_HDR 
           WHERE CAR_HDR.CAR_NBR=CAR_DTL.CAR_NBR(+)
           AND CAR_HDR.CURR_LOCN_ID=LPN_HDR.LOCN_ID(+)
           AND CAR_HDR.WHSE=LPN_HDR.WHSE(+)
           AND CAR_DTL.SKU_ID=INV_MASTER.SKU_ID(+)
           AND CAR_HDR.CT_SEQ = 'ALB10'
           AND INV_MASTER.INV_CODE = 98
           AND INV_MASTER.TRACK_CODE = 'P10' )
          

    user636669 wrote:
    DB Version:9.2.0.5.0
    OS:SunOS 5.9
    Our DBA is saying that the RULE hint in the below SQL might be causing ORA-01555 error. Is it true? Does RULE hint cause ORA-01555 errorsThe full statement is causing the ORA-01555 error. Each line of the statement is important therefore each line is reponsible for the error. I personally think the DISTINCT keyword has a bigger influence than the RULE hint.
    I suggest to check what you want to do with that count result. maybe there are better ways to get the same result. Maybe you can even ignore the distinct keyword or remove some outer joins. Using the CBO might result in the same plan as using the RBO, so you you will never know if that removing the hint will help or if if you'll get the same problem later again.

  • 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)

  • 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.

  • 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')

  • ORA-01861 occurs when NO_INDEX hint removed

    Hi all,
    We've got a view that is very slow and we'd noticed it had several /* NO_INDEX (+index_name+) */ hints. Thinking this was an odd approach and may be causing the performance hit, I tested the query without the hints and, as expected, performance was vastly improved.
    However, the application that uses the view queries via a DATE column on the view. When a date is specified in a query against the view, the version with the hints removed now comes up with ORA-01861. The same query against the view with the hints intact works fine (albeit very slowly).
    The view references views/tables that are accessed across a database link. The source of the DATE field is originally a VARCHAR2 field that is converted to a date using TO_DATE on one of the views in the main view's FROM clause (to the DD/MM/YYYY HH24:MI:SS format).
    I've tried all manner of TO_CHAR, TO_DATE (with and without TRUNC) to get the query to work without success. There is something very odd going on here.
    The database is 9i.
    Please help!

    Many thanks for the swift responses.
    The main query (I've posted the version with the hint so you can see that) is:
    CREATE OR REPLACE FORCE VIEW people.xxmod_int_fp_shift_payment_v (psp_cust_id,
    psp_person_id,
    psp_term_date,
    psp_pp_date,
    psp_amt,
    psp_ind,
    psp_percent,
    psp_hrs,
    psp_pen_amt
    AS
    SELECT /*+ NO_INDEX(xienav.peev pay_element_entry_values_f_n50) */
    xipciv.customer_id, papf.employee_number, papf.effective_end_date,
    xienav.week_ending_date, NULL, NULL, NULL, NULL, NULL
    FROM per_all_people_f papf,
    per_all_assignments_f paaf,
    pay_element_entries_f peef,
    xxmod_int_ee_night_allow_v xienav,
    xxmod_int_per_cust_id_v xipciv
    WHERE paaf.person_id = papf.person_id
    AND peef.assignment_id = paaf.assignment_id
    AND xienav.element_entry_id = peef.element_entry_id
    AND paaf.payroll_id = xipciv.payroll_id
    AND peef.effective_start_date BETWEEN papf.effective_start_date
    AND papf.effective_end_date
    AND peef.effective_start_date BETWEEN paaf.effective_start_date
    AND paaf.effective_end_date
    UNION ALL
    SELECT /*+ NO_INDEX(xienamv.peev pay_element_entry_values_f_n50) */
    xipciv.customer_id, papf.employee_number, papf.effective_end_date,
    xienamv.date_worked, NULL, NULL, NULL, NULL, NULL
    FROM per_all_people_f papf,
    per_all_assignments_f paaf,
    pay_element_entries_f peef,
    xxmod_int_ee_night_allow_mod_v xienamv,
    xxmod_int_per_cust_id_v xipciv
    WHERE paaf.person_id = papf.person_id
    AND peef.assignment_id = paaf.assignment_id
    AND xienamv.element_entry_id = peef.element_entry_id
    AND paaf.payroll_id = xipciv.payroll_id
    AND peef.effective_start_date BETWEEN papf.effective_start_date
    AND papf.effective_end_date
    AND peef.effective_start_date BETWEEN paaf.effective_start_date
    AND paaf.effective_end_date
    UNION ALL
    SELECT /*+ NO_INDEX(xiesov.peev pay_element_entry_values_f_n50) */
    xipciv.customer_id, papf.employee_number, papf.effective_end_date,
    xiesov.date_worked, NULL, NULL, NULL, NULL, NULL
    FROM per_all_people_f papf,
    per_all_assignments_f paaf,
    pay_element_entries_f peef,
    xxmod_int_ee_shift_overtime_v xiesov,
    xxmod_int_per_cust_id_v xipciv
    WHERE paaf.person_id = papf.person_id
    AND peef.assignment_id = paaf.assignment_id
    AND xiesov.element_entry_id = peef.element_entry_id
    AND paaf.payroll_id = xipciv.payroll_id
    AND peef.effective_start_date BETWEEN papf.effective_start_date
    AND papf.effective_end_date
    AND peef.effective_start_date BETWEEN paaf.effective_start_date
    AND paaf.effective_end_date;
    One of the sub-view queries (they all do a similar thing) converting the data in question is:
    CREATE OR REPLACE FORCE VIEW people.xxmod_int_ee_night_allow_v (element_entry_id,
    early_hrs_to_2300,
    late_hrs_from_2300,
    pay_value,
    week_ending_date
    AS
    SELECT /*+ NO_INDEX(peev pay_element_entry_values_f_n50) */
    peev.element_entry_id, NULL, NULL, NULL,
    TO_DATE (peev.screen_entry_value, 'YYYY/MM/DD HH24:MI:SS')
    FROM pay_element_entry_values_f peev,
    pay_input_values_f piv,
    pay_element_types_f pet
    WHERE piv.input_value_id = peev.input_value_id
    AND piv.element_type_id = pet.element_type_id
    AND pet.element_name = 'Night Allowance Non MOD'
    AND piv.NAME = 'Claim Date'
    AND peev.effective_start_date BETWEEN piv.effective_start_date
    AND piv.effective_end_date
    AND peev.effective_start_date BETWEEN pet.effective_start_date
    AND pet.effective_end_date;
    I've looked for erroneous data that may be contributing towards this error but I have yet to find any.

  • How to specify rule hints in exp parfile query

    Dear All,
    How can I use EXP utility to export tha data whose query is following:
    select /*+ INDEX(partlist, IDX_PSER)*/ item_number from partlist where class = 'C' ;
    In my exp parfile i have the QUERY parameter that allows me to specify the where clause as follows:
    where class = 'C' ;
    However my concern is the hints rule part, which is autogenerated by exp. How can i specify the select hint(/*+ xxxx */
    Pls advice.
    Thanks,
    Mahesh

    Hi,
    In that case temporary create the table from the user which does not have tablespace resource issues. If all the user has tablespace issue, then I doubt you have any option except to use query clause in actual table.
    Why you feel index hint would be more useful then full table scan in exp? i.e. records to be exported is very small(nearly 2 to 3%) compared to total records
    Regards
    Anurag Tibrewal.

  • Regarding Rules, Functions and Risks

    Hello,
    1. Does SAP provide a standard ruleset for SoD? Does it come with the AC 5.3 .SCA?
    2. What is the relation between Rules, Risks, Functions and Business Process?
    Thanks.

    Hi Gautam,
    Just to make it more explanatory, lets take few examples for each entity:
    1. Business Process (BP):
    It can be a department, group or an independent functional unit in an organization. E.g Finance or HR or Material Management.
    2. Function:
    It can be a set of activites or say set of simlilar activities in a BP. E.g in SAP Security - SU01 and PFCG combination can be termed as a function - "User and role maintenence" .
    3. Risk:
    It can be a combination of 2 or more functions which when given to a single user, can be harmful to the organization.
    4. Rule:
    It is generated from Risks automatically. E.g if A and B are 2 funtions in a risk R, such that:
                       A has transactions X and Y and
                       B has transactions M and N
    so there can be multiple rules generated here for Risk R , with the combinations like X and M rule, X and N rule, Y and M rule, Y and N rule etc.
    5. Ruleset:
    As the name suggest, is a set of Rules, generated from Risks. Two Rulesets may contain same, similar or dissimilar risks, based on the lanscape for which you want to use the ruleset. E.g you might have ruleset R1 having Risks 1 to N in your development system and you might have ruleset R 2 having Risks 1 to M in your Production system.
    Hope this makes it a bit clearer to you know. For more dependencies within these entities and how they behave with eah other, I would suggest if you create each of them and then observe their linkages. The config guide from SAP would be more than enough for this purpose.
    Regards,
    Hersh.
    http://www.linkedin.com/in/hersh13

  • Query regarding Rules in MARS

    Hello Friends,
    Please let me know what type of Event these rules will trigger? (REFER ATTACHED DOC SCREENSHOT)
    Specifically I want to know the meaning behind “Count”. If I increase the count field to 2 or 3 what will it do.
    Also the time I configured is 10 minutes. Is it like it will check the condition for a time period of 10 minutes? What is the significance of time field here?

    Hi Rashid,
    The below link should give the description of each of the fields:
    http://www.cisco.com/en/US/docs/security/security_management/cs-mars/6.0/user/guide/combo/rules.html#wp532081
    The field "Count" refers to the number of times the event in the "Event" field has to fire within the "Time Range" specified for this Rule for the condition to be met. Hope this helps!!
    Regards,
    Prapanch

  • Regarding Rule file

    Hi All,
    I am a starter in Essbase.
    Can you please let me know in which scenarios a "Rule File" is used to load data.
    Regards,
    945775

    Hi,
    You can review the following links:
    Essbase administrator Guide at http://docs.oracle.com/cd/E12825_01/epm.111/esb_dbag.pdf under the chapter "Building Dimensions and Loading Data"
    http://www.youtube.com/watch?v=sK2KAVIFz4c
    Hope it helps...
    KosuruS
    Edited by: KosuruS on Aug 27, 2012 12:14 PM
    Edited by: KosuruS on Aug 27, 2012 12:14 PM

  • Regarding Rules in HR Form Editor(PE51)

    Hi All,
    I have written this rule 02 to supress the wage type whose BETRG is 0.
    But its not working properly, Instead it is supressing all wage type irrespective of BETRG value. Can you help me out.
    Thanks in Advance
    Chandrashekhar
    Rule No Table Field Type CO value1 Conversion
    2 1 RT BETRG N EQ 0 00

    Chandrashekhar,
    If rules don't suffice your need you can also edit the customer includes &
    write your custom code to meet the desired functionality :-
    INCLUDE RPCEDDZ9.  "Data defintions for customer-modifications
    INCLUDE RPCEDSZ9.     "Form routines   for customer-modifications
    Kindly reward in case useful.
    Regards,
    Darshan Mulmule

  • Regarding Rule Modeler

    Hi All,
    Here we are facing a different problem in Rule Modeler.
    We are using ICWC 5.0 Version.I have added one category in Category Modeler and that Category should be Routed automatically to a particular group.So in Rule Modeler i have added that categories defined condition and actions so for that categories after defining when i am creating the service ticket after classifying all the categories when i click save and Assign it is shwing a message that "No routing has been maintained" Actually it should rout to that particular group where i have defined in Rule modeler.Kindly suggest me any more settings are required for automatic routing.
    Regards
    Sekhar.

    Hi,
    In your rule modeler screen ..what is the category you are assigning and are you storing it in the subject profile codes?
    please check for a subject profile assignement in your rule modeler.
    I hope it helps
    Regards
    Raj

  • Regarding MSS services removing

    Hi All,
    I have to remove some specific services from service map in MSS. l need only Wprk overview and Team.
    How to acchieve this requirement.
    Thanks in advance,
    krishna.

    Dear Krishna,
            Please login to R/3 system and go to transaction  SPRO -> Personnel Management -> ESS -> General Setting -> (Check under Areas/Subareas) ->(Assign Areas to Area Group Pages/ Assign Subareas to areas).
    Regards
    Ponnusamy

  • Regarding all_rows hint

    Hi,
    I have a sql query which is taking too long so when i keep /* all_rows */ it is taking same time..may i know reason why?
    2.When i see the plan for a query it is performing full_table scan. which is taking too long ..is there any hint to convert that full table scan?

    user632733 wrote:
    Hi,
    I have a sql query which is taking too long so when i keep /* all_rows */ it is taking same time..may i know reason why?Because the default optimizer mode in pl/sql is all_rows (though you've not told us how you are running this SQL before you attempt the hint).
    >
    2.When i see the plan for a query it is performing full_table scan. which is taking too long ..is there any hint to convert that full table scan?If full table scans were always bad ... they wouldn't be an option. Not to say that they are always good either, but your presumption seems to be that full table scan = bad.
    If you'd like any seriously meaningful help... you're going to need to read and follow (and then post the relevant information)
    When your query takes too long ...
    HOW TO: Post a SQL statement tuning request - template posting

Maybe you are looking for

  • Toplink 9.0.4.8 and JTS on OAS 10.1.2.0.0 and 10.1.2.0.2 not rolling back

    Re-Posting message with more information. Toplink 9.0.4.8 and JTS not rolling back transaction Hi Scenario: I have a session bean (EJB1) calling a session bean (EJB2). When an EJB1 is called, EJB1 persists data on to Table1 in database. And EJB1 make

  • Calling IP function in ABAP report

    Hi guys, I would like to execute a planning function of BIIP from an ABAP report. Which function module has to be used or is there a different approach? For the old BPS planning function there was the API_SEM_BPS.... Regards Stefan

  • How can I remove red and green lines from a footage?

    I cannot remove red and green lines without removing the title graphics that I have in my footage. How can I solve the problem and keep the graphic there?

  • Regarding user name and password for database

    hi     i need to connect webdynpro apllication to oracle database. i installed the jdbc drivers and i need to know the super admin id and pass word

  • Flash player problem

    when i try to use programs it says i need to install flash player, but when i try to install, it says its already their? help??