DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: Update huge tabel

  1. #1
    Join Date
    Nov 2000
    Posts
    416
    How can I update a big table without blowing rollback segments ?

    I cannot open a cursor and commit every n records, because the cursor will close.

    What is the best way ?
    An ounce of prevention is worth a pound of cure

  2. #2
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    what do you mean the cursor will close...?

  3. #3
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    I'm assuming you mean you will get an ORA-1555 error message.

    What's your table structure look like?

    Depending on your structure, you could open up multiple cursors, each with say 10% of the rows.
    Jeff Hunter

  4. #4
    Join Date
    Nov 2000
    Posts
    416
    This is my table structure :

    CREATE TABLE POSTAL_CODE (
    POSTAL_CODE_STRING VARCHAR2 (7) NOT NULL,
    SEQUENCE_NUMBER NUMBER (38) NOT NULL,
    PROVINCE_CODE VARCHAR2 (2) NOT NULL,
    CITY_NAME VARCHAR2 (30) NOT NULL,
    AREA_CODE VARCHAR2 (3) NOT NULL,
    TIME_ZONE_NUMBER NUMBER (38) NOT NULL,
    DAYLIGHT_SAVING_FLAG_STRING VARCHAR2 (1) NOT NULL,
    LAST_UPDATE_DATETIME DATE NOT NULL,
    ROW_UPDATE_NUMBER NUMBER (38) NOT NULL,
    CONSTRAINT POSTAL_CODE_PK
    PRIMARY KEY ( POSTAL_CODE_STRING, SEQUENCE_NUMBER )


    Can you be more specific ? Thanks guys

    An ounce of prevention is worth a pound of cure

  5. #5
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    [assumption]sequence_number is your PK[/assume]

    I would update using area_code as a "batch".
    Code:
    get all the area codes
    for each area code
       open your cursor
       do your updates
    get next area code
    Jeff Hunter

  6. #6
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    well I meant a normal cursor would do no? I dont understand what do you mean you cannot commit every N rows, if you commit every row then it is bad but every 5000 seems reasonable no?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width