Reg update of a 10 million record table from 1 million record table

I have 2 tables
Tabke 1 : 10 millio records
21 indexes --> 1). acct_id , acct_seq_no -- index_1
2). c1 , c2 , c3 -- index_2
Table 2 : 1 .5 million records
1 index on ( acct_id, acct_seq_no) - idx_1
common keys are acct_id and acct_seq_no
I'm updating table1 from table 2
I need to use index ( index_1 from table_1 ) and (idx_1 from table_2)
How can I make my query to use only this particular index.
MY query ia as follows
UPDATE csban_&1 csb
SET (
duns_no,
hdqtrs_duns_no,
us_ultmt_duns_no,
sci_id,
blg_cl_id,
cl_id
) =
( SELECT acct_id,
acct_seq_no,
duns_no,
hdqtrs_duns_no,
us_ultmt_duns_no,
sci_id,
blg_cl_id,
cl_id
FROM csban_abi_temp
WHERE csb.acct_id = temp.acct_id
AND csb.acct_seq_no = temp.acct_seq_no
AND rownum < 2
WHERE
EXISTS
SELECT 1
FROM csban_abi_temp temp1
WHERE csb.acct_id = temp1.acct_id
AND csb.acct_seq_no = temp1.acct_seq_no
DO I need to put and index hint after this
UPDATE csban_&1 csb --???????? /*+ indedx (csb.index_1) */
Thanks in advance

Thanks a lot david and rob for sharing the info.
Please find the details
SQL> EXPLAIN PLAN FOR
UPDATE csban_2 csb
SET (
duns_no,
hdqtrs_duns_no,
us_ultmt_duns_no,
sci_id,
blg_cl_id,
cl_id
) =
( SELECT duns_no,
hdqtrs_duns_no,
us_ultmt_duns_no,
sci_id,
blg_cl_id,
cl_id
FROM csban_abi_temp temp
WHERE csb.acct_id = temp.acct_id
AND csb.acct_seq_no = temp.acct_seq_no
AND rownum < 2
WHERE
EXISTS
SELECT 1
FROM csban_abi_temp temp1
WHERE 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29
Explained.
SQL>
SQL>
SQL> SELECT * FROM TABLE(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 584770029
| Id | Operation | Name | Rows | Bytes | Cost
| TQ |IN-OUT| PQ Distrib |
PLAN_TABLE_OUTPUT
| 0 | UPDATE STATEMENT | | 530K| 19M| 8213
| | | |
| 1 | UPDATE | CSBAN_2 | | |
| | | |
|* 2 | FILTER | | | |
| | | |
| 3 | PX COORDINATOR | | | |
| | | |
PLAN_TABLE_OUTPUT
| 4 | PX SEND QC (RANDOM) | :TQ10000 | 530K| 19M| 8213
| Q1,00 | P->S | QC (RAND) |
| 5 | PX BLOCK ITERATOR | | 530K| 19M| 8213
| Q1,00 | PCWC | |
| 6 | TABLE ACCESS FULL | CSBAN_2 | 530K| 19M| 8213
| Q1,00 | PCWP | |
|* 7 | INDEX RANGE SCAN | IDX_CSB_ABI_TMP | 1 | 10 | 3
PLAN_TABLE_OUTPUT
| | | |
|* 8 | COUNT STOPKEY | | | |
| | | |
| 9 | TABLE ACCESS BY INDEX ROWID| CSBAN_ABI_TEMP | 1 | 38 | 4
| | | |
|* 10 | INDEX RANGE SCAN | IDX_CSB_ABI_TMP | 1 | | 3
| | | |
PLAN_TABLE_OUTPUT
Predicate Information (identified by operation id):
2 - filter( EXISTS (SELECT 0 FROM "CSBAN_ABI_TEMP" "TEMP1" WHERE "TEMP1"."ACC
T_SEQ_NO"=:B1 AND
"TEMP1"."ACCT_ID"=:B2))
PLAN_TABLE_OUTPUT
7 - access("TEMP1"."ACCT_ID"=:B1 AND "TEMP1"."ACCT_SEQ_NO"=:B2)
8 - filter(ROWNUM<2)
10 - access("TEMP"."ACCT_ID"=:B1 AND "TEMP"."ACCT_SEQ_NO"=:B2)
Note
- cpu costing is off (consider enabling it)
30 rows selected.
The query had completed and it took 1 hr 47 mts.
SQL> SQL> SQL> Updating CSBAN from TEMP table
old 1: UPDATE /*+ INDEX(acct_id,acct_seq_no) */ csban_&1 csb
new 1: UPDATE /*+ INDEX(acct_id,acct_seq_no) */ csban_1 csb
1611807 rows updated.
Elapsed: 01:47:16.40

Similar Messages

  • How to update more than 5 million records without error message ORA-00257:

    Hi ,
    I need to update some columns in my table which is contains about 5 million records
    I 've already tried this
    Update AAA_CDR
    Set RoamFload = Null ;
    but the problem is I've got the error message ("ORA-00257: archiver error. Connect internal only,until freed.) and the update consuming about 6 hours with no results ,
    then I do the commands ( Alter system set db_recovery_file_dest_size=50G) and the problem solved .
    but I need to update about 15 columns of this table to be null ,what I should do to overcome this message and update the table in reasonable time
    Please Help Me ,

    The best way would be to allocate sufficient disk space for your archive log destination. Your database is not sized properly. NOLOGGING option will not do much for you because it' only applies to direct load operations when the data inserted into nologging table is selected from another table. UPDATE will be be logged, regardless of the NOLOGGING status. Here is the quote from the manual:
    <quote>
    LOGGING|NOLOGGING
    LOGGING|NOLOGGING specifies that subsequent Direct Loader (SQL*Loader) and direct-load
    INSERT operations against a nonpartitioned index, a range or hash index partition, or
    all partitions or subpartitions of a composite-partitioned index will be logged (LOGGING)
    or not logged (NOLOGGING) in the redo log file.
    In NOLOGGING mode, data is modified with minimal logging (to mark new extents invalid
    and to record dictionary changes). When applied during media recovery, the extent
    invalidation records mark a range of blocks as logically corrupt, because the redo data
    is not logged. Therefore, if you cannot afford to lose this index, you must take a backup
    after the operation in NOLOGGING mode.
    If the database is run in ARCHIVELOG mode, media recovery from a backup taken before an
    operation in LOGGING mode will re-create the index. However, media recovery from a backup
    taken before an operation in NOLOGGING mode will not re-create the index.
    An index segment can have logging attributes different from those of the base table and
    different from those of other index segments for the same base table.
    </quote>
    If you are really desperate, you can try the following undocumented/unsupported command:
    ALTER DATABASE ARCHIVELOG COMPRESS ENABLE;
    That will cause database to compress your archive logs and consume less space. This command is not documented or supported, not even in the version 11.2.0.3 and causes the database to start spewing ORA-0600 in version 10G. DO NOT USE IN A PRODUCTION ENVIRONMENT!!!!

  • Find the latest updated or the latest inserted record  in a table

    Hi All,
    Thanks in advance
    Just a simple question
    How do we find the latest updated or the latest inserted record in a table ?
    Provide some queries in SQL?

    You can order by rowid desc to get lately inserted records, but I'm not sure about updated records.That is incorrect, Oracle might use old rowid's even in inserts and you cannot assure that the max(rowid) refers to the latest record.
    If the table is created with rowdependencies one can use ORA_ROWSCN pseudo column to check on date/time when the last dml has been performed over that table. But, that has some limitations too, Old snapshots will be erased hence one can check the last dml with a time frame of few days.
    Regards,
    Prazy

  • How to find out who made inserts/updates/deletes made to a SQL Table

    I want to know WHO MAKES INSERTS/UPDATES/DELETES TO a particular SQL Table. Bascially I want to AUDIT ANY Edites made to a SQL 2008 TABLE. I need info such as WHO AMDE THE Updates i.e. the user first/lastname, When update was made, what row was updated etc...How
    can I do that with SQL 2008?

    One way to achieve that would be to use triggers to detect when a change is made to the table, and then insert a record into another table/database detailing what changed and who by.
    You'd need three triggers, one for insert, update and delete respectively, and for each of those you use the "inserted" and "deleted" tables (system tables maintained by SQL) to retrieve what has been done. To retrieve who made the change you can query IDENT_CURRENT
    which returns the last identity value for a specific table.
    See :
    Triggers -
    http://msdn.microsoft.com/en-gb/library/ms189799(v=sql.100).aspx
    Inserted & deleted tables -
    http://technet.microsoft.com/en-us/library/ms191300(v=sql.100).aspx
    INDENT_CURRENT -
    http://technet.microsoft.com/en-us/library/ms175098(v=sql.100).aspx
    There may be better / more up to date ways to do this, but I've used this method successfully in the past, albeit a long time ago (on a SQL 2000 box I think!).

  • Update the correct profit center in tables BSEG / BSAS / BSIS / BSIK / BSAK

    Hi FI Gurus,
    I am looking after a Support Project in SAP IS-Retail. I am from the FI functional and possess very limited knowledge in FI.
    My client has done the sales posting in SAP using IDOC's. During the postings, it was found that wrong Profit Centers were assigned. Due to this, the sales reports based on Profit Center are coming wrong. It was suggested to the client to reverse the IDOCs, do necessary changes in Profit Centers and re-post the IDOCs. The client wanted a short method to get the reports right. A senior consultant (Non FI) in the Company and the Management are forcing me to write a ABAP program to update certain (not all) FI tables. According to me, it will have some negative impact on the system for which reason I am not ready to take the call as a Project Manager. The management wants me to do the following (I am quoting the same mail which I received from the consultant ) :
    We need to update the correct profit center in tables BSEG / BSAS / BSIS / BSIK / BSAK / BSID / BSAD, wherever the records exists against billing document numbers provided.
    BAPI for updating profit center in Accounting documents: BAPI_ACC_DOCUMENT_POST
    Function Module : 'BAPI_DOCUMENT_CHANGE'
    Also look at SAP Note: Note 966428 - FB02: Functional area (FKBER) can be changed on coding block
    Based on the above, the ABAPer has written the program, the program will update the tables BSEG, BSIS, BSIK, according to the selection criteria of document number, company code and line item number with the new profit centers.
    Please clarify me about the following :
    1. This program is updating profit center in just the FI tables (BSEG, BSIS, BSIK etc.), but the New GL tables (faglflexa and faglflext) which have approx. 65 lakh entries in PRD do not get updated with the correct profit center.
    2. The Controlling tables also do not get updated with this program yet. Also since the previoius updation of Profit centers did not happen correctly, most of the times the controlling document has not been generated at all. Since we will be updating the profit center in just the FI tables, the controlling document will not be created still. Though there are SAP notes suggesting re-creation of the Controlling documents, which is still an option you can choose. Please confirm.
    3. The Special GL also does not get updated because of this.
    This is a very critical and hot issue. My job is at Stake as the Management has threatened me of sacking if I do not follow their directives as they are only concerned with their money.
    Is the consultant who suggested this change RIGHT ?
    Your early replies will help me take the decision.
    Regards

    Hi,
    There is no standard program or BAPI that would update profit centre in a posted document. You should either develop your own process for it,which is not recommended, but sometimes is essential, or reverse the existing documents and post them with the correct profit centre.
    Regards,
    Eli

  • How to update field values in a database table using module pool prg?

    hi
    how to update field values in a database table using module pool prg?
    we created a customized table, and we put 2 push buttons in screen painter update and display.
    but update is not working?
    data is enter into screen fields and to internal table, but it is not updated in database table.
    thanks in adv
    vidya

    HI,
    we already used the update statement. but its not working.
    plz check this.
    *& Module Pool       ZCUST_CALL_REC
    PROGRAM  ZCUST_CALL_REC.
    TABLES: ZCUST_CALL_REC,ZREMARKS.
    data:  v_kun_low like ZCUST_CALL_REC-kunnr ,
           v_kun_high like ZCUST_CALL_REC-kunnr,
           v_bud_low like ZCUST_CALL_REC-budat,
           v_bud_high like ZCUST_CALL_REC-budat.
    ranges r_kunnr for ZCUST_CALL_REC-kunnr  .
    ranges r_budat for zcust_call_rec-budat.
    DATA: ITAB TYPE STANDARD TABLE OF ZCUST_CALL_REC WITH HEADER LINE,
          JTAB TYPE STANDARD TABLE OF ZREMARKS WITH HEADER LINE.
    *data:begin of itab occurs 0,
        MANDT LIKE ZCUST_CALL_REC-MANDT,
        kunnr like ZCUST_CALL_REC-kunnr,
        budat like ZCUST_CALL_REC-budat,
        code like ZCUST_CALL_REC-code,
        remarks like ZCUST_CALL_REC-remarks,
        end of itab.
    *data:begin of Jtab occurs 0,
        MANDT LIKE ZCUST_CALL_REC-MANDT,
        kunnr like ZCUST_CALL_REC-kunnr,
        budat like ZCUST_CALL_REC-budat,
        code like ZCUST_CALL_REC-code,
        remarks like ZCUST_CALL_REC-remarks,
        end of Jtab.
    CONTROLS:vcontrol TYPE TABLEVIEW USING SCREEN '9001'.
    CONTROLS:vcontrol1 TYPE TABLEVIEW USING SCREEN '9002'.
    *start-of-selection.
    *&      Module  USER_COMMAND_9000  INPUT
          text
    MODULE USER_COMMAND_9000 INPUT.
    CASE sy-ucomm.
    WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
    SET SCREEN 0.
    LEAVE SCREEN.
    CLEAR sy-ucomm.
    WHEN 'ENQUIRY'.
    perform multiple_selection.
    perform append_CUSTOMER_code.
    PERFORM SELECT_DATA.
    call screen '9001'.
    WHEN 'UPDATE'.
          perform append_CUSTOMER_code.
          PERFORM SELECT_DATA.
          call screen '9002'.
          perform update on commit.
    WHEN 'DELETE'.
          perform append_CUSTOMER_code.
          PERFORM SELECT_DATA.
          call screen '9002'.
    ENDCASE.
    ENDMODULE.                 " USER_COMMAND_9000  INPUT
    *&      Module  STATUS_9000  OUTPUT
          text
    MODULE STATUS_9000 OUTPUT.
      SET PF-STATUS 'ZCUSTOMER'.
    SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_9000  OUTPUT
    *&      Module  USER_COMMAND_9001  INPUT
          text
    MODULE USER_COMMAND_9001 INPUT.
    CASE sy-ucomm.
    WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
    SET SCREEN 0.
    LEAVE SCREEN.
    CLEAR sy-ucomm.
    endcase.
    ENDMODULE.                 " USER_COMMAND_9001  INPUT
    *&      Module  STATUS_9001  OUTPUT
          text
    MODULE STATUS_9001 OUTPUT.
      SET PF-STATUS 'ZCUSTOMER'.
    SET TITLEBAR 'xxx'.
    move itab-MANDT   to zcust_call_rec-MANDT.
    move itab-kunnr   to zcust_call_rec-kunnr.
    move itab-budat   to zcust_call_rec-budat.
    move itab-code    to zcust_call_rec-code.
    move itab-remarks to zcust_call_rec-remarks.
    vcontrol-lines = sy-dbcnt.
    ENDMODULE.                 " STATUS_9001  OUTPUT
    *&      Module  USER_COMMAND_9002  INPUT
          text
    module  USER_COMMAND_9002 input.
    CASE sy-ucomm.
       WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.
          SET SCREEN 0.
          LEAVE SCREEN.
          CLEAR sy-ucomm.
       WHEN 'UPDATE'.
             perform move_data.
         UPDATE ZCUST_CALL_REC FROM TABLE ITAB.
            IF SY-SUBRC = 0.
               MESSAGE I000(0) WITH 'RECORDS ARE UPDATED'.
             ELSE.
               MESSAGE E001(0) WITH 'RECORDS ARE NOT UPDATED'.
            ENDIF.
      WHEN 'DELETE'.
             perform move_data.
             DELETE ZCUST_CALL_REC FROM TABLE ITAB.
              IF SY-SUBRC = 0.
               MESSAGE I000(0) WITH 'RECORDS ARE DELETED'.
             ELSE.
               MESSAGE E001(0) WITH 'RECORDS ARE NOT DELETED'.
            ENDIF.
    endcase.
    endmodule.                 " USER_COMMAND_9002  INPUT
    *&      Module  STATUS_9002  OUTPUT
          text
    module STATUS_9002 output.
      SET PF-STATUS 'ZCUSTOMER1'.
    SET TITLEBAR 'xxx'.
    endmodule.                 " STATUS_9002  OUTPUT
    *&      Module  update_table  OUTPUT
          text
    module update_table output.
         move itab-MANDT   to zcust_call_rec-MANDT.
         move itab-kunnr   to zcust_call_rec-kunnr.
         move itab-budat   to zcust_call_rec-budat.
         move itab-code    to zcust_call_rec-code.
         move itab-remarks to zcust_call_rec-remarks.
    vcontrol-lines = sy-dbcnt.
    endmodule.                 " update_table  OUTPUT
    ***Selection Data
    FORM SELECT_DATA.
    SELECT  mandt kunnr budat code remarks  FROM zcust_call_rec INTO
                            table itab
                             WHERE kunnr IN r_kunnr AND BUDAT IN R_BUDAT.
    ENDFORM.
    ****append vendor code
    FORM APPEND_CUSTOMER_CODE.
    clear r_kunnr.
    clear itab.
    clear r_budat.
    refresh r_kunnr.
    refresh itab.
    refresh r_kunnr.
    IF r_kunnr  IS INITIAL
                  AND NOT v_kun_low IS INITIAL
                   AND NOT v_kun_high IS INITIAL.
                        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
                                    EXPORTING
                                       input         = v_kun_low
                                    IMPORTING
                                       OUTPUT        = r_kunnr-low.
                       CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
                                  EXPORTING
                                      input         = v_kun_high
                                  IMPORTING
                                      OUTPUT        = r_kunnr-high.
                     r_kunnr-option = 'BT'.
                     r_kunnr-sign = 'I'.
                     append r_kunnr.
       PERFORM V_BUDAT.
    ELSEIF r_kunnr  IS INITIAL
                  AND NOT v_kun_low IS INITIAL
                   AND  v_kun_high IS INITIAL.
                        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
                                    EXPORTING
                                       input         = v_kun_low
                                    IMPORTING
                                       OUTPUT        = r_kunnr-low.
                    r_kunnr-SIGN = 'I'.
                    r_kunnr-OPTION = 'EQ'.
                    APPEND r_kunnr.
       PERFORM V_BUDAT.
    ELSEIF r_kunnr IS INITIAL
                  AND  v_kun_low IS INITIAL
                   AND NOT v_kun_high IS INITIAL.
                        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
                                    EXPORTING
                                       input         = v_kun_low
                                    IMPORTING
                                       OUTPUT        = r_kunnr-low.
                    r_kunnr-SIGN = 'I'.
                    r_kunnr-OPTION = 'EQ'.
                    APPEND r_kunnr.
          PERFORM V_BUDAT.
    ELSEIF r_kunnr IS INITIAL
                  AND  v_kun_low IS INITIAL
                   AND  v_kun_high IS INITIAL.
                        IF SY-SUBRC = 0.
                             MESSAGE I003(0) WITH 'ENTER CUSTOMER NUMBER'.
                              CALL SCREEN '9000'.
                        ENDIF.
    PERFORM V_BUDAT.
    ENDIF.
    ENDFORM.
    FORM V_BUDAT.
    IF  R_BUDAT IS INITIAL
                   AND NOT v_BUD_low IS INITIAL
                   AND NOT v_BUD_high IS INITIAL.
                     r_budat-low = v_bud_low.
                     r_budat-high = v_bud_high.
                     r_budat-option = 'BT'.
                     r_budat-sign = 'I'.
                     append r_budat.
             ELSEIF  R_BUDAT IS INITIAL
                   AND NOT v_BUD_low IS INITIAL
                   AND  v_BUD_high IS INITIAL.
                     r_budat-low = v_bud_low.
                     r_budat-high = v_bud_high.
                     r_budat-option = 'EQ'.
                     r_budat-sign = 'I'.
                     append r_budat.
             ELSEIF  R_BUDAT IS INITIAL
                   AND  v_BUD_low IS INITIAL
                   AND NOT v_BUD_high IS INITIAL.
                     r_budat-HIGH = v_bud_HIGH.
                     r_budat-option = 'EQ'.
                     r_budat-sign = 'I'.
                     append r_budat.
              ELSEIF  R_BUDAT IS INITIAL
                   AND  v_BUD_low IS INITIAL
                   AND  v_BUD_high IS INITIAL.
                   IF SY-SUBRC = 0.
                       MESSAGE I002(0) WITH 'ENTER POSTING DATE'.
                      CALL SCREEN '9000'.
                    r_budat-low = ''.
                    r_budat-option = ''.
                    r_budat-sign = ''.
                    ENDIF.
            ENDIF.
    ENDFORM.
    *&      Form  update
          text
    -->  p1        text
    <--  p2        text
    form update .
    commit work.
    endform.                    " update
    *&      Form  move_data
          text
    -->  p1        text
    <--  p2        text
    form move_data .
       clear itab.
      refresh itab.
           move-corresponding  zcust_call_rec to itab.
           MOVE ZCUST_CALL_REC-MANDT   TO ITAB-MANDT.
           MOVE ZCUST_CALL_REC-KUNNR   TO ITAB-KUNNR.
           MOVE ZCUST_CALL_REC-BUDAT   TO ITAB-BUDAT.
           MOVE ZCUST_CALL_REC-CODE    TO ITAB-CODE.
           MOVE ZCUST_CALL_REC-REMARKS TO ITAB-REMARKS.
         APPEND ITAB.
         delete itab where kunnr is initial.
    endform.                    " move_data
    thanks in adv
    vidya

  • Updating Purchase Order data in VBKD table

    Hello,
    We are trying to update Purchase order data in VBKD table for Sales Order at Item level. When sales Order is created, VBKD has a default record with VBELN = 'sales order number' and Item = '00000'. We want to update BSTKD_E field with Purchase order number for VBELN= 'sales order number' and Item = '00010'.
    We wrote our logic in USEREXIT_SAVE_DOCUMENT_PREPARE and USEREXIT_MOVE_FIELDS_TO_VBKD in MV50AFZZ to append new entries in XVBKD with VBELN= 'sales order number' and Item = '00010'. But in this case Sales order is not created with UPDATE TERMINATED message. We are not sure if we can append a new record in XVBKD.
            wa_xvbkd = xvbkd.
            wa_xvbkd-posnr = wa_xvbap-posnr.  "00010
            wa_xvbkd-bstkd_e = vbkd-bstkd.   "PO no
            wa_xvbkd-posex_e = wa_xvbap-posnr. "Purch. order item no
            wa_xvbkd-updkz = C_I.
            APPEND wa_xvbkd TO xvbkd.
            CLEAR wa_xvbkd.
    Please advice the suitable way to have a Purchase Order item level data in Sales Order.
    Thanks
    Rohit

    Hi,
    You can try these FM to update info record.
    ME_DB_UPDATE_INFORECORDS
    ME_UPDATE_INFORECORD
    ME_UPDATE_INFORECORD_COND
    ME_UPDATE_INFORECORD_PD
    Check the sample code on BAPI_PO_CHANGE
    http://www.sap-img.com/abap/sample-abap-code-on-bapi-po-change.htm
    Regards,
    Shiva Kumar

  • Update/create the purchase info records

    Hi All,
    i got a requirment for update/create the purchase info records for the transaction ME11.
    i came to know that the FM <b>ME_DIRECT_INPUT_INFORECORD</b> is suitable for this requirment.
    but when i am trying to test this by passing data to I_EINA and I_EINE.
    it is giving some error message like "<b>Please enter at least one vendor</b>, Number entered not within external number range and etc".
    can any one guid me in passing the data to this function module, i.e. what are the required fields that are to be passed to this FM.
    if i have to update/create the EINA & EINE table data.
    Thanks,
    Rama

    Hi,
    Better use report RM06IBI0 - read its documentation with
    Tcode SE38
    Greetings Andreas

  • How To Perform Parallel UPDATE When Trigger is ENABLE On Table.

    select *from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE    11.1.0.7.0      Production
    TNS for Linux: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - ProductionIs there any way to perform PARALLEL UPATE on a table which has a trigger?
    One of my ETL performs a large UPDATE (14 Million update) everyday on a production hot table. Eventhough PDML is enable at session level (also TABLE.DEGREE=8), Oracle is doing serialized UPDATE.
    As per Oracle documents, it is documented behavior.
    Here is my Execution plan when i put the trigger ENABLE
    | Id  | Operation              | Name                | Rows  | Bytes | Cost (%CPU)| Time     | Pstart| Pstop |    TQ  |IN-OUT| PQ Distrib |
    |   0 | UPDATE STATEMENT       |                     |       |       |  6443 (100)|          |       |       |        |      |            |
    |   1 |  UPDATE                | ACCOUNT             |       |       |            |          |       |       |        |      |            |
    |*  2 |   PX COORDINATOR       |                     |       |       |            |          |       |       |        |      |            |
    |   3 |    PX SEND QC (RANDOM) | :TQ10000            | 72487 |  3610K|  6443   (3)| 00:01:18 |       |       |  Q1,00 | P->S | QC (RAND)  |
    |*  4 |     FILTER             |                     |       |       |            |          |       |       |  Q1,00 | PCWC |            |
    |   5 |      PX BLOCK ITERATOR |                     | 72487 |  3610K|  6443   (3)| 00:01:18 |   KEY |   KEY |  Q1,00 | PCWC |            |
    |*  6 |       TABLE ACCESS FULL| ACCOUNT             | 72487 |  3610K|  6443   (3)| 00:01:18 |   KEY |   KEY |  Q1,00 | PCWP |            |
    Predicate Information (identified by operation id):
         8 - filter("SET_OF_BOOKS"='1' AND "GL_BATCH_ID">(-10) AND ("JOURNAL_ENTRY_TYPE_ID"<2400 OR
                  "JOURNAL_ENTRY_TYPE_ID">=3000) AND "ACCOUNTING_DATE">=TO_DATE(' 2010-08-11 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss') AND "ACCOUNTING_DATE"<TO_DATE(' 2010-08-12 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))When i disable trigger
    | Id  | Operation                | Name     | Rows  | Bytes | Cost (%CPU)| Time     |    TQ  |IN-OUT| PQ Distrib |
    |   0 | UPDATE STATEMENT         |          |   726 | 27588 | 11899   (2)| 00:02:23 |        |      |            |
    |   1 |  PX COORDINATOR          |          |       |       |            |          |        |      |            |
    |   2 |   PX SEND QC (RANDOM)    | :TQ10001 |   726 | 27588 | 11899   (2)| 00:02:23 |  Q1,01 | P->S | QC (RAND)  |
    |   3 |    INDEX MAINTENANCE     | ACCOUNT  |       |       |            |          |  Q1,01 | PCWP |            |
    |   4 |     PX RECEIVE           |          |   726 | 27588 | 11899   (2)| 00:02:23 |  Q1,01 | PCWP |            |
    |   5 |      PX SEND RANGE       | :TQ10000 |   726 | 27588 | 11899   (2)| 00:02:23 |  Q1,00 | P->P | RANGE      |
    |   6 |       UPDATE             | ACCOUNT  |       |       |            |          |  Q1,00 | PCWP |            |
    |   7 |        PX BLOCK ITERATOR |          |   726 | 27588 | 11899   (2)| 00:02:23 |  Q1,00 | PCWC |            |
    |*  8 |         TABLE ACCESS FULL| ACCOUNT  |   726 | 27588 | 11899   (2)| 00:02:23 |  Q1,00 | PCWP |            |
    Predicate Information (identified by operation id):
       8 - filter("SET_OF_BOOKS"='1' AND "GL_BATCH_ID">(-10) AND ("JOURNAL_ENTRY_TYPE_ID"<2400 OR
                  "JOURNAL_ENTRY_TYPE_ID">=3000) AND "ACCOUNTING_DATE">=TO_DATE(' 2010-08-11 00:00:00', 'syyyy-mm-dd
                  hh24:mi:ss') AND "ACCOUNTING_DATE"<TO_DATE(' 2010-08-12 00:00:00', 'syyyy-mm-dd hh24:mi:ss'))I cannot disable trigger due to some business reasons.
    Is there any way to speed up UPDATE ?

    No, you cannot perform parallel dml with a trigger present.
    If you are updating the bulk of the rows and can take an outage, you can
    disable the trigger, perform the update, enable the trigger
    OR
    copy to another table, performing the update in the select, rename the tables and add the trigger on the new table
    Hemant K Chitale

  • Not able to update more than 10,000 records in CT04 for a characteristic

    Hi all,
    We are not able to update more than 10,000 records in CT04 for a certain characteristic.
    Is there any possible way to do this?
    Please advise...its a production issue.
    Thanks.

    Hello ,
    Please consider using a check table for the characteristic involved if you are working with large
    number of values assigned
    With a check table you have a possibility to work with a huge amount of values , also the performance should improve                          
    Please refer to the link
    http://help.sap.com/saphelp_erp60_sp/helpdata/en/ec/62ae27416a11d1896d0000e8322d00/frameset.htm
    Section - Entering a Check Table 
    Hopefully the information helps
    Thanks
    Enda.

  • How to update by using PL/SQL Records

    Hi,
    I want to update EMP table columns ename and empno only
    from other existing table TEST_EMP
    EMP table contains 14 rows.TEST_EMP table contains 3 rows.
    I need to update first three rows in EMP table.
    TEST_EMP DATA IS:
    ENAME EMPNO
    E1 1001
    E2 1002
    E3 1003
    Following code i written to update EMP table.
    DECLARE
    type r is record(id emp.empno%type,
         name emp.ename%type);
    r1 r;          
    BEGIN
    select ename,empno into r1 from test_emp;
    FOR i IN r1.FIRST .. r1.LAST
    LOOP
    update emp2
    set ename=r1(i).ename,
    empno=r1(i).empno
    WHERE empno = l_rc (i).empno;
    end loop;
    commit;
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line (SQLERRM (SQLCODE));
    END;
    ERROR OCCURRED:
    ORA-06550: line 9, column 14:
    PLS-00302: component 'FIRST' must be declared
    ORA-06550: line 9, column 2:
    PL/SQL: Statement ignored
    I should use PL/SQL Record to update Table This is Mandatory.
    pls guide me.
    Regards,
    Venkat.

    > I want to update EMP table columns ename and empno only
    from other existing table TEST_EMP
    Why use PL/SQL and why use cursors?
    You are running a SELECT on the source table via the SQL engine and pulling that data from the db buffer cache into PL/SQL variables.
    Then you take that very same data, and push that back to the SQL engine using an UPDATE.
    So if you need to update 10KB worth of data, it means pulling 10KB from the SQL engine into the PL engine.. and then pushing 10KB of data from the PL engine back to the SQL engine.
    Not only pushing and pulling - you need your code to switch continually between the PL and SQL engines to do this.
    Now imagine doing it for 10MB of data.. or 1GB of data.. or more.
    Does it sound like your approach is effective? Does it sounds like it will perform well? Does it sound like it will scale?
    The basic rule for Oracle development is:
    Maximize SQL. Minimize PL/SQL (or Java or C#, etc).

  • How RG1 reg update?

    HI..Gurus,
    How RG1 reg Update? Wt is the T.Code for that. ?What are the pre-requisites that are needed.?
    regards,
    jyothi.

    Hi Jyothi
    The sequence is like this:
    1. In SE16, enter Table name: J_2IRG1BAL, and click on Create. Enter the material Number and 'P' in Material form (Loose/Pack indicator) and click 'Save'. This step is to be done only for the first time.
    2. Do your Initial Stock entry in MB1C, movement type 561
    2. Go to J1I5, select Posting Date, Document Year and 'ROP in Classification (Receipt from outside under any other provision). Click on Create icon (Register entry)
    4. Go to J2I5 and extract the RG1 Register. You must get a green checkmark.
    5. After doing the PFI, go to J1I5, select Posting Date, Document Year and Classification 'IDH' (For domestic sales) or 'IDE' if the first removal is for Export Sale. Based on the accounting document generated during PGI (MB03) the RG1 Register gets updated with the removal for Outbound Delivery.
    6. Reextract the RG1 register in J2I5. You must get a green checkmark.For the RG1 Register printout, go to J2I6, select the option, 'Script Form' and hit 'Execute.
    All this was in OSS Note: 373001.
    Ramana ND
    PS: You must have maintained the Number range Object J_1IRG1 (RG1 Register)

  • Handling update conflicts or overwriting of records from timesten to oracle

    Hi Chris,
    My question is this that I have read the documentation and found out the following:-
    An update is committed on a cache table in an AWT cache group. The same update is committed on the cached Oracle table using a passthrough operation. The cache table update, which is automatically and asynchronously propagated to Oracle, may overwrite the passed through update that was processed directly on the cached Oracle table depending on when the propagated update and the passed through update is processed on Oracle.
    To handle or to restrict this what is the option with which I can go because I want this as an exception that is to be handled but not to be ignored or overwritten by Timesten in database.
    Moreover, I want to work with AWT cache group preferably.
    Can you please help me with this part.

    Chris,
    First thanks for showing your interest:-
    Let me explain it to you with different example:-
    On two separate data stores (DS1, DS2), there is an AWT table for the same Oracle base table. A row is updated on DS1 and is committed. A row is updated on DS2 and is committed. Because the cache group behavior is asynchronous, the change on DS2 may be applied to the Oracle database before the change on DS1, resulting in the DS1 change overwriting the DS2 change.
    I want to handle this overwriting so that I will be able to know which record is overwritten by which new value.
    Or there is one more scenario:
    If at some time my TimesTen is not connected to oracle database but I have the table cached in my TimesTen and some update is done on it for particular record and the same record is updated in the oracle database also with some different value then whenever I will connect my timesten to database it will overwrite the value which is updated earlier in database.
    I hope now that you are able to understand what I am trying to do here.
    Please suggest me some method to handle all these things.
    Thanks for your support.

  • Update A Column In A Database Table.

    I am unable to update a column in a database table.
    For example; I have ten records in an EMP table without having any EMPNO. I want to UPDATE (insert) 10 different EMPNO in a table. How can I do it? All I know is that there are ten records in the table; this means that I cannot use a WHERE clause with different criteria for each row.
    Thanks.

    Try something like this
    SQL> select * from emp_1
      2  /
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
    14 rows selected.
    SQL> insert into emp_1(empno, ename, job, mgr, hiredate, sal, comm, deptno)
      2  select null, ename, job, mgr, hiredate, sal, comm, deptno
      3    from emp_1
      4   where rownum <= 10
      5  /
    10 rows created.
    SQL> select * from emp_1
      2  /
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
               SMITH      CLERK           7902 17-DEC-80        800                    20
               ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
               WARD       SALESMAN        7698 22-FEB-81       1250        500         30
               JONES      MANAGER         7839 02-APR-81       2975                    20
               MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
               BLAKE      MANAGER         7839 01-MAY-81       2850                    30
               CLARK      MANAGER         7839 09-JUN-81       2450                    10
               SCOTT      ANALYST         7566 19-APR-87       3000                    20
               KING       PRESIDENT            17-NOV-81       5000                    10
               TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
    24 rows selected.
    SQL> select max(empno) from emp_1
      2  /
    MAX(EMPNO)
          7934
    SQL> create sequence emp_seq start with 7935
      2  /
    Sequence created.
    SQL> update emp_1 set empno = emp_seq.nextval where empno is null
      2  /
    10 rows updated.
    SQL> select * from emp_1
      2  /
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
          7935 SMITH      CLERK           7902 17-DEC-80        800                    20
          7936 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7937 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7938 JONES      MANAGER         7839 02-APR-81       2975                    20
          7939 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7940 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7941 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7942 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7943 KING       PRESIDENT            17-NOV-81       5000                    10
          7944 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
    24 rows selected.

  • Updation of Primary Key in HR Table(PA2001)

    Can anyone please tell me how to update a primary key field in HR Tables (PA2001 and PA2002).
    I need to update <b>sprps</b> field in both the tables. I used HR_Infotype_Operation function module, but still it is not updating the field.
    Pls find the following code snippet for the table PA2001 and let me know if any discrepancies :
    TABLES: pa2001.
    DATA: it_pa2001 TYPE TABLE OF pa2001,
          wa_pa2001 LIKE LINE OF it_pa2001,
    DATA: date TYPE d.
    date = sy-datum - 100.
    SELECT pernr sprps begda endda FROM PA2001 INTO CORRESPONDING FIELDS OF TABLE it_pa2001
      WHERE begda BETWEEN date and sy-datum.
    WRITE:/.
    WRITE:/ 'PA 2001 Records'.
    if sy-subrc <> 0.
      WRITE:/ 'No Data Exists'.
    else.
    LOOP AT it_pa2001 INTO wa_pa2001.
    WRITE:/ wa_pa2001-pernr, wa_pa2001-sprps, wa_pa2001-begda, wa_pa2001-endda.
    ENDLOOP.
    endif.
    LOOP AT it_pa2001 INTO wa_pa2001.
    wa_pa2001-sprps = 'X'.
                                     CALL FUNCTION 'HR_INFOTYPE_OPERATION'
                                       EXPORTING
                                         infty                  = '2001'
                                         number                 = wa_pa2001-pernr
                                       SUBTYPE                =
                                       OBJECTID               =
                                       LOCKINDICATOR          =
                                       VALIDITYEND            =
                                       VALIDITYBEGIN          =
                                       RECORDNUMBER           =
                                         record                 = wa_pa2001
                                         operation              = 'MOD'
                                       TCLAS                  = 'A'
                                       DIALOG_MODE            = '0'
                                       NOCOMMIT               =
                                       VIEW_IDENTIFIER        =
                                       SECONDARY_RECORD       =
                                     IMPORTING
                                       RETURN                 =
                                       KEY                    =
    ENDLOOP.
    if sy-subrc = 0.
    write:/ 'SY-subrc is zero'.
    write:/ ' Rows modified = ', sy-dbcnt.
    else.
    write:/ 'No Record(s) updated'.
    endif.
    commit work.
    WRITE: / 'Updated Records in the Internal Table IT_PA2001'.
    SELECT pernr sprps begda endda FROM PA2001 INTO CORRESPONDING FIELDS OF TABLE it_pa2001
      WHERE begda BETWEEN date AND sy-datum..
    LOOP AT it_pa2001 INTO wa_pa2001.
    WRITE:/ wa_pa2001-pernr, wa_pa2001-sprps, wa_pa2001-begda, wa_pa2001-endda.
    ENDLOOP.

    Thanks Kiran.
    But I need to change this field as we need to lock the records, as soon as the employee fills his/her time sheets which will be sent for HR Payroll, later on.
    When I am updating directly the field the database table PA2001, its not updating but for table PA2002, only few records are being updated.
    Is there any other alternative for this problem?
    Pls reply.
    Thanks,
    Harish

Maybe you are looking for