How this procedure works INTERNALLY???

HI Experts
I have created the below procedure(It is updating 50 million records in decent time) but I have few doubts.
1) I am not commiting till the end. Will it take up the UNDO space. How can I assure that this procedure executes till the end.
2) If i have to increase the UNDO space how should I increase considering 50 million rows.
3) Do I have to consider factors other than UNDO space while running this procedure if yes then wat are they.
4) Suggest me some links where i can find out how sql queries and pl/sql objects works internally.
CREATE OR REPLACE PROCEDURE ACCOUNTS_MIGRATION
IS
TYPE num_new_typ IS TABLE OF accounts.acc_no_new%TYPE ;
TYPE num_old_typ IS TABLE OF accounts.acc_no_old%TYPE ;
TYPE mat_records_typ IS TABLE OF mbk_audittrail.account1%TYPE;
TYPE mat_records_typ_1 IS TABLE OF mbk_audittrail.account2%TYPE;
TYPE mr_records_typ IS TABLE OF mbk_requests.account_no%TYPE;
TYPE mpgn_records_typ IS TABLE OF Mtx_payment_gateway_txn.PAYMENT_METHOD_NUMBER%TYPE;
TYPE mti_records_typ IS TABLE OF Mtx_transaction_items.ACCOUNT_ID%TYPE;
all_num_new num_new_typ:= num_new_typ();
all_num_old num_old_typ:= num_old_typ();
mat_records mat_records_typ:= mat_records_typ();
mat_records_1 mat_records_typ_1:= mat_records_typ_1();
mr_records mr_records_typ:= mr_records_typ();
mpgn_records mpgn_records_typ:= mpgn_records_typ();
mti_records mti_records_typ:= mti_records_typ();
BEGIN
   SELECT ACC_NO_OLD, ACC_NO_NEW bulk collect into all_num_old,all_num_new FROM ACCOUNTS;
   SELECT distinct ACCOUNT1 bulk collect INTO mat_records FROM MBK_AUDITTRAIL where account1 <> ' ';
   SELECT distinct ACCOUNT2 bulk collect INTO mat_records_1 FROM MBK_AUDITTRAIL where account2 <> ' ';
   SELECT distinct account_no bulk collect INTO mr_records FROM Mbk_requests where account_no <> ' ';
   SELECT distinct PAYMENT_METHOD_NUMBER bulk collect INTO mpgn_records FROM Mtx_payment_gateway_txn where PAYMENT_METHOD_NUMBER <> ' ';
   SELECT distinct ACCOUNT_ID bulk collect INTO mti_records FROM Mtx_transaction_items where ACCOUNT_ID <> ' ';
    FORALL i IN 1..mat_records.count
    UPDATE MBK_AUDITTRAIL SET ACCOUNT1=(SELECT ACC_NO_NEW FROM ACCOUNTS WHERE ACC_NO_OLD=mat_records(i) AND ROWNUM=1) WHERE ACCOUNT1=mat_records(i);
    DBMS_OUTPUT.PUT_LINE(TO_CHAR(SQL%ROWCOUNT) || ' rows updated for MBK_AUDITTRAIL->ACCOUNT1');
    FORALL j IN 1..mat_records_1.count
    UPDATE MBK_AUDITTRAIL SET ACCOUNT2=(SELECT ACC_NO_NEW FROM ACCOUNTS WHERE ACC_NO_OLD=mat_records_1(j) AND ROWNUM=1) WHERE ACCOUNT2=mat_records(j);
    DBMS_OUTPUT.PUT_LINE(TO_CHAR(SQL%ROWCOUNT) || ' rows updated for MBK_AUDITTRAIL->ACCOUNT2');
    FORALL k IN 1..all_num_old.count
    UPDATE MBK_BANK SET ACCOUNT_NO=all_num_new(k) WHERE ACCOUNT_NO=all_num_old(k);
    DBMS_OUTPUT.PUT_LINE(TO_CHAR(SQL%ROWCOUNT) || ' rows updated for MBK_BANK->ACCOUNT_NO');
    FORALL l IN 1..all_num_old.count
    UPDATE MBK_CUST_ACCOUNTS SET ACCOUNT_NO=all_num_new(l) WHERE ACCOUNT_NO=all_num_old(l);
    DBMS_OUTPUT.PUT_LINE(TO_CHAR(SQL%ROWCOUNT) || ' rows updated for MBK_CUST_ACCOUNTS->ACCOUNT_NO');
    FORALL m IN 1..all_num_old.count
    UPDATE Mtx_Payment_methods SET PAYMENT_METHOD_NUMBER=all_num_new(m) WHERE PAYMENT_METHOD_NUMBER=all_num_old(m);
    DBMS_OUTPUT.PUT_LINE(TO_CHAR(SQL%ROWCOUNT) || ' rows updated for Mtx_Payment_methods->PAYMENT_METHOD_NUMBER');
    FORALL n IN 1..mr_records.count
    UPDATE Mbk_requests SET ACCOUNT_NO=(SELECT ACC_NO_NEW FROM ACCOUNTS WHERE ACC_NO_OLD=mr_records(n) AND ROWNUM=1) WHERE ACCOUNT_NO=mr_records(n);
    DBMS_OUTPUT.PUT_LINE(TO_CHAR(SQL%ROWCOUNT) || ' rows updated for Mbk_requests->ACCOUNT_NO');
    FORALL o IN 1..mpgn_records.count
    UPDATE Mtx_payment_gateway_txn SET PAYMENT_METHOD_NUMBER=(SELECT ACC_NO_NEW FROM ACCOUNTS WHERE ACC_NO_OLD=mpgn_records(o) AND ROWNUM=1) WHERE PAYMENT_METHOD_NUMBER=mpgn_records(o);
    DBMS_OUTPUT.PUT_LINE(TO_CHAR(SQL%ROWCOUNT) || ' rows updated for Mtx_payment_gateway_txn->PAYMENT_METHOD_NUMBER');
    FORALL p IN 1..mti_records.count
    UPDATE Mtx_transaction_items SET ACCOUNT_ID=(SELECT ACC_NO_NEW FROM ACCOUNTS WHERE ACC_NO_OLD=mti_records(p) AND ROWNUM=1) WHERE ACCOUNT_ID=mti_records(p);
    DBMS_OUTPUT.PUT_LINE(TO_CHAR(SQL%ROWCOUNT) || ' rows updated for Mtx_transaction_items->ACCOUNT_ID');
    FORALL q IN 1..all_num_old.count
    UPDATE Temp_customer_mgmt SET ACCOUNT_NO=all_num_new(q) WHERE ACCOUNT_NO=all_num_old(q);
    DBMS_OUTPUT.PUT_LINE(TO_CHAR(SQL%ROWCOUNT) || ' rows updated for Temp_customer_mgmt->ACCOUNT_NO');
    FORALL r IN 1..all_num_old.count
    UPDATE MTX_HIST_PIN_REGENERATION SET ACCOUNT_NO=all_num_new(r) WHERE ACCOUNT_NO=all_num_old(r);
    DBMS_OUTPUT.PUT_LINE(TO_CHAR(SQL%ROWCOUNT) || ' rows updated for MTX_HIST_PIN_REGENERATION->ACCOUNT_NO');
END;Thanks & Regards
Saurabh Sharma

Remember that besides UNDO you also have to worry about redo !
If you create a new session for every test run at each volume level, you can query V$SESSTAT for the statistiic 'redo size' so as to identify the Bytes of Redo for each volume level. And then extrapolate from there !
Hemant K Chitale
http://hemantoracledba.blogspot.com
Edited by: Hemant K Chitale on Jul 20, 2009 5:02 PM : ADDED Signature

Similar Messages

  • How complete refresh works internally?

    How complete refresh works internally?
    We have 2 databases A and B. A is the master database and B is replica of A. Basically we want to implement complete refresh mechanism for our database A and B at some time mid night.
    I need to know, How complete refresh works internally?
    Actually we need our replica database up and running 7X24 for users and definitely we cannot effort any down time for that database.
    Now I would like to know:
    1.How complete refresh works internally? Whether complete refresh truncate all the tables first from Replica database and then insert or any other mechanism is there.
    2.If complete refresh truncate all tables from replica database, how can we make sure about the complete availability (7X24) of our replica database.
    Any input is going to help a lot.
    Regards,
    Sanjeev

    The Member Feedback forum is for suggestions and feedback for OTN Developer Services. This forum is not monitored by Oracle support or product teams and so Oracle product and technology related questions will not be answered. We recommend that you post this thread to the Oracle Technology Network (OTN) > Products > Database > Database - General forum.

  • [svn] 3051: actually, for some reason this cast is changing how this method works so

    Revision: 3051
    Author: [email protected]
    Date: 2008-08-29 19:19:32 -0700 (Fri, 29 Aug 2008)
    Log Message:
    actually, for some reason this cast is changing how this method works so
    I'm backing it out!
    Modified Paths:
    blazeds/trunk/modules/core/src/java/flex/messaging/io/BeanProxy.java

    As I said in your original post, iTunes U is not available to any institution, government or otherwise, in South Korea. If or when Apple will extend iTunes U to your country is something none of us here can say, and Apple will not until such time as they're ready to make an announcement. What Apple's criteria and requirements are for being able to open iTunes U in a given country is unknown; there is no "procedure" that any of us here can state or direct you to that you could initiate. It's totally up to Apple, and if they are working on this, I'm sure they know who in the SK government they would need to work with.
    Sorry, but you will just have to wait and hope that something develops in the future.
    Regards.

  • How group by works internally

    Hi,
    I would like to know how group by works internally using data and index cache( informatica uses data and index cache... not sure oracle uses the same). Consider the following table T with columns A and B.
    A      B
    A1    1
    A2    2
    A1    3I am selecting SUM(B) GROUP BY A
    My understanding is as follows
    1. Reads row 1 and stores in data cache.
    2. scans entire table to find the A1s. As an when a row is found, cache them to data cache.
    3. Perform SUM for A1 and store result in index cache.
    4. Above steps repeated for A2 also.
    Please let me know if this is true.
    Thanks,
    Saff
    Edited by: saffron on Nov 19, 2009 9:18 AM

    saffron wrote:
    I would like to know how group by works internallyWhy?
    using data and index cache( informatica uses data and index cache... not sure oracle uses the same).It caches data and indexes but it doesn't use those terms
    I am selecting SUM(B) GROUP BY A
    My understanding is as follows
    1. Reads row 1 and stores in data cache.
    2. scans entire table to find the A1s. As an when a row is found, cache them to data cache.
    3. Perform SUM for A1 and store result in index cache.
    4. Above steps repeated for A2 also.
    Please let me know if this is true.
    Very unlikely.
    The grouping algorithms are internal, undocumented and subject to change and of little use to know outside of the Oracle development team.
    If you just want to learn about Oracle you would probably be better off reading about the documented features for your database version.
    http://tahiti.oracle.com/

  • I really can't understand how this recursive works??

    Hi all,
    I have got a recursive function that checks for palendrome string. But it is confusing. I know that a string is palenromme if it is empty or has a char or first char and last one are same and middle is palindromme too.
    but can't understand how this function works.
    class Palindromme
         boolean palindrom(String s)
              if (s.length() <= 1 || s.equals(null) || s=="") //this is the stopping point
                   return true;
              else
              {                    //recursive definition
                   return ( s.charAt(0) == s.charAt(s.length()-1) ) && palindrom(s.substring(1,s.length()-1));
    specially i don't know how palindrom(s.substring(1,s.length()-1)); is working cause it has to be increased for each loop.
    abdul
    PS: actually i don't know how recursion works from Data structure point of view

    Hi,
    ok your palindrome is : "otto"
    return ( s.charAt(0) == s.charAt(s.length()-1) ) && palindrom(s.substring(1,s.length()-1));
                  o                     o                                   tt
    so first part is true                                        
    in the second part palindrom is called again but with the remaining tt
    so second time :
    return ( s.charAt(0) == s.charAt(s.length()-1) ) && palindrom(s.substring(1,s.length()-1));
                   t                     t                                 ""
    Third time:
    if (s.length() <= 1 || s.equals(null) || s=="") //this is the stopping point
    return true;after all for otto the recusion is:
    return ( s.charAt(0) == s.charAt(s.length()-1) ) && s.charAt(1) == s.charAt(s.length()-2) ) && nothing left of otto);
    Phil

  • My account shows we have photoshop CS1 and CS4, but we've purchased CS 5.5 and CS 6, as well as Lightroom 3, the latter two of which we've been using for more than a year, but it doesn't show up in my account.  Have no clue how this forum works, used to b

    my account shows we have photoshop CS1 and CS4, but we've purchased CS 5.5 and CS 6, as well as Lightroom 3, the latter two of which we've been using in excess of a year, but they don't show up in my account.  Have no clue how this forum works, used to be able to call Adobe!  Any idea how we're supposed to talk to Adobe and have our account updated or figure out our serial numbers?

    For the link below click the Still Need Help? option in the blue area at the bottom and choose the chat option...
    Serial number and activation chat support (non-CC)
    http://helpx.adobe.com/x-productkb/global/service1.html ( http://adobe.ly/1aYjbSC )

  • I wonder how this code works?

    I was going through java API in order to understand how System.out.println("Print this string"); works. I came to know that println is an instance method of PrintStream class. So, i created an instance of PrintStream (ps) and accessed println. My code works fine BUT i realized that i needed to pass System.out as parameter to PrintStream constructor.
    NOW System.out already refers to an instance of PrintStream class.
    BUT there is no such constructor defined in PrintStream class that requires an instance of PrintStream as parameter (See API).
    I wonder how this code works?
    import java.io.*;
    class AnotherWayToPrint {
         public static void main(String[] args) {
              PrintStream ps = new PrintStream(System.out);
              ps.println("Yes! I am printed.");
              ps.println(System.out); // java.io.PrintStream@1ob62c9
    }

    I was going through java API in order to understand
    how System.out.println("Print this string"); works. I
    came to know that println is an instance method of
    PrintStream class. So, i created an instance of
    PrintStream (ps) and accessed println. My code works
    fine BUT i realized that i needed to pass System.out
    as parameter to PrintStream constructor.
    NOW System.out already refers to an instance of
    PrintStream class.
    BUT there is no such constructor defined in
    PrintStream class that requires an instance of
    PrintStream as parameter (See API). Requires? All the constructors for PrintStream take an OutputStream as a parameter.
    A PrintStream IS AN OutputStream

  • How this query executing internally

    Dear All,
    This query picks the nth highest paid employee details, we can acheive this by rank or desnse_rank functions also
    But those execution is easily understandable.But Iam not able to understand , how this below correlated subquery executing internally .Please help me on this query
    select * from emp a where &n=(select count(distinnct b.sal) from emp b where a.sal<=b.sal)
    Thanks in advance

    >
    how this below correlated subquery executing internally .Please help me on this queryPlease check the Explain plan.
    Explain plan
       set pagesize 25
       set linesize 121
       EXPLAIN PLAN FOR
       < Your Query >;
        SELECT * FROM TABLE(dbms_xplan.display);Example :-
    SQL> EXPLAIN PLAN FOR  select count(1) from dual;
    Explained.
    SQL>  SELECT * FROM TABLE(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 323232323
    | Id  | Operation        | Name | Rows  | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT |      |     1 |     2   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE  |      |     1 |            |          |
    |   2 |   FAST DUAL      |      |     1 |     2   (0)| 00:00:01 |
    -----------------------------------------------------------------

  • Hey i am unfamiliar with how to use icloud for storage. Can some one slowly( lol ) help me to understand how this thing works. I also need someone to help with how to transfer pics from your iphone to your flash drive.

    Hello i am needing some assistance as i am not very good at how the cloud works. I need to delete my account and start over.  I don't want to loose all of the things that i have on phone. Help!

    Slowly
    http://www.apple.com/icloud/features/
    but surely
    http://www.gottabemobile.com/2011/10/18/how-to-sync-email-contacts-and-calendar- with-icloud/
    we will come
    http://transfer-iphone-contacts.blogspot.com/p/iphone-contacts-sync-via-icloud.h tml
    to understanding
    http://support.apple.com/kb/PH12519
    on how icloud sync and backup work.
    http://www.apple.com/support/icloud/backup/
    http://support.apple.com/kb/ht1766
    And here we will find instructions on how to backup (import) pictures to computer, cause there is no direct transfer to flash drive.
    http://support.apple.com/kb/ht4083

  • FROM DATABASE INDX: What is this and how this it work?

    Hi,
    I have the following statements in one of the programs that I am modifying:
        INDX_KEY-FLAG = 'SP'.
        INDX_KEY-USERA = SY-UNAME.
        IMPORT DATA_TABLE FROM DATABASE INDX(SD) ID INDX_KEY.
    What does the last statement mean? How is it able to fill the table DATA_TABLE, and where is the data taken from?
    Points will be rewarded and responses will be greatly appreciated.
    Thanks,
    John

    If DATABASE is specified, the data cluster that was written to the database table dbtab in the area ar and under the identification specified in id using the statement EXPORT is imported. The database table dbtab must be set up in the same way as described for the EXPORT statement . For id, a flat, character-type data object is expected that contains the identification of the data cluster, and the two-digit area ar must be specified directly.
    After TO, a work area wa that has the same data type as the database table dbtab can be specified. During import, the values of the database fields that are between the fields SRTF2 and CLUSTR are assigned to the components of wa with the same name.
    If the database table dbtab is client-dependent, a flat, character-type field cl can be specified after the addition CLIENT. This field contains a client identification. If the addition is not specified, the current client is used.
    Outside of classes, the addition TO wa can be omitted. Instead, a table work area for the database table dbtab can be declared using the statement TABLES. Then, during the import, the values of the database fields that are between the fields SRTF2 and CLUSTR are assigned to the component with the same name in the table work area dbtab. In addition, outside of classes, the specification id can be replaced by the obsolete specification obs_id.
    Example
    The table that is imported into the internal table itab is the table exported under the name tab and the identification " TABLE" into the area "XY" of the database table INDX supplied by SAP (see the additions medium of the statement EXPORT). However, the components - which can be selected as required - are assigned to the structure wa_indx.
    TYPES:
      BEGIN OF tab,
        col1 TYPE i,
        col2 TYPE i,
      END OF tab.
    DATA:
      wa_indx TYPE indx,
      wa_itab TYPE tab,
      cl      TYPE mandt VALUE '100',
      itab    TYPE STANDARD TABLE OF tab.
    IMPORT tab = itab
      FROM DATABASE indx(xy)
      TO   wa_indx
      CLIENT cl
      ID 'TABLE'.
    WRITE: wa_indx-aedat, wa_indx-usera, wa_indx-pgmid.
    ULINE.
    LOOP AT itab INTO wa_itab.
      WRITE: / wa_itab-col1, wa_itab-col2.
    ENDLOOP.
    Rgds,
    Naren

  • Inventory management - Label printing - How this will work

    In Material Master under Plant data/Storage location 1 we have Label type and Label Form. How to make use of this?
    We have in IMG under inventory management> messages> Print control> Label printing. how to configure to get desired number of labels to be printed?

    Hemanth - I am having the same problem.  No matter which data element I choose, number of labels printed are based on base unit of measure.  I want to use E3 for label count based on order unit of measure but I cannot make this work.
    Did you find an answer?
    Thanks
    SP

  • How this will work

    Hi
    Friday Saturday Sunday Monday
    <level 0> <level 1> <level 2> <level 1>
    diff cumm. diff. cumm.
    diff - differential incremental
    cumm, - cummulative incremental
    < > - gives levels of backup
    Will this RMAN Backup work? How?
    Regards,
    Tushar

    it works or not i dont know but its mix plate which is too complex too manage past backupsets which in turn also challenging to recover from these strategy if something goes wrong between backupsets.
    Khurram

  • How do promocodes work internationally on textbooks?

    Dear community,
    I am happy to say my textbook is approved, and is available in the iBookstore as of last week!
    Because it is a textbook it can only be purchased in the US iBookstore.
    It is a very specific book about audio engineering. (Audio Engineering : Dynamic processing)
    -> Therefor I am sending it out for reviews to several audio-magazines.
    Some of these are located in England, but they get published worldwide.. (including US)
    So I was wondering how, and if, I can send out my promocodes for reviews to a Brittish magazine for example?
    I have recieved a list with promocodes through itunes connect.
    Also, I have recieved the store instructions on email which has a list for each country that you are sending it to for a review.
    So the question is, can I send this promocode now to a Brittish magazine, and they are able to download a copy of the book in the brittish iBookstore for a review despite the fact that's it is not possible to actually purchase it in Brittish iBookstore?   (- I hope my question makes sense..)
    My second question would be, has anyone have any idea or indication when textbooks will ever be sold in other countries than US?
    Thanks a lot!
    Kind regards
    Wick.

    wickiemedia wrote:
    It actually did work...
    I could use the first promo-code I have generated and download my own book.
    This means i CAN send it to reviewers located in the Uk.
    Note that this puts you in breach with your contract with Apple. From the promo code contract:
    9. PERMITTED USE: You may distribute the Custom Codes only between the Effective Date and that date which is ten (10) days prior to the Expiration Date for the purpose of offering copies of the eBook for media review or promotional purposes. You may not distribute the Custom Codes to Holders in any country in the Territory in which You do not distribute such eBook through the Online Store.
    Michi.

  • Need reminder of how this all works!

    Hello. Haven't been dealing with my i web sites at all for a couple of years, so my head is totally out of how I originally set all this up- like I'm starting from scratch. What I'm dealing with today: I have sample audio clips set up, as on this page:
    http://www.jimsavage.net/THE_JOURNEY_REVIEW.html
    I noticed today that some of the clips were'nt working so I was in there editing the html codes; where did I get the code that i pasted in those snippets?
    (I copy/pasted code from one song/snippet to another to determine where the problem was; I figured it out, lost the original song's code by mistake.
    Thanks

    "SharePoint is a .Net web application which is using virtual path provider technology to save and display data from its configured content DB and rest system pages from its installation root file
    system"
    Above answer may not near to perfect but, interviewer will ask you few more question. I am not sure how will you mark this answer - may be after your next interview until this question asked again. :)
    Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • I don't understand how this Forum works

    I have a question getting the proper version of Flash Player for my computer.  So I went to the Flash Player forum and typed my question into the question box. 
    But all I received was a notice saying that no similar questions were found (or something to that effect).  In other words, it did not let me ask my question to the Adobe FP community--it just did a run of the keywords in previous posts.
    I need to ask my question to the Adobe community and have just spent half hour going around in circles.  Can someone please tell me what I'm doing wrong? Thanks.

    Because they want very few people to use their forums so that answering the questions becomes as easy as possible.
    That has not been the impression left on me. Recently, Adobe initiated a special department, to better manage the forums, as Adobe realizes the service that they provide. Much has been done to simplify, and coordinate the tasks of using the forums, with some fairly major re-designs.
    Have all those efforts been perfect? I rather doubt it, but the process is on-going, with many discussions on how to make the forum "experience," both easier and more satisfying to users - both those who post with problems and questions, and for those who answer the questions. Not every change has improved things for everyone, and I have had a few complaints on some. Still, the effort (and expense) is being put forth. Many are working very hard, and there have been improvements, with more to come. The forums will never be perfect for all users. That is just the way that it is. However, with a focus on "the greater good" of the "majority," then that might be, as good as it gets.
    Hunt

Maybe you are looking for