How to "TUNE" expdp?

All,
Server: Sun Solaris 10
Database: Oracle 10g (stand alone) 10.2.0.4
We are seeing one of our Batch processes running slow. During this period when it runs slow, we have extracted the AWR and ADDM reports. Below are the same for referece.
ADDM Report Highlights:*
         FINDING 1: 70% impact (70089 seconds)
PL/SQL execution consumed significant database time.
   RECOMMENDATION 1: SQL Tuning, 48% benefit (47865 seconds)
      ACTION: Tune the PL/SQL block with SQL_ID "9knuzfs7zmxmv". Refer to the
         "Tuning PL/SQL Applications" chapter of Oracle's "PL/SQL User's Guide
         and Reference"
         RELEVANT OBJECT: SQL statement with SQL_ID 9knuzfs7zmxmv
         BEGIN
         SYS.KUPW$WORKER.MAIN('SYS_EXPORT_FULL_06', 'SYS');
         END;
      RATIONALE: SQL statement with SQL_ID "9knuzfs7zmxmv" was executed 10
         times and had an average elapsed time of 5088 seconds.
      RATIONALE: Average time spent in PL/SQL execution was 4786 seconds.
   RECOMMENDATION 2: SQL Tuning, 22% benefit (22483 seconds)
      ACTION: Investigate the SQL statement with SQL_ID "59bh50fscntuj" for
         possible performance improvements.
         RELEVANT OBJECT: SQL statement with SQL_ID 59bh50fscntuj and
         PLAN_HASH 2198587470
         CREATE TABLE "ET$024BC2CC0001"
         "GUID",
         "LOGTYPE",
         "PUBDATALONG"
         ) ORGANIZATION EXTERNAL
         ( TYPE ORACLE_DATAPUMP  DEFAULT DIRECTORY DPUMP_DIR_CRON ACCESS
         PARAMETERS (DEBUG =0 DATAPUMP INTERNAL TABLE 
         "SYSADM"."PSIBLOGIBINFO"  JOB ( "SYS","SYS_EXPORT_FULL_06",1)
         WORKERID 2 PARALLEL 3 VERSION COMPATIBLE ENCRYPTPASSWORDISNULL )
         LOCATION ('bogus.dat') )  PARALLEL 3 REJECT LIMIT UNLIMITED
         AS SELECT /*+ PARALLEL(KU$,3) */ "GUID", "LOGTYPE",
         TO_LOB("PUBDATALONG")
         FROM RELATIONAL("SYSADM"."PSIBLOGIBINFO" ) KU$
      RATIONALE: SQL statement with SQL_ID "59bh50fscntuj" was executed 1
         times and had an average elapsed time of 22483 seconds.
      RATIONALE: At least one execution of the statement ran in parallel.
      RATIONALE: Average time spent in PL/SQL execution was 22224 seconds.
AWR Report Findings:*
WORKLOAD REPOSITORY report for
DB Name         DB Id    Instance     Inst Num Release     RAC Host       
HR8PRD         254316722 hr8prd              1 10.2.0.4.0  NO  uxhrpr53   
              Snap Id      Snap Time      Sessions Curs/Sess
Begin Snap:     34023 25-Jan-13 01:01:02       306       4.2
  End Snap:     34026 25-Jan-13 04:00:10       306       4.1
   Elapsed:              179.13 (mins)
   DB Time:            1,666.75 (mins)
Cache Sizes
~~~~~~~~~~~                       Begin        End
               Buffer Cache:    18,480M    18,480M  Std Block Size:         8K
           Shared Pool Size:     3,840M     3,840M      Log Buffer:    10,320K
Load Profile
~~~~~~~~~~~~                            Per Second       Per Transaction
                  Redo size:            384,182.98            139,221.48
              Logical reads:             67,752.53             24,552.38
              Block changes:              7,210.41              2,612.93
             Physical reads:              8,507.25              3,082.89
            Physical writes:                 72.47                 26.26
                 User calls:              1,365.84                494.96
                     Parses:                 71.19                 25.80
                Hard parses:                  2.36                  0.86
                      Sorts:                176.16                 63.84
                     Logons:                  0.09                  0.03
                   Executes:                891.55                323.08
               Transactions:                  2.76
  % Blocks changed per Read:   10.64    Recursive Call %:    39.52
Rollback per transaction %:    4.06       Rows per Sort:    12.92
Instance Efficiency Percentages (Target 100%)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            Buffer Nowait %:   99.99       Redo NoWait %:  100.00
            Buffer  Hit   %:   97.25    In-memory Sort %:  100.00
            Library Hit   %:   99.14        Soft Parse %:   96.68
         Execute to Parse %:   92.02         Latch Hit %:   98.84
Parse CPU to Parse Elapsd %:             % Non-Parse CPU:  100.00
Shared Pool Statistics        Begin    End
             Memory Usage %:   66.41   47.09
    % SQL with executions>1:   96.90   89.42
  % Memory for SQL w/exec>1:   97.06   92.53
Top 5 Timed Events                                         Avg %Total
~~~~~~~~~~~~~~~~~~                                        wait   Call
Event                                 Waits    Time (s)   (ms)   Time Wait Class
CPU time                                          2,843           2.8          
enq: KO - fast object checkpoi        1,594         810    508    0.8 Applicatio
log file sync                        12,011         152     13    0.2     Commit
Streams AQ: qmn coordinator wa            1           5   5000    0.0      Other
cursor: pin S wait on X                 533           5      9    0.0 Concurrenc
          -------------------------------------------------------------       Looks like ADDM is asking for tuning the EXPDP job itself !! The AWR report however shows some bottlenecks in log file sync and streams. I also believe the streams wait event is because of EXPDP itself.
Command used to take EXPDP is as under:
expdp userid=\"/ as sysdba\" directory=dpump_dir_cron full=y dumpfile=$expname logfile=$logexpname parallel=10 filesize=50GPlease advice.
Thanks,
Suddhasatwa

Parallelism is always good as long as you have enough processes and cpu resources. The settings for certain initialization parameters can affect the performance of Data Pump Export and Import. In particular, you can try using the following settings to improve performance, although the effect may not be the same on all platforms.
DISK_ASYNCH_IO=TRUE
DB_BLOCK_CHECKING=FALSE
DB_BLOCK_CHECKSUM=FALSE
Additionally, the following initialization parameters must have values set high enough to allow for maximum parallelism:
PROCESSES
SESSIONS
PARALLEL_MAX_SERVERS
FOR PARALLELISM ORACLE SAYS
Set the degree of parallelism to two times the number of CPUs, then tune from there. For Data Pump Export, the PARALLEL parameter value should be less than or equal to the number of dump files. For Data Pump Import, the PARALLEL parameter value should not be much larger than the number of files in the dump file set. A PARALLEL greater than one is only available in Enterprise Edition
Edited by: Karan on Jan 25, 2013 3:59 PM

Similar Messages

  • How to run expdp from client ?

    Hi All,
    I tried searching google and forums for my issue but to no avail > How to run expdp from client side ....like in my laptop.
    Because currently our PROD database server has no space for expdp dump file. So I want it directed to my laptop which has an extenal USB of 1TB harddisk...via client EXPDP
    import data using impdp command
    Posted on: 08-May-2012 11:36, by user: 841731 -- Relevance: 53% -- Show all results within this thread
    below command is correct or not? if it is not correct could you please send me the correct command. impdp user/pass@databasename schemas=sourceschemaname remap_schema=sourceschemaname:destinationschemaname ...
    System generated Index names different on target database after expdp/impdp
    Posted on: 30-May-2012 11:58, by user: 895124 -- Relevance: 43% -- Show all results within this thread
    After performing expdp/impdp to move data from one database (A) to another (B), the system name generated indexes has different ...
    [ETL] TTS vs expdp/impdp vs ctas (dblink
    Posted on: 08-May-2012 21:10, by user: 869578 -- Relevance: 39% -- Show all results within this thread
    (table : 500 giga, index : 500 giga), how much faster is TTS (transportable tablespace) over expdp/impdp, and over ctas (dblink) ? As you know, the speed of etl depends on the hardware capacity. (io ...
    Oracle Client
    Posted on: 21-Jun-2012 22:47, by user: Sh**** -- Relevance: 32% -- Show all results within this thread
    Hi Guys, Please can you guys elaborate the difference between Oracle Client and Oracle Instant Client. Also, please can you advise from where I can download the Oracle normal ...
    Oracle 10g Client
    Posted on: 05-Jun-2012 10:11, by user: dzm -- Relevance: 26% -- Show all results within this thread
    to search at oracle site and this forum, but i wasn't able to find a link to download the oracle 10g client. I really need especificaly the 10g version. Anybody know the link or another way to download ...
    9i client to access 11g database
    Posted on: 22-Jun-2012 07:31, by user: kkrm333 -- Relevance: 24% -- Show all results within this thread
    Hi, Can i access a 11g database using 9i client? Thanks,
    SQLplus in Oracle Client
    Posted on: 14-Jun-2012 00:36, by user: Tim B. -- Relevance: 24% -- Show all results within this thread
    Hi, I tried to install an 11g oracle client in linux. As I've compared the files with the files when you install using the oracle instant ...
    Re: Information on Oracle Client 11202-1.1.4-6
    Posted on: 05-Jun-2012 03:33, by user: 898763 -- Relevance: 23% -- Show all results within this thread
    Actually thats the client requirement
    Analysing the performance of a single client
    Posted on: 28-Mar-2012 02:05, by user: 880172 -- Relevance: 23% -- Show all results within this thread
    timeouts even on some of the simplest queries. I want to try and get some data about how just this one client is performing and what it’s doing, but everything Google has thrown up so far is orientated around ...
    to make client connection as sys
    Posted on: 12-Jun-2012 22:04, by user: user11221081 -- Relevance: 23% -- Show all results within this thread
    Dear gurus can i connect to my server from my client machine with sysdba without giving sys password i have connected in different ways as sys@abc ...Thanks a lot.

    Though you can initiate the binary from your client side but for the file creation, there is no other way but to store it on the server side. So your best bet would be to get some space free on the server side of yours.
    Aman....

  • Query takes long time 41 seconds to run how to tune

    my query is simple as follows...i dont know how to tune it..
    cur_memb_count (p_as_of_date IN date)
    is
    select
    count(ip.individual_id) membercount,
    --lpad(re.region_id,2,'0')||lpad('000',3,'0')||lpad( pb.plan_cd,3,'0') group_id,
    substr(pb.plan_cd,1,1)||lpad(re.region_id, 2,'0')||'0000' group_id,
    ipp.legal_entity_id,
    bus.gl_bus_unit_a,
    bus.lob,
    loc.gl_loc_nbr_a,
    prod.gl_product_cd_a,
    prod.gl_fin_argmt_a,pb.plan_type_id ,pb.plan_cd
    from
    plan pb ,region_map re , state_plan_billing spb,
    insured_plan_profile ipp , insured_plan ip ,
    ods.oods_gl_bus_unit bus, ods.oods_gl_loc_nbr loc,
    ods.oods_gl_product_line prod,
    household h,
    employer_household eh
    where
    ipp.residence_st_plan_billing_id = spb.state_plan_billing_id
    and ipp.insured_plan_id = ip.insured_plan_id
    and ip.plan_cd = pb.plan_cd
    and pb.plan_cd=spb.plan_cd
    -- and pb.plan_type_id = loc.lob
    and spb.state_cd = re.state_cd
    and p_as_of_date between ip.insured_plan_effective_date and
    nvl(ip.insured_plan_termination_date,'31-dec-9999')
    and ip.insured_plan_effective_date <>
    nvl(ip.insured_plan_termination_date,'31-dec-9999')
    -- the condition below is necessary. but not enough data to test.when
    uncommented will only give
    -- a few records. try testing it just by uncommenting it.
    --and p_as_of_date between re.region_map_start_date and re.region_map_stop_date
    and loc.lob=prod.lob and loc.lob=bus.lob(+) and loc.company_cd=bus.company_cd(+)
    and p_as_of_date between pb.plan_start_date and pb.plan_stop_date
    and p_as_of_date between ipp.ins_plan_profile_start_date and
    ipp.ins_plan_profile_stop_date
    -- and lpad(re.region_id,2,'0')||lpad('000',3,'0')||lpad(pb.plan_cd,3,'0')
    = loc.group_id
    and substr(pb.plan_cd,1,
    1)||lpad(re.region_id,2,'0')||nvl(employee_id,'0000') =loc.group_id
    and p_household_id_param = h.household_id
    and h.household_id = eh.employer_household_id
    and p_date_param between eh.emp_hhold_start_date and eh.emp_hhold_stop_date
    and insplan.individual_id=housmemb.individual_id(+)
    and eh.delete_ind = 'N'
    group by
    --lpad(re.region_id,2,'0')||lpad('000',3,'0')||lpad(pb.plan_cd,3,'0'),
    substr(pb.plan_cd ,1,1)||lpad(re.region_id,2, '0')||nvl(employee_id,'0000'),

    If many full table scans on big tables consider creating indexes. Or if many index reads consider forcing full table scans :)
    Ah, I just love these tuning questions. "My query is slow. Please make it go fast". Sure, put on these red shoes, click your heels three times and make a wish. Alas, tuning is rather more complicated than that, more of a science than a voodoo rirtual. We would like to help. But we need more data, some concrete figures. Otherwise we're just guessing.
    So, first off, please read the Performance Tuning Guide. Apply some of its techniques. If you still don't understand why your query is running slow, come back to us with table descriptions, volumetrics, indexes, explain plans, stats, timings and tkprof output.
    Good luck, APC

  • How to map expdp parallele process to output file

    How to map expdp parallel process to its output file while running...
    say i use expdp dumpfile=test_%U.dmp parallel=5 ..
    Each parallele process writing to its related output file.. i want to know the mapping in run time...

    I'm not sure if this information is reported in the status command but it's worth a shot. You can get to the status command 2 ways:
    if you are running a datapump job from a terminal window, then while it is running, type ctl-c and you will get the datapump prompt. Either IMPORT> or EXPORT>
    IMPORT> status
    If you type status, it will tell you a bunch of information about the job and then each process. It may have dumpfile information in there.
    If you run it interactively, then you need to attach to the job. To do this, you need to know the job name. If you don't know, you can look at sys.dba_datapump_jobs if prived, or sys.user_datapump_jobs if not prived. You will see a job name and a schema name. Once you have that, you can:
    expdp user/password attach=schema.job_name
    This will bring you to the EXPORT>/iMPORT> prompt. Type status there.
    Like I said, I'm not sure if file name information is specified, but it might be. If it is not there, then I don't know of any other way to get it.
    Dean

  • How to Tune the Transactions/ Z - reports /Progr..of High response time

    Dear friends,
    in <b>ST03</b> work load anlysis menu.... there are some z-reports, transactions, and some programmes are noticed contineously that they are taking the <b>max. response time</b> (and mostly >90%of time is  DB Time ).
    how to tune the above situation ??
    Thank u.

    Siva,
    You can start with some thing like:
    ST04  -> Detail Analysis -> SQL Request (look at top disk reads and buffer get SQL statements)
    For the top SQL statements identified you'd want to look at the explain plan to determine if the SQL statements is:
    1) inefficient
    2) are your DB stats up to date on the tables (note up to date stats does not always means they are the best)
    3) if there are better indexes available, if not would a more suitable index help?
    4) if there are many slow disk reads, is there an I/O issue?
    etc...
    While you're in ST04 make sure your buffers are sized adequately.
    Also make sure your Oracle parameters are set according to this OSS note.
    Note 830576 - Parameter recommendations for Oracle 10g

  • How to tune the performance of Oracle SQL/XML query?

    Hi all,
    I am running Oracle 9i and like to run the following Oracle SQL/XML query. It takes about 3+ hour and still not finish. If I get rid all the XML stuffs it only take minutes to run. Does anybody know how to what's the reason of this slow and how to tune it?
    SELECT XMLElement("CUSTOMER",
    XMLForest(C_CUSTKEY "C_CUSTKEY", C_NAME "C_NAME", C_ADDRESS "C_ADDRESS", C_PHONE "C_PHONE", C_MKTSEGMENT "C_MKTSEGMENT", C_COMMENT "C_COMMENT"),
    (SELECT XMLAgg(XMLElement("ORDERS",
    XMLForest(O_ORDERKEY "O_ORDERKEY", O_CUSTKEY "O_CUSTKEY", O_ORDERSTATUS "O_ORDERSTATUS", O_ORDERPRIORITY "O_ORDERPRIORITY", O_CLERK "O_CLERK", O_COMMENT "O_COMMENT"),
    (SELECT XMLAgg(XMLElement("LINEITEM",
    XMLForest(L_ORDERKEY "L_ORDERKEY", L_RETURNFLAG "L_RETURNFLAG", L_LINESTATUS "L_LINESTATUS", L_SHIPINSTRUCT "L_SHIPINSTRUCT", L_SHIPMODE "L_SHIPMODE", L_COMMENT "L_COMMENT")
    FROM LINEITEM
    WHERE LINEITEM.L_ORDERKEY = ORDERS.O_ORDERKEY)
    FROM ORDERS
    WHERE ORDERS.O_CUSTKEY = CUSTOMER.C_CUSTKEY)
    FROM CUSTOMER ;
    Thanks very much in advance for your time,
    Jinghao Liu

    ajallen wrote:
    Why not something more like
    SELECT *
    FROM fact1 l,
    FULL OUTER JOIN fact1 d
    ON l.company = d.company
    AND l.transactiontypeid = 1
    AND d.transactiontypeid = 2;
    Because this is not an equivalent of the original query.
    drop table t1 cascade constraints purge;
    drop table t2 cascade constraints purge;
    create table t1 as select rownum t1_id from dual connect by level <= 5;
    create table t2 as select rownum+2 t2_id from dual connect by level <= 5;
    select * from (select * from t1 where t1_id > 2) t1 full outer join t2 on (t1_id = t2_id);
    select * from t1 full outer join t2 on (t1_id = t2_id and t1_id > 2);
         T1_ID      T2_ID
             3          3
             4          4
             5          5
                        6
                        7
         T1_ID      T2_ID
             1
             2
             3          3
             4          4
             5          5
                        6
                        7

  • How to tune this query for the improve performance ?

    Hi All,
    How to tune this query for the improve performance ?
    select a.claim_number,a.pay_cd,a.claim_occurrence_number,
    case
    when sum(case
    when a.payment_status_cd ='0'
    then a.payment_est_amt
    else 0
    end
    )=0
    then 0
    else (sum(case
    when a.payment_status_cd='0'and a.payment_est_amt > 0
    then a.payment_est_amt
    else 0
    end)
    - sum(case
    when a.payment_status_cd<>'0'
    then a.payment_amt
    else 0
    end))
    end as estimate
    from ins_claim_payment a
    where a.as_of_date between '31-jan-03' and '30-aug-06'
    and ( a.data_source = '25' or (a.data_source between '27' and '29'))
    and substr(a.pay_cd,1,1) IN ('2','3','4','8','9')
    group by a.claim_number, a.pay_cd, a.claim_occurrence_number
    Thank you,
    Mcka

    Mcka
    As well as EXPLAIN PLAN, let us know what proportion of rows are visited by this query. It may be that it is not using a full table scan when it should (or vice versa).
    And of course we'd need to know what indexes are available, and how selective they are for the predicated you have in this query ...
    Regards Nigel

  • Hey guys getting upset about how i tunes is debiting $1 from my account every month is it happening yo anybody else..i didnt buy anything from the stores...whats wrong.. they just cant debit frm my acc???

    hey guys getting upset about how i tunes is debiting $1 from my account every month is it happening yo anybody else..i didnt buy anything from the stores...whats wrong.. they just cant debit frm my acc???

    Have the same problem here... don't know what to do...

  • How to tune segmapsize in solaris

    Hi
    Does anyone has better explanation on how to tune segmapsize in Solaris 8.
    How to check configured value. From below command what can be concluded ?
    root@mdsmdcs1 / # kstat -n segmap
    module: unix instance: 0
    name: segmap class: vm
    crtime 182.906817812
    fault 19689020
    faulta 0
    free 386405
    free_dirty 134
    free_notfree 1749
    get_nofree 0
    get_nomtx 0
    get_reclaim 139897711
    get_reuse 572646
    get_unused 0
    get_use 6178
    getmap 140718838
    pagecreate 2707028
    rel_abort 0
    rel_async 2673641
    rel_dontneed 2618364
    rel_free 92063
    rel_write 2745169
    release 137881594
    snaptime 10790699.8598267
    stolen 0
    i.e eeprom segmapsize=0x40000000

    In Solaris 10 you can tune it by setting 'segmap_percent' in /etc/system, i can imagine its doable in Solaris 8 as well.
    See the tunables reference:
    http://docs.sun.com/app/docs/doc/816-0607?l=all
    .7/M.

  • How to tune the follwoing procedure?

    create or replace procedure sample(verror_msg in out varchar2,
    vbrn_num in tb_branches.brn_num%type) is
    ltext1 varchar2(500);
    ltext2 varchar2(500);
    ltable_name varchar2(50);
    lcolumn_name varchar2(50);
    ldata_type varchar2(50);
    lold_rcn_num number;
    lnew_rcn_num number;
    lvalue varchar2(50);
    lunit_type char(1);
    lsql_stmt1 varchar2(500);
    lstring varchar2(500);
    lcol varchar2(10);
    lstart_time VARCHAR2(100);
    lend_time VARCHAR2(100);
    lcommit VARCHAR2(10) := 'COMMIT;';
    lfile_handle1 utl_file.file_type;
    lfile_handle2 utl_file.file_type;
    lfile_handle3 utl_file.file_type;
    lfile_handle4 utl_file.file_type;
    lfile_name1 VARCHAR2(50) := 'RCN_UPDATE_STMTS_' || vbrn_num || '.SQL';
    lfile_name2 VARCHAR2(50) := 'RCNSUCCESS_' || vbrn_num || '.TXT';
    lfile_name3 VARCHAR2(50) := 'RCNFAIL_' || vbrn_num || '.TXT';
    lfile_name4 VARCHAR2(50) := 'RCNERROR_' || vbrn_num || '.TXT';
    ldirectory_name VARCHAR2(100);
    ldirectory_path VARCHAR2(100);
    lspool_on VARCHAR2(100);
    lspool_off VARCHAR2(100);
    TYPE ref_cur IS REF CURSOR;
    cur_tab_cols ref_cur;
    cursor c1 is
    SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE
    FROM USER_TAB_COLS
    WHERE TABLE_NAME NOT LIKE 'TB_CONV%'
    and TABLE_NAME LIKE 'TB_%'
    AND COLUMN_NAME LIKE '%RCN%'
    UNION
    SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE
    FROM USER_TAB_COLS
    WHERE TABLE_NAME in ('TB_UNITCODES', 'TB_HIST_UNITCODES')
    AND COLUMN_NAME = 'UNIT_CODE'
    order by table_name;
    BEGIN
    verror_msg := nvl(verror_msg, 0);
    begin
    SELECT DISTINCT directory_path, directory_name
    INTO ldirectory_path, ldirectory_name
    FROM tb_conv_path
    WHERE brn_num = vbrn_num;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    SP_CO_RAISEERROR('00SY00402', 'F', 'T');
    WHEN others THEN
    SP_CO_RAISEERROR('00SY00401X', 'F', 'T');
    END;
    lfile_handle1 := utl_file.fopen(ldirectory_name, lfile_name1, 'W', 32767);
    lfile_handle2 := utl_file.fopen(ldirectory_name, lfile_name2, 'W', 32767);
    lfile_handle3 := utl_file.fopen(ldirectory_name, lfile_name3, 'W', 32767);
    lfile_handle4 := utl_file.fopen(ldirectory_name, lfile_name4, 'W', 32767);
    SELECT 'SPOOL ' || ldirectory_path || '/LOG_' || lfile_name1
    INTO lspool_on
    FROM dual;
    utl_file.put_line(lfile_handle1, lspool_on);
    utl_file.new_line(lfile_handle1, 1);
    select 'EXEC SP_CONV_START_TIMELOG(' || '''' || 'LOG_' || lfile_name1 || '''' || ',' ||
    vbrn_num || ');'
    into lstart_time
    from dual;
    UTL_FILE.PUT_LINE(lfile_handle1, lstart_time);
    UTL_FILE.NEW_LINE(lfile_handle1, 1);
    open C1;
    loop
    Fetch C1
    into ltable_name, lcolumn_name, ldata_type;
    Exit When C1%notFound;
    lsql_stmt1 := 'select column_name from user_tab_columns where table_name =' || '''' ||
    ltable_name || '''' ||
    ' AND column_name in (''BRN_NUM'',''BRANCH'',''BRANCH_NUMBER'')';
    begin
    execute immediate lsql_stmt1
    into lcol;
    exception
    when no_data_found then
    lcol := null;
    end;
    if lcol is not null then
    if ltable_name in ('TB_UNITCODES', 'TB_HIST_UNITCODES') then
    ltext2 := 'select distinct ' || lcolumn_name || ' from ' ||
    ltable_name ||
    ' a, (select distinct new_rcn_num col from tb_conv_rcn_mapping where brn_num = ' ||
    vbrn_num || ') b where a.' || lcolumn_name ||
    ' = b.col(+) and b.col is null and a.' || lcolumn_name ||
    ' is not null and ' || lcol || ' = ' || vbrn_num ||
    ' and a.unit_type=''9''';
    else
    ltext2 := 'select distinct ' || lcolumn_name || ' from ' ||
    ltable_name ||
    ' a, (select distinct new_rcn_num col from tb_conv_rcn_mapping where brn_num = ' ||
    vbrn_num || ') b where a.' || lcolumn_name ||
    ' = b.col(+) and b.col is null and a.' || lcolumn_name ||
    ' is not null and ' || lcol || ' = ' || vbrn_num;
    end if;
    OPEN cur_tab_cols FOR ltext2;
    loop
    fetch cur_tab_cols
    into lvalue;
    exit when cur_tab_cols%notfound;
    begin
    IF VBRN_NUM IN (21, 6, 7, 8) THEN  Commented during NAP HK SIT cycle1
    SELECT DISTINCT NEW_RCN_NUM, OLD_RCN_NUM
    INTO LNEW_RCN_NUM, LOLD_RCN_NUM
    FROM TB_CONV_RCN_MAPPING
    WHERE OLD_RCN_NUM = LVALUE
    AND BRN_NUM = VBRN_NUM;
    /* ELSE
    SELECT DISTINCT NEW_RCN_NUM, OLD_RCN_NUM
    INTO LNEW_RCN_NUM, LOLD_RCN_NUM
    FROM TB_CONV_RCN_MAPPING
    WHERE OLD_RCN_NUM = LVALUE
    AND NEW_RCN_NUM NOT LIKE '40%'
    AND NEW_RCN_NUM NOT LIKE '41%'
    AND NEW_RCN_NUM NOT LIKE '42%'
    AND NEW_RCN_NUM NOT LIKE '65%'
    AND BRN_NUM = VBRN_NUM;
    END IF; */ -- Commented during NAP HK SIT cycle1
    if ldata_type = 'NUMBER' then
    if ltable_name in ('TB_UNITCODES', 'TB_HIST_UNITCODES') and
    lcolumn_name = 'UNIT_CODE' then
    begin
    select distinct unit_type
    into lunit_type
    from TB_UNITCODES
    where lcol = vbrn_num
    and unit_code = lvalue
    and unit_type = '9';
    exception
    when no_data_found then
    lunit_type := null;
    end;
    if lunit_type is not null then
    ltext1 := 'update ' || ltable_name || ' set ' ||
    lcolumn_name || ' = ' || lnew_rcn_num ||
    ' where ' || lcolumn_name || ' = ' ||
    lold_rcn_num || ' and ' || lcol || ' = ' ||
    vbrn_num || ' and unit_type = ' || '''9''' || ';';
    utl_file.put_line(lfile_handle1, ltext1);
    utl_file.new_line(lfile_handle1, 0);
    utl_file.put_line(lfile_handle1, lcommit);
    utl_file.put_line(lfile_handle2,
    ltable_name || ' - ' || lcolumn_name ||
    ' - ' || lold_rcn_num || ' - ' ||
    lnew_rcn_num || ' - ' || vbrn_num);
    utl_file.new_line(lfile_handle2, 0);
    end if;
    else
    ltext1 := 'update ' || ltable_name || ' set ' || lcolumn_name ||
    ' = ' || lnew_rcn_num || ' where ' || lcolumn_name ||
    ' = ' || lold_rcn_num || ' and ' || lcol || ' = ' ||
    vbrn_num || ';';
    utl_file.put_line(lfile_handle1, ltext1);
    utl_file.new_line(lfile_handle1, 0);
    utl_file.put_line(lfile_handle1, lcommit);
    utl_file.new_line(lfile_handle1, 0);
    utl_file.put_line(lfile_handle2,
    ltable_name || ' - ' || lcolumn_name ||
    ' - ' || lold_rcn_num || ' - ' ||
    lnew_rcn_num || ' - ' || vbrn_num);
    utl_file.new_line(lfile_handle2, 0);
    end if;
    else
    if ltable_name in ('TB_UNITCODES', 'TB_HIST_UNITCODES') and
    lcolumn_name = 'UNIT_CODE' then
    begin
    lstring := 'select distinct unit_type from ' || ltable_name ||
    ' where ' || lcol || ' = ' || vbrn_num ||
    ' and ' || lcolumn_name || ' = ' || '''' ||
    lvalue || '''' || ' and unit_type = ' || '''9''';
    execute immediate lstring
    into lunit_type;
    exception
    when no_data_found then
    lunit_type := null;
    end;
    if lunit_type is not null then
    ltext1 := 'update ' || ltable_name || ' set ' ||
    lcolumn_name || ' = ' || '''' || lnew_rcn_num || '''' ||
    ' where ' || lcolumn_name || ' = ' || '''' ||
    lold_rcn_num || '''' || ' and ' || lcol || ' = ' ||
    vbrn_num || ' and unit_type = ' || '''9''' || ';';
    utl_file.put_line(lfile_handle1, ltext1);
    utl_file.new_line(lfile_handle1, 0);
    utl_file.put_line(lfile_handle1, lcommit);
    utl_file.new_line(lfile_handle1, 0);
    utl_file.put_line(lfile_handle2,
    ltable_name || ' - ' || lcolumn_name ||
    ' - ' || lold_rcn_num || ' - ' ||
    lnew_rcn_num || ' - ' || vbrn_num);
    utl_file.new_line(lfile_handle2, 0);
    end if;
    else
    ltext1 := 'update ' || ltable_name || ' set ' || lcolumn_name ||
    ' = ' || '''' || lnew_rcn_num || '''' || ' where ' ||
    lcolumn_name || ' = ' || '''' || lold_rcn_num || '''' ||
    ' and ' || lcol || ' = ' || vbrn_num || ';';
    utl_file.put_line(lfile_handle1, ltext1);
    utl_file.new_line(lfile_handle1, 0);
    utl_file.put_line(lfile_handle1, lcommit);
    utl_file.new_line(lfile_handle1, 0);
    utl_file.put_line(lfile_handle2,
    ltable_name || ' - ' || lcolumn_name ||
    ' - ' || lold_rcn_num || ' - ' ||
    lnew_rcn_num || ' - ' || vbrn_num);
    utl_file.new_line(lfile_handle2, 0);
    end if;
    end if;
    exception
    When NO_DATA_FOUND THEN
    utl_file.put_line(lfile_handle3,
    ltable_name || ' - ' || lcolumn_name || ' - ' ||
    lvalue || ' - ' || 'NO MAPPING FOUND' ||
    ' - ' || vbrn_num);
    utl_file.new_line(lfile_handle3, 0);
    when others then
    utl_file.put_line(lfile_handle4,
    ltable_name || ' - ' || lcolumn_name || ' - ' ||
    lvalue || ' - ' || SQLERRM || ' - ' ||
    vbrn_num);
    utl_file.new_line(lfile_handle4, 0);
    end;
    end loop;
    ELSE
    ltext2 := 'select distinct ' || lcolumn_name || ' from ' ||
    ltable_name ||
    ' a, (select distinct new_rcn_num col from tb_conv_rcn_mapping where brn_num = ' ||
    vbrn_num || ') b where a.' || lcolumn_name ||
    ' = b.col(+) and b.col is null and a.' || lcolumn_name ||
    ' is not null';
    OPEN cur_tab_cols FOR ltext2;
    loop
    fetch cur_tab_cols
    into lvalue;
    exit when cur_tab_cols%notfound;
    begin
    IF VBRN_NUM IN (21, 6, 7, 8) THEN  Commented during NAP HK SIT cycle1
    SELECT DISTINCT NEW_RCN_NUM, OLD_RCN_NUM
    INTO LNEW_RCN_NUM, LOLD_RCN_NUM
    FROM TB_CONV_RCN_MAPPING
    WHERE OLD_RCN_NUM = LVALUE
    AND BRN_NUM = VBRN_NUM;
    /* ELSE
    SELECT DISTINCT NEW_RCN_NUM, OLD_RCN_NUM
    INTO LNEW_RCN_NUM, LOLD_RCN_NUM
    FROM TB_CONV_RCN_MAPPING
    WHERE OLD_RCN_NUM = LVALUE
    AND NEW_RCN_NUM NOT LIKE '40%'
    AND NEW_RCN_NUM NOT LIKE '41%'
    AND NEW_RCN_NUM NOT LIKE '42%'
    AND NEW_RCN_NUM NOT LIKE '65%'
    AND BRN_NUM = VBRN_NUM;
    END IF; */ -- Commented during NAP HK SIT cycle1
    if ldata_type = 'NUMBER' then
    ltext1 := 'update ' || ltable_name || ' set ' || lcolumn_name ||
    ' = ' || lnew_rcn_num || ' where ' || lcolumn_name ||
    ' = ' || lold_rcn_num || ';';
    utl_file.put_line(lfile_handle1, ltext1);
    utl_file.new_line(lfile_handle1, 0);
    utl_file.put_line(lfile_handle1, lcommit);
    utl_file.new_line(lfile_handle1, 0);
    utl_file.put_line(lfile_handle2,
    ltable_name || ' - ' || lcolumn_name || ' - ' ||
    lold_rcn_num || ' - ' || lnew_rcn_num ||
    ' - ' || vbrn_num);
    utl_file.new_line(lfile_handle2, 0);
    else
    ltext1 := 'update ' || ltable_name || ' set ' || lcolumn_name ||
    ' = ' || '''' || lnew_rcn_num || '''' || ' where ' ||
    lcolumn_name || ' = ' || '''' || lold_rcn_num || '''' || ';';
    utl_file.put_line(lfile_handle1, ltext1);
    utl_file.new_line(lfile_handle1, 0);
    utl_file.put_line(lfile_handle1, lcommit);
    utl_file.new_line(lfile_handle1, 0);
    utl_file.put_line(lfile_handle2,
    ltable_name || ' - ' || lcolumn_name || ' - ' ||
    lold_rcn_num || ' - ' || lnew_rcn_num ||
    ' - ' || vbrn_num);
    utl_file.new_line(lfile_handle2, 0);
    end if;
    exception
    When NO_DATA_FOUND THEN
    utl_file.put_line(lfile_handle3,
    ltable_name || ' - ' || lcolumn_name || ' - ' ||
    lvalue || ' - ' || 'NO MAPPING FOUND' ||
    ' - ' || vbrn_num);
    utl_file.new_line(lfile_handle3, 0);
    when others then
    utl_file.put_line(lfile_handle4,
    ltable_name || ' - ' || lcolumn_name || ' - ' ||
    lvalue || ' - ' || SQLERRM || ' - ' ||
    vbrn_num);
    utl_file.new_line(lfile_handle4, 0);
    end;
    end loop;
    end if;
    end loop;
    close c1;
    utl_file.new_line(lfile_handle1, 1);
    select 'EXEC SP_CONV_END_TIMELOG(' || '''' || 'LOG_' || lfile_name1 || '''' || ',' ||
    vbrn_num || ');'
    into lend_time
    from dual;
    UTL_FILE.PUT_LINE(lfile_handle1, lend_time);
    UTL_FILE.NEW_LINE(lfile_handle1, 1);
    SELECT 'SPOOL OFF;' INTO lspool_off FROM dual;
    utl_file.put_line(lfile_handle1, lspool_off);
    utl_file.new_line(lfile_handle1, 1);
    utl_file.fclose(lfile_handle1);
    utl_file.fclose(lfile_handle2);
    utl_file.fclose(lfile_handle3);
    utl_file.fclose(lfile_handle4);
    exception
    when others then
    verror_msg := sqlcode || ' ~ ' || sqlerrm;
    utl_file.put_line(lfile_handle4,
    ltable_name || ' - ' || lcolumn_name || ' - ' ||
    lvalue || ' - ' || SQLERRM || ' - ' || vbrn_num);
    utl_file.new_line(lfile_handle4, 0);
    utl_file.new_line(lfile_handle4, 0);
    utl_file.fclose(lfile_handle1);
    utl_file.fclose(lfile_handle2);
    utl_file.fclose(lfile_handle3);
    utl_file.fclose(lfile_handle4);
    end sample;

    duplicate:
    how to tune the follwoing procedure?

  • How to tune this SQL?

    What this SQL did is to generate a report like how many rows for each tp_stts when ims_toms_msge_type='TOMS NEW' (or 'TOMS CNCLO'). also, its corresponding total number for each ims_toms_msge_type.
    Here is the sample:
    Rownum    H1            TP_STTS                          COUNT        IMS_TOMS_MSGE_TYPE    H   FILTERTYPE
    1     Trades     Block Key Data Error                      594           TOMS NEW             A     MSL
    2          Allocation Data Error                      334           TOMS NEW             A     MSL
    3          Manual Processing Required                29           TOMS NEW             A      MSL
    4          Manual Removal No Processing Required     67           TOMS NEW             A      MSL
    5          Waiting For Authorization                 2            TOMS NEW             A     MSL
    6           Auto NAK                             19764          TOMS NEW             B     SLS
    7           Validated                             165023         TOMS NEW             B     SLS
    8     GRAND TOTAL                                    185813          TOMS NEW              H     MSL
    9     Cancel     Auto NAK                              37             TOMS CNCLO        X       MSL
    10          Manual Processing Required   114                    TOMS CNCLO          X      MSL
    11          Manually Processed              278                   TOMS CNCLO     X     MSL
    12     CANCEL GRAND TOTAL                        429                TOMS CNCLO           Z      MSLSQL statement as below:
    SELECT ROWNUM, MSGS.* FROM (with FTMReport as (
           select tp_stts, ims_toms_msge_type, count(*) count  from ims_trde, ims_toms_msge
                    where  ( IMS_TRDE.PRCSG_GRP_ID  = 5  )  AND  ( IMS_TRDE.IMS_TRDE_RCPT_DTTM  >= TO_DATE('12/01/2009 00:00', 'MM/DD/YYYY HH24:MI') AND IMS_TRDE.IMS_TRDE_RCPT_DTTM <= (TO_DATE('12/28/2009 23:59', 'MM/DD/YYYY HH24:MI'))  )  AND (IMS_TRDE.GRS_TRX_TYPE NOT IN ('INJECTION','WITHDRAWAL','PAYMENT') OR IMS_TRDE.GRS_TRX_TYPE IS NULL) AND (IMS_TRDE.SSC_INVST_TYPE != 'FC' OR IMS_TRDE.SSC_INVST_TYPE IS NULL) AND (IMS_TRDE.SERVICE_TYPE='FS' OR IMS_TRDE.SERVICE_TYPE='CO')  AND 1=1 
        and IMS_TRDE.SERVICE_TYPE='FS'    and  1=1  and ims_trde.ims_trde_oid = ims_toms_msge.ims_trde_oid
           group by tp_stts, ims_toms_msge_type
          select 'GRAND TOTAL' H1,  null tp_stts, sum(Count) count , ims_toms_msge_type ,'H', 'MSL' FilterType
                   from FTMReport  where  ims_toms_msge_type in ('TOMS NEW') group by ims_toms_msge_type
        union
          select 'CANCEL GRAND TOTAL' H1,  null tp_stts, sum(Count) count, ims_toms_msge_type ,'Z', 'MSL' FilterType 
                   from FTMReport where  ims_toms_msge_type in ('TOMS CNCLO') group by ims_toms_msge_type
        union
          select DECODE(rownum, 1, 'Trades') H1, tp_stts, count, ims_toms_msge_type , 'A' , 'MSL' FilterType
                   from FTMReport  where  ims_toms_msge_type in ('TOMS NEW') and tp_stts not in ('Validated','Auto NAK','Manual NAK')
        union
          select ' ' H1, tp_stts, count, ims_toms_msge_type , 'B' , 'SLS' FilterType
                   from FTMReport where  ims_toms_msge_type in ('TOMS NEW') and tp_stts in ('Validated','Auto NAK','Manual NAK')
        union
          select DECODE(rownum, 1, 'Cancel') H1, tp_stts, count, ims_toms_msge_type , 'X' , 'MSL' FilterType
                   from FTMReport where  ims_toms_msge_type in ('TOMS CNCLO') order by 5,6
        ) MSGS;Explain plan as below:
    | Id  | Operation                           |  Name                        | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT                    |                              |   193 | 12738 |    32 |
    |   1 |  COUNT                              |                              |       |       |       |
    |   2 |   VIEW                              |                              |   193 | 12738 |    32 |
    |   4 |    TEMP TABLE TRANSFORMATION        |                              |       |       |       |
    |   3 |     RECURSIVE EXECUTION             | SYS_LE_4_0                   |       |       |       |
    |   0 |      INSERT STATEMENT               |                              |    61 |  4575 |  9264 |
    |   1 |       LOAD AS SELECT                |                              |       |       |       |
    |   2 |        SORT GROUP BY                |                              |    61 |  4575 |  9264 |
    |   3 |         NESTED LOOPS                |                              |  1604 |   117K|  9251 |
    |*  4 |          TABLE ACCESS BY INDEX ROWID| IMS_TRDE                     |  1603 | 80150 |  6045 |
    |*  5 |           INDEX RANGE SCAN          | IMS_TRDE_INDX4               |   539K|       |  3917 |
    |*  6 |          INDEX RANGE SCAN           | IMS_TOMS_MSGE_INDX1          |     1 |    25 |     2 |
    |   5 |     SORT UNIQUE                     |                              |   193 |  8831 |    30 |
    |   6 |      UNION-ALL                      |                              |       |       |       |
    |   7 |       SORT GROUP BY NOSORT          |                              |     5 |   115 |     6 |
    |*  8 |        VIEW                         |                              |    61 |  1403 |     2 |
    |   9 |         TABLE ACCESS FULL           | SYS_TEMP_0FD9D660F_B198D56F  |    61 |  2074 |     2 |
    |  10 |       SORT GROUP BY NOSORT          |                              |     5 |   115 |     6 |
    |* 11 |        VIEW                         |                              |    61 |  1403 |     2 |
    |  12 |         TABLE ACCESS FULL           | SYS_TEMP_0FD9D660F_B198D56F  |    61 |  2074 |     2 |
    |  13 |       COUNT                         |                              |       |       |       |
    |* 14 |        VIEW                         |                              |    61 |  2867 |     2 |
    |  15 |         TABLE ACCESS FULL           | SYS_TEMP_0FD9D660F_B198D56F  |    61 |  2074 |     2 |
    |* 16 |       VIEW                          |                              |    61 |  2867 |     2 |
    |  17 |        TABLE ACCESS FULL            | SYS_TEMP_0FD9D660F_B198D56F  |    61 |  2074 |     2 |
    |  18 |       COUNT                         |                              |       |       |       |
    |* 19 |        VIEW                         |                              |    61 |  2867 |     2 |
    |  20 |         TABLE ACCESS FULL           | SYS_TEMP_0FD9D660F_B198D56F  |    61 |  2074 |     2 |
    Predicate Information (identified by operation id):
       4 - filter(("IMS_TRDE"."GRS_TRX_TYPE"<>'INJECTION' AND "IMS_TRDE"."GRS_TRX_TYPE"<>'WITHDRAWAL'
                  AND "IMS_TRDE"."GRS_TRX_TYPE"<>'PAYMENT' OR "IMS_TRDE"."GRS_TRX_TYPE" IS NULL) AND
                  ("IMS_TRDE"."SSC_INVST_TYPE"<>'FC' OR "IMS_TRDE"."SSC_INVST_TYPE" IS NULL))
       5 - access("IMS_TRDE"."IMS_TRDE_RCPT_DTTM">=TO_DATE(' 2009-12-01 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss') AND "IMS_TRDE"."PRCSG_GRP_ID"=5 AND "IMS_TRDE"."SERVICE_TYPE"='FS' AND
                  "IMS_TRDE"."IMS_TRDE_RCPT_DTTM"<=TO_DATE(' 2009-12-28 23:59:00', 'syyyy-mm-dd hh24:mi:ss'))
           filter("IMS_TRDE"."PRCSG_GRP_ID"=5 AND "IMS_TRDE"."SERVICE_TYPE"='FS')
       6 - access("IMS_TRDE"."IMS_TRDE_OID"="IMS_TOMS_MSGE"."IMS_TRDE_OID")
       8 - filter("FTMREPORT"."IMS_TOMS_MSGE_TYPE"='TOMS NEW')
      11 - filter("FTMREPORT"."IMS_TOMS_MSGE_TYPE"='TOMS CNCLO')
      14 - filter("FTMREPORT"."IMS_TOMS_MSGE_TYPE"='TOMS NEW' AND "FTMREPORT"."TP_STTS"<>'Validated'
                  AND "FTMREPORT"."TP_STTS"<>'Auto NAK' AND "FTMREPORT"."TP_STTS"<>'Manual NAK')
      16 - filter("FTMREPORT"."IMS_TOMS_MSGE_TYPE"='TOMS NEW' AND ("FTMREPORT"."TP_STTS"='Auto NAK' OR
                  "FTMREPORT"."TP_STTS"='Manual NAK' OR "FTMREPORT"."TP_STTS"='Validated'))
      19 - filter("FTMREPORT"."IMS_TOMS_MSGE_TYPE"='TOMS CNCLO')
    Note: cpu costing is offCould you guys tell me what is wrong with this sql and how to tune it?
    Is there any way to replace the UNION? Is using UNION a good idea?
    Can I use DECODE or CASE WHEN to simplify it? How?
    Also, could you help explain why there is SYS_LE_4_0, SYS_TEMP_0FD9D660F_B198D56F temporary segment? Is it caused by with FTMReport as ?
    Thanks
    Edited by: PhoenixBai on Dec 31, 2009 9:58 AM
    Edited by: PhoenixBai on Dec 31, 2009 12:08 PM
    Edited by: PhoenixBai on Dec 31, 2009 12:17 PM

    I consider using GROUP BY ROLLUP together with DECODE, CASE WHEN, but haven`t come out with a working sql yet:-(Some sample data to work with would have been much helpful. But we dont get that most of the time :(
    I came up with this.
                    select case when ims_toms_msge_type = 'TOMS NEW' then
                                     case when grouping(tp_stts) = 1 then 'GRAND TOTAL'
                                          when tp_stts not in ('Validated','Auto NAK','Manual NAK') then 'Trades'
                                     end
                                when ims_toms_msge_type = 'TOMS CNCLO' then
                                     case when grouping(tp_stts) = 1 then 'CANCEL GRAND TOTAL'
                                          when tp_stts in ('Validated','Auto NAK','Manual NAK') then 'Cancel'
                                     end
                           end h1,
                           tp_stts,
                           count(*) count,
                           ims_toms_msge_type,
                           case when ims_toms_msge_type = 'TOMS NEW' then
                                     case when grouping(tp_stts) = 1 then 'H'
                                          when tp_stts not in ('Validated','Auto NAK','Manual NAK') then 'A'
                                     end
                                when ims_toms_msge_type = 'TOMS CNCLO' then
                                     case when grouping(tp_stts) = 1 then 'Z'
                                          when tp_stts in ('Validated','Auto NAK','Manual NAK') then 'B'
                                     end
                           end flag,
                           'MSL' FilterType
                   from ims_trde,
                        ims_toms_msge
                     where IMS_TRDE.PRCSG_GRP_ID  = 5 
                       AND IMS_TRDE.IMS_TRDE_RCPT_DTTM  >= TO_DATE('12/01/2009 00:00', 'MM/DD/YYYY HH24:MI')
                       AND IMS_TRDE.IMS_TRDE_RCPT_DTTM <=  TO_DATE('12/28/2009 23:59', 'MM/DD/YYYY HH24:MI') 
                       AND (IMS_TRDE.GRS_TRX_TYPE NOT IN ('INJECTION','WITHDRAWAL','PAYMENT')
                        OR IMS_TRDE.GRS_TRX_TYPE IS NULL)
                       AND (IMS_TRDE.SSC_INVST_TYPE != 'FC'
                        OR IMS_TRDE.SSC_INVST_TYPE IS NULL)
                       AND (IMS_TRDE.SERVICE_TYPE = 'FS'
                        OR IMS_TRDE.SERVICE_TYPE = 'CO')
                       AND 1=1 
                     and IMS_TRDE.SERVICE_TYPE = 'FS'   
                     and  1=1 
                     and ims_trde.ims_trde_oid = ims_toms_msge.ims_trde_oid
                      group by rollup(ims_toms_msge_type, tp_stts)Not sure if this code works. Because i dint have the table or the data to test it. So if it has some error just fix it and give it a try. Do post the kind of output it gives. So that we can see if we can work with this solution.

  • How to tune up VA05

    Dear gurus
    While executing VA05
    Giving material number
    and date range from 01.04.2010 to 01.04.2010
    sales Organization 1000
    distribution Channel 10
    It takes more then an hour to perform why is that so ? how to tune it up.
    please help
    Regards
    Saad Nisar

    Hi Saad,
                This is a standard program(SAPMV75A), RIGHT? . Normal tools in sap for performace analysis are
    Run time analysis transaction SE30
    This transaction gives all the analysis of an ABAP program with respect to the database and the non-database processing.
    SQL Trace transaction ST05
    The trace list has many lines that are not related to the SELECT statement in the ABAP program. This is because the execution of any ABAP program requires additional administrative SQL calls. To restrict the list output, use the filter introducing the trace list.
    The trace list contains different SQL statements simultaneously related to the one SELECT statement in the ABAP program. This is because the R/3 Database Interface - a sophisticated component of the R/3 Application Server - maps every Open SQL statement to one or a series of physical database calls and brings it to execution. This mapping, crucial to R/3s performance, depends on the particular call and database system. For example, the SELECT-ENDSELECT loop on the SPFLI table in our test program is mapped to a sequence PREPARE-OPEN-FETCH of physical calls in an Oracle environment.
    The WHERE clause in the trace list's SQL statement is different from the WHERE clause in the ABAP statement. This is because in an R/3 system, a client is a self-contained unit with separate master records and its own set of table data (in commercial, organizational, and technical terms). With ABAP, every Open SQL statement automatically executes within the correct client environment. For this reason, a condition with the actual client code is added to every WHERE clause if a client field is a component of the searched table.
    To see a statement's execution plan, just position the cursor on the PREPARE statement and choose Explain SQL. A detailed explanation of the execution plan depends on the database system in use.
    Kindly please take an ABAP'ers help.
    Regards,
    Ram Pedarla

  • How to tune up/down the lightness of ipod video?

    I just bought my ipod video 30GB, I found it too sharp when playing some video. Anyone know how to tune it?

    hmmmm. unfortunately, i'm not sure there is an easy way to do that:
    iPod with color displays do not have an adjustable contrast setting
    ... does anyone else know of any potential workarounds that c93025 might be able to try?

  • How to tune application

    Hi
    Iam new to appsdba can u pls say how to tune oracle application .
    Regards
    9841672839

    Pl see if MOS Doc 744143.1 (Tuning performance on eBusiness suite) provides you the necessary information
    HTH
    Srini

  • How to tune plsql code

    hi all,
    tell me any one how to tune the plsql code in oracle plsql

    You could have googled a bit ->
    http://www.google.co.in/#hl=en&q=tuning+pl+sql+in+oracle&meta=&aq=&oq=tuning+pl+sql+in+oracle&fp=3c5f05f17abf6d93
    Regards.
    Satyaki De.

Maybe you are looking for

  • How to find out the selected line in the table control

    Hi Guys, i have a requirement like this. i have table control and the internal table for that table control as IT_CASE. this internal table i declared as CHECKBX, MATNR, QUANTITY. but when i am enter the values in the table control i am getting the v

  • Duplicate record identifier and update

    My records look like  Name City Duplicateindicator  SAM   NYC   0 SAM   NYC1 0 SAM    ORD  0 TAM   NYC  0 TAM   NYC1  0  DAM   NYC  0   for some reason numeric character are inserted into city which duplicated my records ,  I need to  Check for the d

  • Masks work in Air 2.6!

    .. As does color tinting! By the way, has anyone noticed the blend modes not working correctly? I have seen instances where a movieclip which had the additive blend on was resetting back to normal blending. It could have been something to do with vis

  • RoboHelp project keeps crashing

    I have been working with a large RH project since December that is linked to a 600 page FM book. I haven't had any problems until last Tuesday (1/20). When I was trying to update the project, I received error messages regarding several FM files that

  • Serice confirmation for Limit PO in SUS

    hi, can anybody share the confirmation process for limit PO in SUS entering services from catalog is Ok,but Limit po value is not displaying, reason is table BBP_PDLIM not updated in SUS. any thing to be activated for updating this table (i have trie