Planning iin REM.

Hi All,
I have a problem and I need some help. My plant A is REM. The Finished Goods material "XXX" recieves the requirment from the Customer as on Schedule line. Now the backward scheduling is done based on delivery date in schedule lines.
The requirment is that irrespective of plan order quantity, The inhouse production time must be 10 Days. Which means that I must have 10 days time between Scheduled start date and scheduled finish date.
Please help me. EVEN If I maintain the inhouse production time in MRP 1 view in material master, it is not considered in planning.
Please gine me some solution how to make it happen. I need some immediate solution.

hi
Run MRP with scheduling indiactor as "1" in MD02, then it will consider inhouse production time and not thee time from routing.
But this time will be independent of lot size , whenther u produce 100 or 10000 , it will plan for 10 days only.
Amit

Similar Messages

  • Inter-plant planning in REM

    Hi i need some suggestions for inter plant planning in REM before mapping in SAP.
    Our Scenario is Repetitive manufacturing and we have 2 plants which have 3 assemblies in each plant in case of discrete/process scenario with using special procurement key we can do inter plant planning but in case of REM SAP HELP suggest its not possible but don't understand why it is so?
    please refer this link : http://help.sap.com/saphelp_46c/helpdata/en/70/442986c48d11d1b59d0000e82d81c3/frameset.htm.
    So i want some suggestions from  any one you who might have already experienced this scenario to map in SAP.
    As i understand this can be achieved by MRP at 2 plants or with scope of planning apart from these is there any other way which can be simplified the task.
    Cheers
    KK
    Edited by: kiran kumar on Feb 7, 2011 4:54 PM

    On which version are you working?
    ECC6
    Have you tried the Inter-plant planning in REM If yes then what the error are you getting?
    No i haven't tried this scenario will try and update mean while i want some inputs from any one who might have already experienced this scenario.
    It s possible a stock transfer of the production plant may also be executed to the plant of the sales order also.
    Could you please elaborate more what do you mean by this statement?
    Cheers
    KK

  • Planning table ( REM)

    Hi Experts,
                 When we opening planning table (mf50) with material selection ,then complete capacity data  section is not appearing& in header view of capacity requirement planning (change capacity display isin grey color).
    we have already set the parameter related to REM senario (e.g,rem profile,prod.schdl.profile,scheduling parameters (PE),w.c capacity data etc).
    where i had mistake ,plz let me know....

    >
    panney wrote:
    > Thanks for reply... I am sending 2 images, please refer the images.The problem is complete capacity data tab is not displaying,so,plz let me know were i have gone wrong.
    Images path:
    http://picasaweb.google.com/112717423459525953218/PlanningTable#
    http://picasaweb.google.com/112717423459525953218/PlanningTable#
    Panney,
    Its a simple problem, you need to assign your resource to the production line field of the production version( use transaction C223 or MM02 in MRP4 view to make this correction). Once the production version has the Production line assigned you should be getting the Capacity data in MF50.
    Regards,
    Prasobh

  • REVERSING PLANNED ORDER - REM

    Hai all,
           In REM, I want to reverse the some backflushed components (ie., Reversing the GR) at that time system automatically create planned order based on the settings maintained in REM Profile. In case i didn't maintain anything in REM profile in that case what will happen?
    ganeshraja

    Dear Mr.Ganesh Raja,
    As explained by Mr.Ram,For the particular REM profile which is assigned to the
    material forwhich MFBF is carried out,while doing MF41,Reversing ,if u want the
    system to create a planned order automatically of the same quantity of reversed
    one,then in SPRO - Production - Repetetive Manufacturing-Control data - Define
    REM profile,In control data2 Creating planned orders When reversing - include a
    tick mark in the check box- create planned orderswhen reversing.
    The system automatically thorws  you a planned order with a new planned order
    number,of same quantity.
    If useful reward points.
    Regards
    Mangal

  • Capacity Planning in REM

    No lead time scheduling: Plant  / order type PE / prod.sched.
    No capa. data determined: Plant 3400 / Ord. type PE / Prod. sched
    Edited by: itsmerajkhan on May 24, 2011 6:27 PM

    Dear,
    Check this setting first SPROProductionREM-Planning-PlanningTable--Maintain Entry Parameters
    Capacity tick mark need to active.Alos check Maintain Distribution for Planning Table.
    Please check with following things,
    1. Define Scheduling Parameters for Planned Orders - OPU5
    Please check "scheduling " and "Generate capacity req" check box has beeb acitvated under one scheduling level for order type PE/ plant comibination at OPU5.
    2. You must have created workcenter for the production line,
    3. you must enter the workcenter in the prodution version in MRP view.
    4. you must have created any routing with workcenter.
    5.you must enter the routing, to the scheduling level (defiend at OPU5) in the production version.
    5. Maintain scheduling data in front screen of the planning table (MF50)
    In Planning Table (MF50) Scheduling Tap Select the following
    1.Rate based Planning (Detailed planning and sequencing also possible)
    2.Tick Capacity planning, which Controls that capacity planning is carried out for the production line in background mode when accessing the run schedule quantities (planning table).
    Now enter Production line in MF50, check capacity data. plz try and come back
    Regards,
    R.Brahmankar

  • Production lines in REM

    For planning in REM we use MF50 with the selection of a production line.
    We have a material X and a material Z. Material X is a component of Z.
    The rate routing for X has the WC (operations) A and B. The rate
    routing for Z has the WC (operations) B and C. The WC B is shared.
    What is the correct assignment for the planning line with LDB1? Is it
    better for the planning results to have one line with WC A, B and C
    assigned? Or is it better to have two seperate lines with A and B, B
    and C?
    Thanks for your answer.

    Thanks for all your replies. But my question has been not answered.
    I created a WC with category 007. In line design (LDB1) I asigned to this WC (007) the WC (001) used in the rate routings. If I assigned more than one WC to the line the takt rate of the line is increasing.
    My question is now how I have to assign correct the WC (001) to the line?
    The line consists of WC A, B and C.
    The semifinished good X is produced on WC A and B. The finished good Z is produced on WC B and C.
    Need I now one Line with A + B + C for both materials?
    Or should I create a Line 1 with A + B for the SFG X, and Line 2 with B + C for the FG Z?

  • What can I do to make this query run faster

    Hi All,
    The below query is taking a long time. Is there any thing that I can do to shorten its time.
    SELECT C.FOLIO_NO, C.CO_TRANS_NO TRANS_NO, to_char(C.CREATED_DATE, 'dd/mm/yyyy') DOC_DATE, DECODE(PP.NAME, NULL, D.EMP_NAME, PP.NAME) LODGED_BY, decode(sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID), Null, '-', sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID)) DATE_CHANGE, P.RECEIPT_NO, decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id) TRANS_ID,(case when decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR20' then 1 when decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR03' then 2 end) TRANS_TYPE FROM CO_TRANS_MASTER C, PAYMENT_DETAIL P, PEOPLE_PROFILE PP, SC_AGENT_EMP D, M_CAA_TRANS E     where '1' <> TRIM(UPPER('S0750070Z')) and (C.CO_TRANS_ID in TRIM(UPPER('AR20')) OR C.CO_TRANS_ID in TRIM(UPPER('AR03'))OR c.co_trans_id IN TRIM (UPPER ('A020')))and C.CO_TRANS_NO = P.TRANS_NO and (C.VOID_IND = 'N' or C.VOID_IND is Null) and C.CREATED_BY = PP.PP_ID(+) and C.PROF_NO = D.PROF_NO(+) and C.CREATED_BY = D.EMP_ID (+) and TRIM(UPPER(C.CO_NO)) = TRIM(UPPER('200101586W')) and c.co_trans_id = e.trans_id (+) order by FOLIO_NO;
    SQL>
    SQL> show parameter user_dump_dest
    NAME                                 TYPE        VALUE
    user_dump_dest                       string      /u01/app/oracle/diag/rdbms/ebi
    zfile/EBIZFILE1/trace
    SQL> show parameter optimizer
    NAME                                 TYPE        VALUE
    optimizer_capture_sql_plan_baselines boolean     FALSE
    optimizer_dynamic_sampling           integer     2
    optimizer_features_enable            string      11.2.0.2
    optimizer_index_caching              integer     0
    optimizer_index_cost_adj             integer     100
    optimizer_mode                       string      ALL_ROWS
    optimizer_secure_view_merging        boolean     TRUE
    optimizer_use_invisible_indexes      boolean     FALSE
    optimizer_use_pending_statistics     boolean     FALSE
    optimizer_use_sql_plan_baselines     boolean     TRUE
    SQL> show parameter db_file_multi
    NAME                                 TYPE        VALUE
    db_file_multiblock_read_count        integer     128
    SQL> show parameter db_block_size
    NAME                                 TYPE        VALUE
    db_block_size                        integer     8192
    SQL> show parameter cursor_sharing
    NAME                                 TYPE        VALUE
    cursor_sharing                       string      EXACT
    SQL>
    SQL> column sname format a20
    SQL> column pname format a20
    SQL> column pval2 format a20
    SQL>
    SQL> select
      2  sname, pname, pval1, pval2
      3  from
      4  sys.aux_stats$;
    SNAME                PNAME                     PVAL1 PVAL2
    SYSSTATS_INFO        STATUS                          COMPLETED
    SYSSTATS_INFO        DSTART                          09-11-2010 14:25
    SYSSTATS_INFO        DSTOP                           09-11-2010 14:25
    SYSSTATS_INFO        FLAGS                         1
    SYSSTATS_MAIN        CPUSPEEDNW           739.734748
    SYSSTATS_MAIN        IOSEEKTIM                    10
    SYSSTATS_MAIN        IOTFRSPEED                 4096
    SYSSTATS_MAIN        SREADTIM
    SYSSTATS_MAIN        MREADTIM
    SYSSTATS_MAIN        CPUSPEED
    SYSSTATS_MAIN        MBRC
    SYSSTATS_MAIN        MAXTHR
    SYSSTATS_MAIN        SLAVETHR
    13 rows selected.
    Elapsed: 00:00:00.06
    SQL>
    SQL> explain plan for
      2  SELECT C.FOLIO_NO, C.CO_TRANS_NO TRANS_NO, to_char(C.CREATED_DATE, 'dd/mm/yyyy') DOC_DATE, DECODE(PP.NAME, NULL, D.EMP_NAME, PP.NAME) LODGED_BY, decode(sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID), Null, '-', sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID)) DATE_CHANGE, P.RECEIPT_NO, decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id) TRANS_ID,(case when  decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR20' then 1 when  decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR03' then 2 end) TRANS_TYPE FROM CO_TRANS_MASTER C, PAYMENT_DETAIL P, PEOPLE_PROFILE PP, SC_AGENT_EMP D, M_CAA_TRANS E     where '1' <> TRIM(UPPER('S0750070Z')) and (C.CO_TRANS_ID in TRIM(UPPER('AR20')) OR C.CO_TRANS_ID in TRIM(UPPER('AR03'))OR c.co_trans_id IN TRIM (UPPER ('A020')))and C.CO_TRANS_NO = P.TRANS_NO and (C.VOID_IND = 'N' or C.VOID_IND is Null) and C.CREATED_BY = PP.PP_ID(+) and C.PROF_NO = D.PROF_NO(+) and C.CREATED_BY = D.EMP_ID (+) and TRIM(UPPER(C.CO_NO)) =  TRIM(UPPER('200101586W')) and c.co_trans_id = e.trans_id (+) order by FOLIO_NO;
    Explained.
    Elapsed: 00:00:00.09
    SQL>
    SQL> set pagesize 1000;
    SQL> set linesize 170;
    SQL> @/u01/app/oracle/product/11.2.0/rdbms/admin/utlxpls.sql
    SQL> Rem
    SQL> Rem $Header: utlxpls.sql 26-feb-2002.19:49:37 bdagevil Exp $
    SQL> Rem
    SQL> Rem utlxpls.sql
    SQL> Rem
    SQL> Rem Copyright (c) 1998, 2002, Oracle Corporation.     All rights reserved.
    SQL> Rem
    SQL> Rem    NAME
    SQL> Rem      utlxpls.sql - UTiLity eXPLain Serial plans
    SQL> Rem
    SQL> Rem    DESCRIPTION
    SQL> Rem      script utility to display the explain plan of the last explain plan
    SQL> Rem      command. Do not display information related to Parallel Query
    SQL> Rem
    SQL> Rem    NOTES
    SQL> Rem      Assume that the PLAN_TABLE table has been created. The script
    SQL> Rem      utlxplan.sql should be used to create that table
    SQL> Rem
    SQL> Rem      With SQL*plus, it is recomended to set linesize and pagesize before
    SQL> Rem      running this script. For example:
    SQL> Rem      set linesize 100
    SQL> Rem      set pagesize 0
    SQL> Rem
    SQL> Rem    MODIFIED   (MM/DD/YY)
    SQL> Rem    bdagevil     02/26/02 - cast arguments
    SQL> Rem    bdagevil     01/23/02 - rewrite with new dbms_xplan package
    SQL> Rem    bdagevil     04/05/01 - include CPU cost
    SQL> Rem    bdagevil     02/27/01 - increase Name column
    SQL> Rem    jihuang     06/14/00 - change order by to order siblings by.
    SQL> Rem    jihuang     05/10/00 - include plan info for recursive SQL in LE row source
    SQL> Rem    bdagevil     01/05/00 - add order-by to make it deterministic
    SQL> Rem    kquinn     06/28/99 - 901272: Add missing semicolon
    SQL> Rem    bdagevil     05/07/98 - Explain plan script for serial plans
    SQL> Rem    bdagevil     05/07/98 - Created
    SQL> Rem
    SQL>
    SQL> set markup html preformat on
    SQL>
    SQL> Rem
    SQL> Rem Use the display table function from the dbms_xplan package to display the last
    SQL> Rem explain plan. Force serial option for backward compatibility
    SQL> Rem
    SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'));
    PLAN_TABLE_OUTPUT
    Plan hash value: 2520189693
    | Id  | Operation                         | Name                    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                  |                         |   592 | 85248 | 16573   (1)| 00:03:19 |
    |   1 |  TABLE ACCESS BY INDEX ROWID      | CO_FORM5A_TRANS         |     1 |    20 |     2   (0)| 00:00:01 |
    |*  2 |   INDEX UNIQUE SCAN               | SYS_C0059692            |     1 |       |     1   (0)| 00:00:01 |
    |   3 |  TABLE ACCESS BY INDEX ROWID      | CO_FORM5A_TRANS         |     1 |    20 |     2   (0)| 00:00:01 |
    |*  4 |   INDEX UNIQUE SCAN               | SYS_C0059692            |     1 |       |     1   (0)| 00:00:01 |
    |   5 |   TABLE ACCESS BY INDEX ROWID     | CO_FORM5A_TRANS         |     1 |    20 |     2   (0)| 00:00:01 |
    |*  6 |    INDEX UNIQUE SCAN              | SYS_C0059692            |     1 |       |     1   (0)| 00:00:01 |
    |   7 |  SORT ORDER BY                    |                         |   592 | 85248 | 16573   (1)| 00:03:19 |
    |   8 |   NESTED LOOPS                    |                         |       |       |            |          |
    |   9 |    NESTED LOOPS                   |                         |   592 | 85248 | 16572   (1)| 00:03:19 |
    |  10 |     NESTED LOOPS OUTER            |                         |   477 | 54855 | 15329   (1)| 00:03:04 |
    |  11 |      NESTED LOOPS OUTER           |                         |   477 | 41499 | 14374   (1)| 00:02:53 |
    |  12 |       INLIST ITERATOR             |                         |       |       |            |          |
    |* 13 |        TABLE ACCESS BY INDEX ROWID| CO_TRANS_MASTER         |   477 | 22896 | 14367   (1)| 00:02:53 |
    |* 14 |         INDEX RANGE SCAN          | IDX_CO_TRANS_ID         | 67751 |       |   150   (1)| 00:00:02 |
    |  15 |       TABLE ACCESS BY INDEX ROWID | SC_AGENT_EMP            |     1 |    39 |     1   (0)| 00:00:01 |
    |* 16 |        INDEX UNIQUE SCAN          | PK_SC_AGENT_EMP         |     1 |       |     0   (0)| 00:00:01 |
    |  17 |      TABLE ACCESS BY INDEX ROWID  | PEOPLE_PROFILE          |     1 |    28 |     2   (0)| 00:00:01 |
    |* 18 |       INDEX UNIQUE SCAN           | SYS_C0063100            |     1 |       |     1   (0)| 00:00:01 |
    |* 19 |     INDEX RANGE SCAN              | IDX_PAY_DETAIL_TRANS_NO |     1 |       |     2   (0)| 00:00:01 |
    |  20 |    TABLE ACCESS BY INDEX ROWID    | PAYMENT_DETAIL          |     1 |    29 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("F"."CO_TRANS_NO"=:B1)
       4 - access("F"."CO_TRANS_NO"=:B1)
       6 - access("F"."CO_TRANS_NO"=:B1)
      13 - filter(TRIM(UPPER("SYS_ALIAS_3"."CO_NO"))='200101586W' AND ("SYS_ALIAS_3"."VOID_IND" IS NULL
                  OR "SYS_ALIAS_3"."VOID_IND"='N'))
      14 - access("SYS_ALIAS_3"."CO_TRANS_ID"='A020' OR "SYS_ALIAS_3"."CO_TRANS_ID"='AR03' OR
                  "SYS_ALIAS_3"."CO_TRANS_ID"='AR20')
      16 - access("SYS_ALIAS_3"."PROF_NO"="D"."PROF_NO"(+) AND
                  "SYS_ALIAS_3"."CREATED_BY"="D"."EMP_ID"(+))
      18 - access("SYS_ALIAS_3"."CREATED_BY"="PP"."PP_ID"(+))
      19 - access("SYS_ALIAS_3"."CO_TRANS_NO"="P"."TRANS_NO")
    42 rows selected.
    Elapsed: 00:00:00.53
    SQL>
    SQL>
    SQL>
    SQL> rollback;
    Rollback complete.
    Elapsed: 00:00:00.01
    SQL>
    SQL> rem Set the ARRAYSIZE according to your application
    SQL> set autotrace traceonly arraysize 100
    SQL>
    SQL> alter session set tracefile_identifier = 'mytrace1';
    Session altered.
    Elapsed: 00:00:00.00
    SQL>
    SQL> rem if you're using bind variables
    SQL> rem define them here
    SQL>
    SQL> rem variable b_var1 number
    SQL> rem variable b_var2 varchar2(20)
    SQL>
    SQL> rem and initialize them
    SQL>
    SQL> rem exec :b_var1 := 1
    SQL> rem exec :b_var2 := 'DIAG'
    SQL> set pagesize 1000;
    SQL> set linesize 170;
    SQL> alter session set events '10046 trace name context forever, level 8';
    Session altered.
    Elapsed: 00:00:00.01
    SQL> SELECT C.FOLIO_NO, C.CO_TRANS_NO TRANS_NO, to_char(C.CREATED_DATE, 'dd/mm/yyyy') DOC_DATE, DECODE(PP.NAME, NULL, D.EMP_NAME, PP.NAME) LODGED_BY, decode(sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID), Null, '-', sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID)) DATE_CHANGE, P.RECEIPT_NO, decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id) TRANS_ID,(case when  decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR20' then 1 when  decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR03' then 2 end) TRANS_TYPE FROM CO_TRANS_MASTER C, PAYMENT_DETAIL P, PEOPLE_PROFILE PP, SC_AGENT_EMP D, M_CAA_TRANS E     where '1' <> TRIM(UPPER('S0750070Z')) and (C.CO_TRANS_ID in TRIM(UPPER('AR20')) OR C.CO_TRANS_ID in TRIM(UPPER('AR03'))OR c.co_trans_id IN TRIM (UPPER ('A020')))and C.CO_TRANS_NO = P.TRANS_NO and (C.VOID_IND = 'N' or C.VOID_IND is Null) and C.CREATED_BY = PP.PP_ID(+) and C.PROF_NO = D.PROF_NO(+) and C.CREATED_BY = D.EMP_ID (+) and TRIM(UPPER(C.CO_NO)) =  TRIM(UPPER('200101586W')) and c.co_trans_id = e.trans_id (+) order by FOLIO_NO;
    10 rows selected.
    Elapsed: 00:03:42.27
    Execution Plan
    Plan hash value: 2520189693
    | Id  | Operation                         | Name                    | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                  |                         |   592 | 85248 | 16573   (1)| 00:03:19 |
    |   1 |  TABLE ACCESS BY INDEX ROWID      | CO_FORM5A_TRANS         |     1 |    20 |     2   (0)| 00:00:01 |
    |*  2 |   INDEX UNIQUE SCAN               | SYS_C0059692            |     1 |       |     1   (0)| 00:00:01 |
    |   3 |  TABLE ACCESS BY INDEX ROWID      | CO_FORM5A_TRANS         |     1 |    20 |     2   (0)| 00:00:01 |
    |*  4 |   INDEX UNIQUE SCAN               | SYS_C0059692            |     1 |       |     1   (0)| 00:00:01 |
    |   5 |   TABLE ACCESS BY INDEX ROWID     | CO_FORM5A_TRANS         |     1 |    20 |     2   (0)| 00:00:01 |
    |*  6 |    INDEX UNIQUE SCAN              | SYS_C0059692            |     1 |       |     1   (0)| 00:00:01 |
    |   7 |  SORT ORDER BY                    |                         |   592 | 85248 | 16573   (1)| 00:03:19 |
    |   8 |   NESTED LOOPS                    |                         |       |       |            |          |
    |   9 |    NESTED LOOPS                   |                         |   592 | 85248 | 16572   (1)| 00:03:19 |
    |  10 |     NESTED LOOPS OUTER            |                         |   477 | 54855 | 15329   (1)| 00:03:04 |
    |  11 |      NESTED LOOPS OUTER           |                         |   477 | 41499 | 14374   (1)| 00:02:53 |
    |  12 |       INLIST ITERATOR             |                         |       |       |            |          |
    |* 13 |        TABLE ACCESS BY INDEX ROWID| CO_TRANS_MASTER         |   477 | 22896 | 14367   (1)| 00:02:53 |
    |* 14 |         INDEX RANGE SCAN          | IDX_CO_TRANS_ID         | 67751 |       |   150   (1)| 00:00:02 |
    |  15 |       TABLE ACCESS BY INDEX ROWID | SC_AGENT_EMP            |     1 |    39 |     1   (0)| 00:00:01 |
    |* 16 |        INDEX UNIQUE SCAN          | PK_SC_AGENT_EMP         |     1 |       |     0   (0)| 00:00:01 |
    |  17 |      TABLE ACCESS BY INDEX ROWID  | PEOPLE_PROFILE          |     1 |    28 |     2   (0)| 00:00:01 |
    |* 18 |       INDEX UNIQUE SCAN           | SYS_C0063100            |     1 |       |     1   (0)| 00:00:01 |
    |* 19 |     INDEX RANGE SCAN              | IDX_PAY_DETAIL_TRANS_NO |     1 |       |     2   (0)| 00:00:01 |
    |  20 |    TABLE ACCESS BY INDEX ROWID    | PAYMENT_DETAIL          |     1 |    29 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("F"."CO_TRANS_NO"=:B1)
       4 - access("F"."CO_TRANS_NO"=:B1)
       6 - access("F"."CO_TRANS_NO"=:B1)
      13 - filter(TRIM(UPPER("SYS_ALIAS_3"."CO_NO"))='200101586W' AND ("SYS_ALIAS_3"."VOID_IND" IS NULL
                  OR "SYS_ALIAS_3"."VOID_IND"='N'))
      14 - access("SYS_ALIAS_3"."CO_TRANS_ID"='A020' OR "SYS_ALIAS_3"."CO_TRANS_ID"='AR03' OR
                  "SYS_ALIAS_3"."CO_TRANS_ID"='AR20')
      16 - access("SYS_ALIAS_3"."PROF_NO"="D"."PROF_NO"(+) AND
                  "SYS_ALIAS_3"."CREATED_BY"="D"."EMP_ID"(+))
      18 - access("SYS_ALIAS_3"."CREATED_BY"="PP"."PP_ID"(+))
      19 - access("SYS_ALIAS_3"."CO_TRANS_NO"="P"."TRANS_NO")
    Statistics
             51  recursive calls
              0  db block gets
         651812  consistent gets
          92202  physical reads
              0  redo size
           1594  bytes sent via SQL*Net to client
            524  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
             10  rows processed
    SQL>
    SQL> disconnect
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
    Data Mining and Real Application Testing options
    SQL> Thanks in advance!

    Hi Raj,
    I have given the output below as you requested....
    QL>  select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST'));
    PLAN_TABLE_OUTPUT
    SQL_ID  0taz7ckjm41yv, child number 1
    SELECT C.FOLIO_NO, C.CO_TRANS_NO TRANS_NO, to_char(C.CREATED_DATE,
    'dd/mm/yyyy') DOC_DATE, DECODE(PP.NAME, NULL, D.EMP_NAME, PP.NAME)
    LODGED_BY, decode(sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID),
    Null, '-', sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID))
    DATE_CHANGE, P.RECEIPT_NO, decode(c.co_trans_id,'A020',(select
    nvl(base_trans_id,co_trans_id) from co_form5a_trans f where
    f.co_trans_no=c.co_trans_no),c.co_trans_id) TRANS_ID,(case when
    decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from
    co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR2
    0' then 1 when  decode(c.co_trans_id,'A020',(select
    nvl(base_trans_id,co_trans_id) from co_form5a_trans f where
    f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR03' then 2 end)
    TRANS_TYPE FROM CO_TRANS_MASTER C, PAYMENT_DETAIL P, PEOPLE_PROFILE PP,
    SC_AGENT_EMP D, M_CAA_TRANS E where '1' <> TRIM(UPPER('S0750070Z')) and
    (C.CO_TRANS_ID in TRIM(UPPER('AR20')) OR C.CO_TRANS_ID in
    TRIM(UPPER('AR03'))OR c.co
    Plan hash value: 4175354585
    | Id  | Operation                        | Name                    | E-Rows |  OMem |  1Mem | Used-Mem |
    |   0 | SELECT STATEMENT                 |                         |        |       |       |          |
    |   1 |  TABLE ACCESS BY INDEX ROWID     | CO_FORM5A_TRANS         |      1 |       |       |          |
    |*  2 |   INDEX UNIQUE SCAN              | SYS_C0059692            |      1 |       |       |          |
    |   3 |  TABLE ACCESS BY INDEX ROWID     | CO_FORM5A_TRANS         |      1 |       |       |          |
    |*  4 |   INDEX UNIQUE SCAN              | SYS_C0059692            |      1 |       |       |          |
    |   5 |   TABLE ACCESS BY INDEX ROWID    | CO_FORM5A_TRANS         |      1 |       |       |          |
    |*  6 |    INDEX UNIQUE SCAN             | SYS_C0059692            |      1 |       |       |          |
    |   7 |  SORT ORDER BY                   |                         |     12 |  2048 |  2048 | 2048  (0)|
    |   8 |   NESTED LOOPS                   |                         |        |       |       |          |
    |   9 |    NESTED LOOPS                  |                         |     12 |       |       |          |
    |  10 |     NESTED LOOPS OUTER           |                         |     10 |       |       |          |
    |  11 |      NESTED LOOPS OUTER          |                         |     10 |       |       |          |
    |* 12 |       TABLE ACCESS FULL          | CO_TRANS_MASTER         |     10 |       |       |          |
    |  13 |       TABLE ACCESS BY INDEX ROWID| SC_AGENT_EMP            |      1 |       |       |          |
    |* 14 |        INDEX UNIQUE SCAN         | PK_SC_AGENT_EMP         |      1 |       |       |          |
    |  15 |      TABLE ACCESS BY INDEX ROWID | PEOPLE_PROFILE          |      1 |       |       |          |
    |* 16 |       INDEX UNIQUE SCAN          | SYS_C0063100            |      1 |       |       |          |
    |* 17 |     INDEX RANGE SCAN             | IDX_PAY_DETAIL_TRANS_NO |      1 |       |       |          |
    |  18 |    TABLE ACCESS BY INDEX ROWID   | PAYMENT_DETAIL          |      1 |       |       |          |
    Predicate Information (identified by operation id):
       2 - access("F"."CO_TRANS_NO"=:B1)
       4 - access("F"."CO_TRANS_NO"=:B1)
       6 - access("F"."CO_TRANS_NO"=:B1)
      12 - filter((INTERNAL_FUNCTION("SYS_ALIAS_3"."CO_TRANS_ID") AND
                  TRIM(UPPER("SYS_ALIAS_3"."CO_NO"))='200101586W' AND ("SYS_ALIAS_3"."VOID_IND" IS NULL OR
                  "SYS_ALIAS_3"."VOID_IND"='N')))
      14 - access("SYS_ALIAS_3"."PROF_NO"="D"."PROF_NO" AND "SYS_ALIAS_3"."CREATED_BY"="D"."EMP_ID")
      16 - access("SYS_ALIAS_3"."CREATED_BY"="PP"."PP_ID")
      17 - access("SYS_ALIAS_3"."CO_TRANS_NO"="P"."TRANS_NO")
    Note
       - cardinality feedback used for this statement
       - Warning: basic plan statistics not available. These are only collected when:
           * hint 'gather_plan_statistics' is used for the statement or
           * parameter 'statistics_level' is set to 'ALL', at session or system level
    65 rows selected.

  • All sql

    [./solutions/atonx.sql]
    REM
    REM script ATONX.SQL
    REM =====================================
    SET AUTOTRACE ON EXPLAIN
    [./solutions/saved_settings.sql]
    set appinfo OFF
    set appinfo "SQL*Plus"
    set arraysize 15
    set autocommit OFF
    set autoprint OFF
    set autorecovery OFF
    set autotrace OFF
    set blockterminator "."
    set cmdsep OFF
    set colsep " "
    set compatibility NATIVE
    set concat "."
    set copycommit 0
    set copytypecheck ON
    set define "&"
    set describe DEPTH 1 LINENUM OFF INDENT ON
    set echo OFF
    set editfile "afiedt.buf"
    set embedded OFF
    set escape OFF
    set feedback ON
    set flagger OFF
    set flush ON
    set heading ON
    set headsep "|"
    set linesize 80
    set logsource ""
    set long 80
    set longchunksize 80
    set markup HTML OFF HEAD "<style type='text/css'> body {font:10pt Arial,Helvetica,sans-serif; color:black; background:White;} p {font:10pt Arial,Helvetica,sans-serif; color:black; background:White;} table,tr,td {font:10pt Arial,Helvetica,sans-serif; color:Black; background:#f7f7e7; padding:0px 0px 0px 0px; margin:0px 0px 0px 0px;} th {font:bold 10pt Arial,Helvetica,sans-serif; color:#336699; background:#cccc99; padding:0px 0px 0px 0px;} h1 {font:16pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; border-bottom:1px solid #cccc99; margin-top:0pt; margin-bottom:0pt; padding:0px 0px 0px 0px;} h2 {font:bold 10pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; margin-top:4pt; margin-bottom:0pt;} a {font:9pt Arial,Helvetica,sans-serif; color:#663300; background:#ffffff; margin-top:0pt; margin-bottom:0pt; vertical-align:top;}</style><title>SQL*Plus Report</title>" BODY "" TABLE "border='1' width='90%' align='center' summary='Script output'" SPOOL OFF ENTMAP ON PRE ON
    set newpage 1
    set null ""
    set numformat ""
    set numwidth 10
    set pagesize 14
    set pause OFF
    set recsep WRAP
    set recsepchar " "
    set serveroutput OFF
    set shiftinout invisible
    set showmode OFF
    set sqlblanklines OFF
    set sqlcase MIXED
    set sqlcontinue "> "
    set sqlnumber ON
    set sqlpluscompatibility 8.1.7
    set sqlprefix "#"
    set sqlprompt "SQL> "
    set sqlterminator ";"
    set suffix "sql"
    set tab ON
    set termout OFF
    set time OFF
    set timing OFF
    set trimout ON
    set trimspool OFF
    set underline "-"
    set verify ON
    set wrap ON
    [./solutions/sol_06_04d.sql]
    -- this script requires the sql id from the previous script to be substituted
    SELECT PLAN_TABLE_OUTPUT      
    FROM TABLE (DBMS_XPLAN.DISPLAY_AWR(' your sql id here'));
    [./solutions/rpsqlarea.sql]
    set feedback off
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR('your sql_id here'));
    set feedback on
    [./solutions/sqlid2.sql]
    SELECT SQL_ID, SQL_TEXT FROM V$SQL
    WHERE SQL_TEXT LIKE '%REPORT%' ;
    [./solutions/schemastats.sql]
    SELECT last_analyzed analyzed, sample_size, monitoring,
    table_name
    FROM user_tables;
    [./solutions/allrows.sql]
    REM
    REM script ALLROWS.SQL
    REM =====================================
    alter session set optimizer_mode = all_rows
    [./solutions/aton.sql]
    REM
    REM script ATON.SQL
    REM =====================================
    SET AUTOTRACE ON
    [./solutions/li.sql]
    REM script LI.SQL (list indexes)
    REM wildcards in table_name allowed,
    REM and a '%' is appended by default
    REM ======================================
    set termout off
    store set sqlplus_settings replace
    save buffer.sql replace
    set verify off autotrace off
    set feedback off termout on
    break on table_name skip 1 on index_type
    col table_name format a25
    col index_name format a30
    col index_type format a20
    accept table_name -
    prompt 'List indexes on table : '
    SELECT ui.table_name
    , decode(ui.index_type
    ,'NORMAL', ui.uniqueness
    ,ui.index_type) AS index_type
    , ui.index_name
    FROM user_indexes ui
    WHERE ui.table_name LIKE upper('&table_name.%')
    ORDER BY ui.table_name
    , ui.uniqueness desc;
    get buffer.sql nolist
    @sqlplus_settings
    set termout on
    [./solutions/utlxplp.sql]
    Rem
    Rem $Header: utlxplp.sql 23-jan-2002.08:55:23 bdagevil Exp $
    Rem
    Rem utlxplp.sql
    Rem
    Rem Copyright (c) 1998, 2002, Oracle Corporation. All rights reserved.
    Rem
    Rem NAME
    Rem utlxplp.sql - UTiLity eXPLain Parallel plans
    Rem
    Rem DESCRIPTION
    Rem script utility to display the explain plan of the last explain plan
    Rem     command. Display also Parallel Query information if the plan happens to
    Rem run parallel
    Rem
    Rem NOTES
    Rem Assume that the table PLAN_TABLE has been created. The script
    Rem utlxplan.sql should be used to create that table
    Rem
    Rem With SQL*plus, it is recomended to set linesize and pagesize before
    Rem running this script. For example:
    Rem     set linesize 130
    Rem     set pagesize 0
    Rem
    Rem MODIFIED (MM/DD/YY)
    Rem bdagevil 01/23/02 - rewrite with new dbms_xplan package
    Rem bdagevil 04/05/01 - include CPU cost
    Rem bdagevil 02/27/01 - increase Name column
    Rem jihuang 06/14/00 - change order by to order siblings by.
    Rem jihuang 05/10/00 - include plan info for recursive SQL in LE row source
    Rem bdagevil 01/05/00 - make deterministic with order-by
    Rem bdagevil 05/07/98 - Explain plan script for parallel plans
    Rem bdagevil 05/07/98 - Created
    Rem
    set markup html preformat on
    Rem
    Rem Use the display table function from the dbms_xplan package to display the last
    Rem explain plan. Use default mode which will display only relevant information
    Rem
    select * from table(dbms_xplan.display());
    [./solutions/cbinp.sql]
    REM Oracle10g SQL Tuning Workshop
    REM script CBI.SQL (create bitmap index)
    REM prompts for input; index name generated
    REM =======================================
    accept TABLE_NAME prompt " on which table : "
    accept COLUMN_NAME prompt " on which column: "
    set termout off
    store set saved_settings replace
    set heading off feedback off verify off
    set autotrace off termout on
    column dummy new_value index_name
    SELECT 'creating index'
    , SUBSTR( SUBSTR('&table_name',1,4)||'_' ||
    TRANSLATE(REPLACE('&column_name', ' ', '')
    , 1, 25
    )||'_idx' dummy
    FROM dual;
    CREATE BITMAP INDEX &index_name ON &TABLE_NAME(&COLUMN_NAME)
    NOLOGGING COMPUTE STATISTICS
    @saved_settings
    set termout on
    undef INDEX_NAME
    undef TABLE_NAME
    undef COLUMN_NAME
    [./solutions/dump.sql]
    SElECT *
    FROM v$parameter
    WHERE name LIKE '%dump%';
    [./solutions/utlxplan.sql]
    rem
    rem $Header: utlxplan.sql 29-oct-2001.20:28:58 mzait Exp $ xplainpl.sql
    rem
    Rem Copyright (c) 1988, 2001, Oracle Corporation. All rights reserved.
    Rem NAME
    REM UTLXPLAN.SQL
    Rem FUNCTION
    Rem NOTES
    Rem MODIFIED
    Rem mzait 10/26/01 - add keys and filter predicates to the plan table
    Rem ddas 05/05/00 - increase length of options column
    Rem ddas 04/17/00 - add CPU, I/O cost, temp_space columns
    Rem mzait 02/19/98 - add distribution method column
    Rem ddas 05/17/96 - change search_columns to number
    Rem achaudhr 07/23/95 - PTI: Add columns partition_{start, stop, id}
    Rem glumpkin 08/25/94 - new optimizer fields
    Rem jcohen 11/05/93 - merge changes from branch 1.1.710.1 - 9/24
    Rem jcohen 09/24/93 - #163783 add optimizer column
    Rem glumpkin 10/25/92 - Renamed from XPLAINPL.SQL
    Rem jcohen 05/22/92 - #79645 - set node width to 128 (M_XDBI in gendef)
    Rem rlim 04/29/91 - change char to varchar2
    Rem Peeler 10/19/88 - Creation
    Rem
    Rem This is the format for the table that is used by the EXPLAIN PLAN
    Rem statement. The explain statement requires the presence of this
    Rem table in order to store the descriptions of the row sources.
    create table PLAN_TABLE (
         statement_id      varchar2(30),
         timestamp      date,
         remarks      varchar2(80),
         operation      varchar2(30),
         options      varchar2(255),
         object_node      varchar2(128),
         object_owner      varchar2(30),
         object_name      varchar2(30),
         object_instance numeric,
         object_type varchar2(30),
         optimizer varchar2(255),
         search_columns number,
         id          numeric,
         parent_id     numeric,
         position     numeric,
         cost          numeric,
         cardinality     numeric,
         bytes          numeric,
         other_tag varchar2(255),
         partition_start varchar2(255),
    partition_stop varchar2(255),
    partition_id numeric,
         other          long,
         distribution varchar2(30),
         cpu_cost     numeric,
         io_cost          numeric,
         temp_space     numeric,
    access_predicates varchar2(4000),
    filter_predicates varchar2(4000));
    [./solutions/indstats.sql]
    accept table_name -
    prompt 'on which table : '
    SELECT index_name name, num_rows n_r,
    last_analyzed l_a, distinct_keys d_k,
    leaf_blocks l_b, avg_leaf_blocks_per_key a_l,join_index j_I
    FROM user_indexes
    WHERE table_name = upper('&table_name');
    undef table_name
    [./solutions/test.sql]
    declare
    x number;
    begin
    for i in 1..10000 loop
    select count(*) into x from customers;
    end loop;
    end;
    [./solutions/rp.sql]
    set feedback off
    SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
    set feedback on
    [./solutions/sol_08_02b.sql]
    ALTER SESSION SET SQL_TRACE = TRUE;
    [./solutions/trace.sql]
    ALTER SESSION SET SQL_TRACE = TRUE;
    [./solutions/doit.sql]
    DROP INDEX SALES_CH_BIX;
    DROP INDEX SALES_CUST_BIX;
    DROP INDEX SALES_PROD_BIX;
    [./solutions/ci.sql]
    REM SQL Tuning Workshop
    REM script CI.SQL (create index)
    REM prompts for input; index name generated
    REM =======================================
    accept TABLE_NAME prompt " on which table : "
    accept COLUMN_NAME prompt " on which column(s): "
    set termout off
    store set saved_settings replace
    set heading off feedback off autotrace off
    set verify off termout on
    column dummy new_value index_name
    SELECT 'creating index'
    , SUBSTR( SUBSTR('&table_name',1,4)||'_' ||
    TRANSLATE(REPLACE('&column_name', ' ', '')
    , 1, 25
    )||'_idx' dummy
    FROM dual;
    CREATE INDEX &index_name
    ON &table_name(&column_name)
    NOLOGGING COMPUTE STATISTICS;
    @saved_settings
    set termout on
    undef INDEX_NAME
    undef TABLE_NAME
    undef COLUMN_NAME
    [./solutions/sol_06_04c.sql]
    exec dbms_workload_repository.create_snapshot('ALL');
    [./solutions/sol_06_04a.sql]
    column sql_text format a25
    SELECT SQL_ID, SQL_TEXT FROM V$SQL
    WHERE SQL_TEXT LIKE '%REPORT%' ;
    [./solutions/login.sql]
    REM ======================================
    REM COL[UMN] commands
    REM ======================================
    col dummy new_value index_name
    col name format a32
    col segment_name format a20
    col table_name format a20
    col column_name format a20
    col index_name format a30
    col index_type format a10
    col constraint_name format a20
    col num_distinct format 999999
    col update_comment format a20 word
    -- for the SHOW SGA/PARAMETER commands:
    col name_col_plus_show_sga format a24
    col name_col_plus_show_param format a40 -
    heading name
    col value_col_plus_show_param format a35 -
    heading value
    -- for the AUTOTRACE setting:
    col id_plus_exp format 90 head i
    col parent_id_plus_exp format 90 head p
    col plan_plus_exp format a80
    col other_plus_exp format a44
    col other_tag_plus_exp format a29
    col object_node_plus_exp format a8
    REM ======================================
    REM SET commands
    REM ======================================
    set describe depth 2
    set echo off
    set editfile D:\Tmp\buffer.sql
    set feedback 40
    set linesize 120
    set long 999
    set numwidth 8
    set pagesize 36
    set pause "[Enter]..." pause off
    set tab off
    set trimout on
    set trimspool on
    set verify off
    set wrap on
    REM ======================================
    REM DEFINE commands
    REM ======================================
    def 1=employees
    def table_name=employees
    def column_name=first_name
    def buckets=1
    def sc=';'
    REM ======================================
    REM miscellaneous
    REM ======================================
    [./solutions/sqlid.sql]
    SELECT SQL_ID, SQL_TEXT FROM V$SQL
    WHERE SQL_TEXT LIKE '%/* my%' ;
    [./solutions/hist1.sql]
    SELECT * FROM products WHERE prod_status LIKE 'available, on stock'
    [./solutions/sol_08_02.sql]
    ALTER SESSION SET TRACEFILE_IDENTIFIER = 'User12';
    [./solutions/utlxrw.sql]
    Rem
    Rem $Header: utlxrw.sql 29-apr-2005.08:22:09 mthiyaga Exp $
    Rem
    Rem utlxrw.sql
    Rem
    Rem Copyright (c) 2000, 2005, Oracle. All rights reserved.
    Rem
    Rem NAME
    Rem utlxrw.sql - Create the output table for EXPLAIN_REWRITE
    Rem
    Rem DESCRIPTION
    Rem Outputs of the EXPLAIN_REWRITE goes into the table created
    Rem by utlxrw.sql (called REWRITE_TABLE). So utlxrw must be
    Rem     invoked before any EXPLAIN_REWRITE tests.
    Rem
    Rem NOTES
    Rem If user specifies a different name in EXPLAIN_REWRITE, then
    Rem it should have been already created before calling EXPLAIN_REWRITE.
    Rem
    Rem MODIFIED (MM/DD/YY)
    Rem mthiyaga 04/29/05 - Remove unncessary comment
    Rem mthiyaga 06/08/04 - Add rewritten_txt field
    Rem mthiyaga 10/10/02 - Add extra columns
    Rem mthiyaga 09/27/00 - Create EXPLAIN_REWRITE output table
    Rem mthiyaga 09/27/00 - Created
    Rem
    Rem
    CREATE TABLE REWRITE_TABLE(
    statement_id VARCHAR2(30), -- id for the query
    mv_owner VARCHAR2(30), -- owner of the MV
    mv_name VARCHAR2(30), -- name of the MV
    sequence INTEGER, -- sequence no of the error msg
    query VARCHAR2(2000),-- user query
    query_block_no INTEGER, -- block no of the current subquery
    rewritten_txt VARCHAR2(2000),-- rewritten query
    message VARCHAR2(512), -- EXPLAIN_REWRITE error msg
    pass VARCHAR2(3), -- rewrite pass no
    mv_in_msg VARCHAR2(30), -- MV in current message
    measure_in_msg VARCHAR2(30), -- Measure in current message
    join_back_tbl VARCHAR2(30), -- Join back table in current msg
    join_back_col VARCHAR2(30), -- Join back column in current msg
    original_cost INTEGER, -- Cost of original query
    rewritten_cost INTEGER, -- Cost of rewritten query
    flags INTEGER, -- associated flags
    reserved1 INTEGER, -- currently not used
    reserved2 VARCHAR2(10)) -- currently not used
    [./solutions/nm.sql]
    ALTER INDEX &indexname NOMONITORING USAGE;
    [./solutions/attox.sql]
    REM
    REM script ATTOX.SQL
    REM =====================================
    set autotrace traceonly explain
    [./solutions/create_tab.sql]
    DROP TABLE test_sales;
    DROP TABLE test_promotions;
    DROP TABLE test_customers;
    DROP TABLE test_countries;
    CREATE table test_sales as select * from sales;
    CREATE TABLE test_promotions AS SELECT * FROM promotions;
    CREATE INDEX t_promo_id_idx ON TEST_PROMOTIONS(promo_id);
    ALTER TABLE test_promotions MODIFY promo_id PRIMARY KEY USING INDEX t_promo_id_idx;
    CREATE TABLE test_customers AS SELECT * FROM customers;
    CREATE INDEX t_cust_id_idx ON TEST_CUSTOMERS(cust_id);
    ALTER TABLE test_customers MODIFY cust_id PRIMARY KEY USING INDEX t_cust_id_idx;
    CREATE TABLE test_countries AS SELECT * FROM countries;
    CREATE INDEX t_country_id_idx ON TEST_COUNTRIES(country_id);
    ALTER TABLE test_countries MODIFY country_id PRIMARY KEY USING INDEX t_country_id_idx;
    UPDATE test_customers SET cust_credit_limit = 1000 WHERE ROWNUM <= 15000;
    [./solutions/cui.sql]
    REM SQL Tuning Workshop
    REM script CUI.SQL (create unique index)
    REM prompts for input; index name generated
    REM =======================================
    accept TABLE_NAME prompt " on which table : "
    accept COLUMN_NAME prompt " on which column(s): "\
    set termout off
    store set saved_settings replace
    set heading off feedback off verify off
    set autotrace off termout on
    SELECT 'creating unique index'
    , SUBSTR('ui_&TABLE_NAME._' ||
    TRANSLATE(REPLACE('&COLUMN_NAME', ' ', '')
    , 1, 30) dummy
    from dual
    CREATE UNIQUE INDEX &INDEX_NAME ON &TABLE_NAME(&COLUMN_NAME)
    @saved_settings
    set termout on
    undef INDEX_NAME
    undef TABLE_NAME
    undef COLUMN_NAME
    [./solutions/advisor_cache_setup.sql]
    set echo on
    alter system flush shared_pool;
    grant advisor to sh;
    connect sh/sh;
    SELECT c.cust_last_name, sum(s.amount_sold) AS dollars,
    sum(s.quantity_sold) as quantity
    FROM sales s , customers c, products p
    WHERE c.cust_id = s.cust_id
    AND s.prod_id = p.prod_id
    AND c.cust_state_province IN ('Dublin','Galway')
    GROUP BY c.cust_last_name;
    SELECT c.cust_id, SUM(amount_sold) AS dollar_sales
    FROM sales s, customers c WHERE s.cust_id= c.cust_id GROUP BY c.cust_id;
    select sum(unit_cost) from costs group by prod_id;
    [./solutions/utlxmv.sql]
    Rem
    Rem $Header: utlxmv.sql 16-feb-2001.13:03:32 nshodhan Exp $
    Rem
    Rem utlxmv.sql
    Rem
    Rem Copyright (c) Oracle Corporation 2000. All Rights Reserved.
    Rem
    Rem NAME
    Rem utlxmv.sql - UTiLity for eXplain MV
    Rem
    Rem DESCRIPTION
    Rem The utility script creates the MV_CAPABILITIES_TABLE that is
    Rem used by the DBMS_MVIEW.EXPLAIN_MVIEW() API.
    Rem
    Rem NOTES
    Rem
    Rem MODIFIED (MM/DD/YY)
    Rem nshodhan 02/16/01 - Bug#1647071: replace mv with mview
    Rem raavudai 11/28/00 - Fix comment.
    Rem twtong 12/01/00 - fix for sql*plus
    Rem twtong 09/13/00 - modify mv_capabilities_tabe
    Rem twtong 08/18/00 - change create table to upper case
    Rem jraitto 06/12/00 - add RELATED_NUM and MSGNO columns
    Rem jraitto 05/09/00 - Explain_MV table
    Rem jraitto 05/09/00 - Created
    Rem
    CREATE TABLE MV_CAPABILITIES_TABLE
    (STATEMENT_ID VARCHAR(30), -- Client-supplied unique statement identifier
    MVOWNER VARCHAR(30), -- NULL for SELECT based EXPLAIN_MVIEW
    MVNAME VARCHAR(30), -- NULL for SELECT based EXPLAIN_MVIEW
    CAPABILITY_NAME VARCHAR(30), -- A descriptive name of the particular
    -- capability:
    -- REWRITE
    -- Can do at least full text match
    -- rewrite
    -- REWRITE_PARTIAL_TEXT_MATCH
    -- Can do at leat full and partial
    -- text match rewrite
    -- REWRITE_GENERAL
    -- Can do all forms of rewrite
    -- REFRESH
    -- Can do at least complete refresh
    -- REFRESH_FROM_LOG_AFTER_INSERT
    -- Can do fast refresh from an mv log
    -- or change capture table at least
    -- when update operations are
    -- restricted to INSERT
    -- REFRESH_FROM_LOG_AFTER_ANY
    -- can do fast refresh from an mv log
    -- or change capture table after any
    -- combination of updates
    -- PCT
    -- Can do Enhanced Update Tracking on
    -- the table named in the RELATED_NAME
    -- column. EUT is needed for fast
    -- refresh after partitioned
    -- maintenance operations on the table
    -- named in the RELATED_NAME column
    -- and to do non-stale tolerated
    -- rewrite when the mv is partially
    -- stale with respect to the table
    -- named in the RELATED_NAME column.
    -- EUT can also sometimes enable fast
    -- refresh of updates to the table
    -- named in the RELATED_NAME column
    -- when fast refresh from an mv log
    -- or change capture table is not
    -- possilbe.
    POSSIBLE CHARACTER(1), -- T = capability is possible
    -- F = capability is not possible
    RELATED_TEXT VARCHAR(2000),-- Owner.table.column, alias name, etc.
    -- related to this message. The
    -- specific meaning of this column
    -- depends on the MSGNO column. See
    -- the documentation for
    -- DBMS_MVIEW.EXPLAIN_MVIEW() for details
    RELATED_NUM NUMBER, -- When there is a numeric value
    -- associated with a row, it goes here.
    -- The specific meaning of this column
    -- depends on the MSGNO column. See
    -- the documentation for
    -- DBMS_MVIEW.EXPLAIN_MVIEW() for details
    MSGNO INTEGER, -- When available, QSM message #
    -- explaining why not possible or more
    -- details when enabled.
    MSGTXT VARCHAR(2000),-- Text associated with MSGNO.
    SEQ NUMBER);
                        -- Useful in ORDER BY clause when
    -- selecting from this table.
    [./solutions/di.sql]
    DROP INDEX &index_name;
    [./solutions/hist2.sql]
    SELECT * FROM products WHERE prod_status = 'obsolete'
    [./solutions/sol_06_04b.sql]
    -- this script requires the sql_id that you got from the previous step
    SELECT SQL_ID, SQL_TEXT FROM dba_hist_sqltext where sql_id ='yourr sql id here';
    [./solutions/tabstats.sql]
    accept table_name -
    prompt 'on which table : '
    SELECT last_analyzed analyzed, sample_size, monitoring,
    table_name
    FROM user_tables
    WHERE table_name = upper('&table_name');
    undef TABLE_NAME
    [./solutions/rewrite.sql]
    ALTER SESSION SET QUERY_REWRITE_ENABLED = true
    [./solutions/atto.sql]
    REM
    REM script ATTO.SQL
    REM =====================================
    set autotrace traceonly
    [./solutions/flush.sql]
    --this script flushes the shared pool
    alter system flush shared_pool
    [./solutions/atoff.sql]
    REM
    REM script ATOFF.SQLREM =====================================
    SET AUTOTRACE OFF
    [./solutions/cbi.sql]
    REM Oracle10g SQL Tuning Workshop
    REM script CBI.SQL (create bitmap index)
    REM prompts for input; index name generated
    REM =======================================
    accept TABLE_NAME prompt " on which table : "
    accept COLUMN_NAME prompt " on which column: "
    set termout off
    store set saved_settings replace
    set heading off feedback off verify off
    set autotrace off termout on
    column dummy new_value index_name
    SELECT 'creating index'
    , SUBSTR( SUBSTR('&table_name',1,4)||'_' ||
    TRANSLATE(REPLACE('&column_name', ' ', '')
    , 1, 25
    )||'_idx' dummy
    FROM dual;
    CREATE bitmap index &INDEX_NAME on &TABLE_NAME(&COLUMN_NAME)
    LOCAL NOLOGGING COMPUTE STATISTICS
    @saved_settings
    set termout on
    undef INDEX_NAME
    undef TABLE_NAME
    undef COLUMN_NAME
    [./solutions/buffer.sql]
    SELECT c.cust_last_name, c.cust_year_of_birth
    , co.country_name
    FROM customers c
    JOIN countries co
    USING (country_id)
    [./solutions/sol_08_04.sql]
    ALTER SESSION SET SQL_TRACE = false;
    [./solutions/sqlplus_settings.sql]
    set appinfo OFF
    set appinfo "SQL*Plus"
    set arraysize 15
    set autocommit OFF
    set autoprint OFF
    set autorecovery OFF
    set autotrace TRACEONLY EXPLAIN STATISTICS
    set blockterminator "."
    set cmdsep OFF
    set colsep " "
    set compatibility NATIVE
    set concat "."
    set copycommit 0
    set copytypecheck ON
    set define "&"
    set describe DEPTH 1 LINENUM OFF INDENT ON
    set echo OFF
    set editfile "afiedt.buf"
    set embedded OFF
    set escape OFF
    set feedback 6
    set flagger OFF
    set flush ON
    set heading ON
    set headsep "|"
    set linesize 80
    set logsource ""
    set long 80
    set longchunksize 80
    set markup HTML OFF HEAD "<style type='text/css'> body {font:10pt Arial,Helvetica,sans-serif; color:black; background:White;} p {font:10pt Arial,Helvetica,sans-serif; color:black; background:White;} table,tr,td {font:10pt Arial,Helvetica,sans-serif; color:Black; background:#f7f7e7; padding:0px 0px 0px 0px; margin:0px 0px 0px 0px;} th {font:bold 10pt Arial,Helvetica,sans-serif; color:#336699; background:#cccc99; padding:0px 0px 0px 0px;} h1 {font:16pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; border-bottom:1px solid #cccc99; margin-top:0pt; margin-bottom:0pt; padding:0px 0px 0px 0px;} h2 {font:bold 10pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; margin-top:4pt; margin-bottom:0pt;} a {font:9pt Arial,Helvetica,sans-serif; color:#663300; background:#ffffff; margin-top:0pt; margin-bottom:0pt; vertical-align:top;}</style><title>SQL*Plus Report</title>" BODY "" TABLE "border='1' width='90%' align='center' summary='Script output'" SPOOL OFF ENTMAP ON PRE OFF
    set newpage 1
    set null ""
    set numformat ""
    set numwidth 10
    set pagesize 14
    set pause OFF
    set recsep WRAP
    set recsepchar " "
    set serveroutput OFF
    set shiftinout invisible
    set showmode OFF
    set sqlblanklines OFF
    set sqlcase MIXED
    set sqlcontinue "> "
    set sqlnumber ON
    set sqlpluscompatibility 8.1.7
    set sqlprefix "#"
    set sqlprompt "SQL> "
    set sqlterminator ";"
    set suffix "sql"
    set tab ON
    set termout OFF
    set time OFF
    set timing OFF
    set trimout ON
    set trimspool OFF
    set underline "-"
    set verify ON
    set wrap ON
    [./solutions/sol_07_01.sql]
    SELECT owner, job_name,enabled
    FROM DBA_SCHEDULER_JOBS
    WHERE JOB_NAME = 'GATHER_STATS_JOB';
    [./solutions/colhist.sql]
    SELECT column_name, num_distinct, num_buckets, histogram
    FROM USER_TAB_COL_STATISTICS
    WHERE histogram <> 'NONE';
    [./solutions/rpawr.sql]
    set feedback off
    SELECT PLAN_TABLE_OUTPUT      
    FROM TABLE (DBMS_XPLAN.DISPLAY_AWR('&sqlid'));
    set feedback on
    [./solutions/im.sql]
    ALTER INDEX &indexname MONITORING USAGE;
    [./solutions/utlxpls.sql]
    Rem
    Rem $Header: utlxpls.sql 26-feb-2002.19:49:37 bdagevil Exp $
    Rem
    Rem utlxpls.sql
    Rem
    Rem Copyright (c) 1998, 2002, Oracle Corporation. All rights reserved.
    Rem
    Rem NAME
    Rem utlxpls.sql - UTiLity eXPLain Serial plans
    Rem
    Rem DESCRIPTION
    Rem script utility to display the explain plan of the last explain plan
    Rem     command. Do not display information related to Parallel Query
    Rem
    Rem NOTES
    Rem Assume that the PLAN_TABLE table has been created. The script
    Rem     utlxplan.sql should be used to create that table
    Rem
    Rem With SQL*plus, it is recomended to set linesize and pagesize before
    Rem running this script. For example:
    Rem     set linesize 100
    Rem     set pagesize 0
    Rem
    Rem MODIFIED (MM/DD/YY)
    Rem bdagevil 02/26/02 - cast arguments
    Rem bdagevil 01/23/02 - rewrite with new dbms_xplan package
    Rem bdagevil 04/05/01 - include CPU cost
    Rem bdagevil 02/27/01 - increase Name column
    Rem jihuang 06/14/00 - change order by to order siblings by.
    Rem jihuang 05/10/00 - include plan info for recursive SQL in LE row source
    Rem bdagevil 01/05/00 - add order-by to make it deterministic
    Rem kquinn 06/28/99 - 901272: Add missing semicolon
    Rem bdagevil 05/07/98 - Explain plan script for serial plans
    Rem bdagevil 05/07/98 - Created
    Rem
    set markup html preformat on
    Rem
    Rem Use the display table function from the dbms_xplan package to display the last
    Rem explain plan. Force serial option for backward compatibility
    Rem
    select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'));
    [./solutions/dai.sql]
    REM script DAI.SQL (drop all indexes)
    REM prompts for a table name; % is appended
    REM does not touch indexes associated with constraints
    REM ==================================================
    accept table_name -
    prompt 'on which table : '
    set termout off
    store set sqlplus_settings replace
    save buffer.sql replace
    set heading off verify off autotrace off feedback off
    spool doit.sql
    SELECT 'drop index '||i.index_name||';'
    FROM user_indexes i
    WHERE i.table_name LIKE UPPER('&table_name.%')
    AND NOT EXISTS
    (SELECT 'x'
    FROM user_constraints c
    WHERE c.index_name = i.index_name
    AND c.table_name = i.table_name
    AND c.status = 'ENABLED');
    spool off
    @doit
    get buffer.sql nolist
    @sqlplus_settings
    set termout on
    [./solutions/setupenv.sql]
    connect system/oracle
    GRANT DBA TO sh;
    GRANT CREATE ANY OUTLINE TO sh;
    GRANT ADVISOR TO sh;
    GRANT CREATE ANY VIEW TO sh;
    EXECUTE DBMS_

    What an insane topic. Where's your question?
    I recommend you to start over with a smart question and only the relevant code lines.
    Check this link: [How To Ask Questions The Smart Way|http://www.catb.org/~esr/faqs/smart-questions.html].

  • This query is taking a long time:

    Hi All,
    I need help in tuning this query. The stats are as below:
    SQL> show parameter user_dump_dest
    NAME                                 TYPE        VALUE
    user_dump_dest                       string      /opt/app/oracle/diag/rdbms/ebi
                                                     zfile/EBIZFILE/trace
    SQL> show parameter optimizer
    NAME                                 TYPE        VALUE
    optimizer_capture_sql_plan_baselines boolean     FALSE
    optimizer_dynamic_sampling           integer     2
    optimizer_features_enable            string      11.2.0.2
    optimizer_index_caching              integer     0
    optimizer_index_cost_adj             integer     100
    optimizer_mode                       string      ALL_ROWS
    optimizer_secure_view_merging        boolean     TRUE
    optimizer_use_invisible_indexes      boolean     FALSE
    optimizer_use_pending_statistics     boolean     FALSE
    optimizer_use_sql_plan_baselines     boolean     TRUE
    SQL> show parameter db_file_multi
    NAME                                 TYPE        VALUE
    db_file_multiblock_read_count        integer     128
    SQL> show parameter db_block_size
    NAME                                 TYPE        VALUE
    db_block_size                        integer     8192
    SQL> show parameter cursor_sharing
    NAME                                 TYPE        VALUE
    cursor_sharing                       string      EXACT
    SQL>
    SQL> column sname format a20
    SQL> column pname format a20
    SQL> column pval2 format a20
    SQL>
    SQL> select
      2  sname, pname, pval1, pval2
      3  from
      4  sys.aux_stats$;
    SNAME                PNAME                     PVAL1 PVAL2
    SYSSTATS_INFO        STATUS                          COMPLETED
    SYSSTATS_INFO        DSTART                          11-03-2009 02:33
    SYSSTATS_INFO        DSTOP                           11-03-2009 02:33
    SYSSTATS_INFO        FLAGS                         1
    SYSSTATS_MAIN        CPUSPEEDNW            714.19791
    SYSSTATS_MAIN        IOSEEKTIM                    10
    SYSSTATS_MAIN        IOTFRSPEED                 4096
    SYSSTATS_MAIN        SREADTIM
    SYSSTATS_MAIN        MREADTIM
    SYSSTATS_MAIN        CPUSPEED
    SYSSTATS_MAIN        MBRC
    SYSSTATS_MAIN        MAXTHR
    SYSSTATS_MAIN        SLAVETHR
    13 rows selected.
    Elapsed: 00:00:00.03
    SQL>
    SQL> explain plan for
      2   SELECT   A.TRANS_NO,
      3            A.TRANS_ID,
      4            A.REQUEST_IND,
      5            A.TRANS_STATUS_IND,
      6            A.TRANS_STATUS_DATE,
      7            A.DELIVERY_DATE,
      8            C.EMAIL_ADDR
      9        FROM     IIS_TRANS_MASTER A, M_TRANS B, IIS_REQUEST_TRANS C
    10       WHERE
    11             C.TRANS_NO = A.TRANS_NO
    12            AND A.TRANS_STATUS_IND = 'P'
    13            AND A.TRANS_ID = B.TRANS_ID
    14            AND A.TRANS_ID <> 'I009'
    15            AND A.TRANS_ID <> 'NPKG'
    16            AND B.TRANS_CO_TYPE = 'I'
    17            AND A.TRANS_ID NOT IN
    18                  ('P012', 'P13B', 'P13C', 'P14B', 'P14C', 'P015')
    19            AND B.DEPT = 'IRD'
    20  ORDER BY     A.CREATED_DATE;
    Explained.
    Elapsed: 00:00:00.01
    SQL>
    SQL> set pagesize 1000;
    SQL> set linesize 170;
    SQL> @/opt/app/oracle/product/11.2.0/rdbms/admin/utlxplp.sql
    SQL> Rem
    SQL> Rem $Header: utlxplp.sql 23-jan-2002.08:55:23 bdagevil Exp $
    SQL> Rem
    SQL> Rem utlxplp.sql
    SQL> Rem
    SQL> Rem Copyright (c) 1998, 2002, Oracle Corporation.     All rights reserved.
    SQL> Rem
    SQL> Rem    NAME
    SQL> Rem      utlxplp.sql - UTiLity eXPLain Parallel plans
    SQL> Rem
    SQL> Rem    DESCRIPTION
    SQL> Rem      script utility to display the explain plan of the last explain plan
    SQL> Rem      command. Display also Parallel Query information if the plan happens to
    SQL> Rem      run parallel
    SQL> Rem
    SQL> Rem    NOTES
    SQL> Rem      Assume that the table PLAN_TABLE has been created. The script
    SQL> Rem      utlxplan.sql should be used to create that table
    SQL> Rem
    SQL> Rem      With SQL*plus, it is recomended to set linesize and pagesize before
    SQL> Rem      running this script. For example:
    SQL> Rem      set linesize 130
    SQL> Rem      set pagesize 0
    SQL> Rem
    SQL> Rem    MODIFIED   (MM/DD/YY)
    SQL> Rem    bdagevil     01/23/02 - rewrite with new dbms_xplan package
    SQL> Rem    bdagevil     04/05/01 - include CPU cost
    SQL> Rem    bdagevil     02/27/01 - increase Name column
    SQL> Rem    jihuang     06/14/00 - change order by to order siblings by.
    SQL> Rem    jihuang     05/10/00 - include plan info for recursive SQL in LE row source
    SQL> Rem    bdagevil     01/05/00 - make deterministic with order-by
    SQL> Rem    bdagevil     05/07/98 - Explain plan script for parallel plans
    SQL> Rem    bdagevil     05/07/98 - Created
    SQL> Rem
    SQL>
    SQL> set markup html preformat on
    SQL>
    SQL> Rem
    SQL> Rem Use the display table function from the dbms_xplan package to display the last
    SQL> Rem explain plan. Use default mode which will display only relevant information
    SQL> Rem
    SQL> select * from table(dbms_xplan.display());
    PLAN_TABLE_OUTPUT
    Plan hash value: 3822676895
    | Id  | Operation                      | Name              | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT               |                   | 38075 |  3123K|       | 22550   (2)| 00:04:31 |
    |   1 |  SORT ORDER BY                 |                   | 38075 |  3123K|  3472K| 22550   (2)| 00:04:31 |
    |*  2 |   HASH JOIN                    |                   | 38075 |  3123K|  2120K| 21801   (2)| 00:04:22 |
    |   3 |    NESTED LOOPS                |                   |       |       |       |            |          |
    |   4 |     NESTED LOOPS               |                   | 38075 |  1673K|       |  4177   (1)| 00:00:51 |
    |*  5 |      TABLE ACCESS FULL         | M_TRANS           |    10 |    80 |       |     7   (0)| 00:00:01 |
    |*  6 |      INDEX RANGE SCAN          | IDX_IIS_TRANS_ID  | 39401 |       |       |   109   (3)| 00:00:02 |
    |*  7 |     TABLE ACCESS BY INDEX ROWID| IIS_TRANS_MASTER  |  3940 |   142K|       |  3186   (1)| 00:00:39 |
    |   8 |    TABLE ACCESS FULL           | IIS_REQUEST_TRANS |  2114K|    78M|       | 12368   (2)| 00:02:29 |
    Predicate Information (identified by operation id):
       2 - access("C"."TRANS_NO"="A"."TRANS_NO")
       5 - filter("B"."DEPT"='IRD' AND "B"."TRANS_CO_TYPE"='I' AND "B"."TRANS_ID"<>'I009' AND
                  "B"."TRANS_ID"<>'NPKG' AND "B"."TRANS_ID"<>'P012' AND "B"."TRANS_ID"<>'P13B' AND
                  "B"."TRANS_ID"<>'P13C' AND "B"."TRANS_ID"<>'P14B' AND "B"."TRANS_ID"<>'P14C' AND
                  "B"."TRANS_ID"<>'P015')
       6 - access("A"."TRANS_ID"="B"."TRANS_ID")
           filter("A"."TRANS_ID"<>'I009' AND "A"."TRANS_ID"<>'NPKG' AND "A"."TRANS_ID"<>'P012' AND
                  "A"."TRANS_ID"<>'P13B' AND "A"."TRANS_ID"<>'P13C' AND "A"."TRANS_ID"<>'P14B' AND
                  "A"."TRANS_ID"<>'P14C' AND "A"."TRANS_ID"<>'P015')
       7 - filter("A"."TRANS_STATUS_IND"='P')
    29 rows selected.
    Elapsed: 00:00:00.02
    SQL>
    SQL> rollback;
    Rollback complete.
    Elapsed: 00:00:00.00
    SQL>
    SQL> rem Set the ARRAYSIZE according to your application
    SQL> set autotrace traceonly arraysize 100
    SQL>
    SQL> alter session set tracefile_identifier = 'mytrace1';
    Session altered.
    Elapsed: 00:00:00.00
    SQL>
    SQL> rem if you're using bind variables
    SQL> rem define them here
    SQL>
    SQL> rem variable b_var1 number
    SQL> rem variable b_var2 varchar2(20)
    SQL>
    SQL> rem and initialize them
    SQL>
    SQL> rem exec :b_var1 := 1
    SQL> rem exec :b_var2 := 'DIAG'
    SQL> set pagesize 1000;
    SQL> set linesize 170;
    SQL> alter session set events '10046 trace name context forever, level 8';
    Session altered.
    Elapsed: 00:00:00.00
    SQL>  SELECT   A.TRANS_NO,
      2            A.TRANS_ID,
      3            A.REQUEST_IND,
      4            A.TRANS_STATUS_IND,
      5            A.TRANS_STATUS_DATE,
      6            A.DELIVERY_DATE,
      7            C.EMAIL_ADDR
      8        FROM     IIS_TRANS_MASTER A, M_TRANS B, IIS_REQUEST_TRANS C
      9       WHERE
    10             C.TRANS_NO = A.TRANS_NO
    11            AND A.TRANS_STATUS_IND = 'P'
    12            AND A.TRANS_ID = B.TRANS_ID
    13            AND A.TRANS_ID <> 'I009'
    14            AND A.TRANS_ID <> 'NPKG'
    15            AND B.TRANS_CO_TYPE = 'I'
    16            AND A.TRANS_ID NOT IN
    17                  ('P012', 'P13B', 'P13C', 'P14B', 'P14C', 'P015')
    18            AND B.DEPT = 'IRD'
    19  ORDER BY     A.CREATED_DATE;
    19 rows selected.
    Elapsed: 00:00:15.44
    Execution Plan
    Plan hash value: 3822676895
    | Id  | Operation                      | Name              | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT               |                   | 38075 |  3123K|       | 22550   (2)| 00:04:31 |
    |   1 |  SORT ORDER BY                 |                   | 38075 |  3123K|  3472K| 22550   (2)| 00:04:31 |
    |*  2 |   HASH JOIN                    |                   | 38075 |  3123K|  2120K| 21801   (2)| 00:04:22 |
    |   3 |    NESTED LOOPS                |                   |       |       |       |            |          |
    |   4 |     NESTED LOOPS               |                   | 38075 |  1673K|       |  4177   (1)| 00:00:51 |
    |*  5 |      TABLE ACCESS FULL         | M_TRANS           |    10 |    80 |       |     7   (0)| 00:00:01 |
    |*  6 |      INDEX RANGE SCAN          | IDX_IIS_TRANS_ID  | 39401 |       |       |   109   (3)| 00:00:02 |
    |*  7 |     TABLE ACCESS BY INDEX ROWID| IIS_TRANS_MASTER  |  3940 |   142K|       |  3186   (1)| 00:00:39 |
    |   8 |    TABLE ACCESS FULL           | IIS_REQUEST_TRANS |  2114K|    78M|       | 12368   (2)| 00:02:29 |
    Predicate Information (identified by operation id):
       2 - access("C"."TRANS_NO"="A"."TRANS_NO")
       5 - filter("B"."DEPT"='IRD' AND "B"."TRANS_CO_TYPE"='I' AND "B"."TRANS_ID"<>'I009' AND
                  "B"."TRANS_ID"<>'NPKG' AND "B"."TRANS_ID"<>'P012' AND "B"."TRANS_ID"<>'P13B' AND
                  "B"."TRANS_ID"<>'P13C' AND "B"."TRANS_ID"<>'P14B' AND "B"."TRANS_ID"<>'P14C' AND
                  "B"."TRANS_ID"<>'P015')
       6 - access("A"."TRANS_ID"="B"."TRANS_ID")
           filter("A"."TRANS_ID"<>'I009' AND "A"."TRANS_ID"<>'NPKG' AND "A"."TRANS_ID"<>'P012' AND
                  "A"."TRANS_ID"<>'P13B' AND "A"."TRANS_ID"<>'P13C' AND "A"."TRANS_ID"<>'P14B' AND
                  "A"."TRANS_ID"<>'P14C' AND "A"."TRANS_ID"<>'P015')
       7 - filter("A"."TRANS_STATUS_IND"='P')
    Statistics
             23  recursive calls
              0  db block gets
         164826  consistent gets
          74235  physical reads
              0  redo size
           1839  bytes sent via SQL*Net to client
            524  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
             19  rows processed
    SQL>
    SQL> disconnect
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options

    Hi Manik,
    1) Not really. Order by may not be required.
    2) After gathering the stats, below is the result:
    NAME_COL_PLUS_SHOW_PARAM                                                         TYPE
    VALUE_COL_PLUS_SHOW_PARAM
    user_dump_dest                                                                   string
    /opt/app/oracle/diag/rdbms/ebizfile/EBIZFILE/trace
    SQL> show parameter optimizer
    NAME_COL_PLUS_SHOW_PARAM                                                         TYPE
    VALUE_COL_PLUS_SHOW_PARAM
    Elapsed: 00:00:00.05
    SQL>  SELECT   A.TRANS_NO,
      2            A.TRANS_ID,
      3            A.REQUEST_IND,
      4            A.TRANS_STATUS_IND,
      5            A.TRANS_STATUS_DATE,
      6            A.DELIVERY_DATE,
      7            C.EMAIL_ADDR
      8        FROM     IIS_TRANS_MASTER A, M_TRANS B, IIS_REQUEST_TRANS C
      9       WHERE
    10             C.TRANS_NO = A.TRANS_NO
    11            AND A.TRANS_STATUS_IND = 'P'
    12            AND A.TRANS_ID = B.TRANS_ID
    13            AND A.TRANS_ID <> 'I009'
    14            AND A.TRANS_ID <> 'NPKG'
    15            AND B.TRANS_CO_TYPE = 'I'
    16            AND A.TRANS_ID NOT IN
    17                  ('P012', 'P13B', 'P13C', 'P14B', 'P14C', 'P015')
    18            AND B.DEPT = 'IRD'
    19  ORDER BY     A.CREATED_DATE;
    20 rows selected.
    Elapsed: 00:00:06.58
    Execution Plan
    Plan hash value: 3822676895
    | Id  | Operation                      | Name              | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT               |                   | 38091 |  3124K|       | 22553   (2)| 00:04:31 |
    |   1 |  SORT ORDER BY                 |                   | 38091 |  3124K|  3472K| 22553   (2)| 00:04:31 |
    |*  2 |   HASH JOIN                    |                   | 38091 |  3124K|  2128K| 21804   (2)| 00:04:22 |
    |   3 |    NESTED LOOPS                |                   |       |       |       |            |          |
    |   4 |     NESTED LOOPS               |                   | 38091 |  1673K|       |  4180   (1)| 00:00:51 |
    |*  5 |      TABLE ACCESS FULL         | M_TRANS           |    10 |    80 |       |     7   (0)| 00:00:01 |
    |*  6 |      INDEX RANGE SCAN          | IDX_IIS_TRANS_ID  | 39418 |       |       |   109   (3)| 00:00:02 |
    |*  7 |     TABLE ACCESS BY INDEX ROWID| IIS_TRANS_MASTER  |  3942 |   142K|       |  3189   (1)| 00:00:39 |
    |   8 |    TABLE ACCESS FULL           | IIS_REQUEST_TRANS |  2114K|    78M|       | 12368   (2)| 00:02:29 |
    Predicate Information (identified by operation id):
       2 - access("C"."TRANS_NO"="A"."TRANS_NO")
       5 - filter("B"."DEPT"='IRD' AND "B"."TRANS_CO_TYPE"='I' AND "B"."TRANS_ID"<>'I009' AND
                  "B"."TRANS_ID"<>'NPKG' AND "B"."TRANS_ID"<>'P012' AND "B"."TRANS_ID"<>'P13B' AND
                  "B"."TRANS_ID"<>'P13C' AND "B"."TRANS_ID"<>'P14B' AND "B"."TRANS_ID"<>'P14C' AND
                  "B"."TRANS_ID"<>'P015')
       6 - access("A"."TRANS_ID"="B"."TRANS_ID")
           filter("A"."TRANS_ID"<>'I009' AND "A"."TRANS_ID"<>'NPKG' AND "A"."TRANS_ID"<>'P012' AND
                  "A"."TRANS_ID"<>'P13B' AND "A"."TRANS_ID"<>'P13C' AND "A"."TRANS_ID"<>'P14B' AND
                  "A"."TRANS_ID"<>'P14C' AND "A"."TRANS_ID"<>'P015')
       7 - filter("A"."TRANS_STATUS_IND"='P')
    Statistics
             17  recursive calls
              0  db block gets
         158643  consistent gets
          49083  physical reads
              0  redo size
           1917  bytes sent via SQL*Net to client
            524  bytes received via SQL*Net from client
              2  SQL*Net roundtrips to/from client
              1  sorts (memory)
              0  sorts (disk)
             20  rows processedI am yet to try the DBMS_SQLTUNE.
    Are you able to give me in simplified form the steps in executing this query for the DBMS_SQLTUNE? Thanks!

  • Cost From BOM, WorkCentre, Routing

    Hai Techies,
    Could you please help me with some inputs for my query related to capturing cost from BOM, Workcentre, routing. To capture the cost should it always require to have an production order?
    My doubt is mainly with respect to new product where they are creating a new product and during the new product implementation. So for the new product there wont be any production orders(correct me if im wrong). In that case how to compute the cost of the product.
    Is there any possibilities.
    Thanking you in advance.
    Regards,
    Gopalakrishnan.S

    Hi,
    In SAP you need to have either production order ( Discrete ) or planned order ( REM) in place to capture the cost.
    cost are captured when you book confirmation in Co11n or MFBF.
    From PP side you need to maintined OPL8 custmizing for planned and actual costing variant. These costing varaints are created in CO.
    In BOM you need to mainating stock items and in staus / langauage text view maintin indicator , item relevent for costing.
    In Routing operations you need to maintin contorl key which allows costing as well as in detailed operation view maintain indicator, costing allowed for operations.
    Work center has cost center attched to it. It also has different costing formulas which helps you to claculate activity costs of individual operations to which work center is attached.
    Regards,
    Santosh Sarda

  • What is the meaning of Rem.Order Plan in the PS cost report S_ALR_87013558

    Hi,
    Does anyone know the meaning of "Rem. Order Plan" column in the PS Budget-related cost report-- S_ALR_87013558  Budget\actual\Commitment\Rem.Plan\Assigned? I understand all the other columns like budget, actuals, commitment and assigned, but I have no idea what the "Rem order plan' means?
    Thanks,

    In this report it is "Planned Cost - (Actual + Commitment)"
    Venkat
    Edited by: VenkatSrinvas Konda on Oct 16, 2008 8:09 AM

  • Manual creation of planned order in REM

    Hi, 
    Can we manually create a planned order in repetitive manufacturing? I know that in case we run MRP , then planned order for finished is created with order type 'PE' due to which it cannot be converted to production order.
    I dont want to run MRP , still can i create a planned order manually with the same order type 'PE' ? I tried in MD11, but not getting option to chose PE as it is not available  in F4 of planned order profile.
    Please help..
    Regards.

    Dear,
    You cannot create a planned order with PE order type manually, because a planned order of REM related material gets order type "PE" only when it is assigned with a Production Version.
    So achieve manual creation of REM Planned order with PE type with the following options,
    I - Using MD11 transaction create a planned order with LA type and assign a suitable REM related Production version to the planned order during creation itself, now this order would automatically become "PE" order type on saving the order.
    2. In the planning table using MF50, you can directly create a planned order for a production line using F7 key.
    Regards,
    Prasobh

  • REM Planned Orders being generated with Order type LA instead of PE

    Hi All,
    I'm running the Repetitive Manufacturing scenario and when I execute the MRP run for my Planned Independent Requirements, Planned orders are automatically generated with the order type LA. I understand that for repetitive manuf., planned orders should have the order typ PE.
    Is there something missing in config? How can I get the orders to be generated with the Order type PE??

    HI,
    Check the following settings which is required for REM
    1. Master Data -
    - Create Material master - MM01
    -Create BOM - CS01
    -Create rate Routing - CA21
    Create Rem profile - SPRO ->Production planning -> Rem.Manuf->Control data or use existing one
    Assign Bom seelction method = 2 & 3 (Prod version) in MRP view
    Rem MFG indicator - mrp view in MM01.
    Assign the REM profile to a material - MRP view in MM01.
    create Valid Production version - MRP view in MM01 & Check Rem mfg ind
    Assign the BOM and routings in Prod. Version
    2.For Preliminary Cost Estimate:
    Create version specific product cost collecter for Header material and preiminary cost estimate - KKF6N as per the settings in Rem profile. -
    3 For standard cat Estimate.
    create std Cost estimation(CK11n)
    std cost Estimation Mark & release(CK24)
    Thanks
    Hrishi

  • Firming planned order in rem

    hi,
    i want to firm all planned orders automatically(rem) .mrp run hapened a day before. i already given always firm  in rem profile 0002.
    but still not get firming ????

    Hi
    If you wsith to firm the planned orders through MRP run, then you have to assign MRP types with Firming types in the material master and the PTF. as you require Automatic firming, U can use P1 MRP type. so while MRP run all the planned orders available within the PTF will be firmed automatically and any new requirements within the PTF will be moved to the end of the PTF.
    Note system will automatically firm the Planned orders when  u make any changes to the same.
    Hope this helps
    BR
    SK
    Reward and close thread if useful

  • Planned order status details in rem

    Hai gurus,
    In discrete manufacturing after confirming the respective production order we can go to T.C co02 and give
    the respective production order number to view the status and from that we can know the operation details
    and status in the routing.
    Like wise after doing MFBF for a fert using the planned order say (x), suppose if i want to know the status
    and details of the  routings in the confirmed pld order (x) , how can i get the information.
    regards,
    sekar chand.

    Dear sekar chand,
    In standard SAP in REM scenario,there's no concept like planned order status,but if you have carried
    out confirmations using planned order in MFBF,then you can get that list alone in T Code MF12.
    Also in MF12 you can get the list of documents where you have carried out a normal backflush, or
    activity backflush etc.
    Still order status for planned orders can be brought into SAP ,but lots of developments has to be made.
    Regards
    Mangalraj.S

Maybe you are looking for