If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Huge data Update in production DB

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-27-09, 15:33
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Huge data Update in production DB

Hi All,

I need to update huge data in production db Table that normally will take 2 hours to finish. We cannot afford holding tahe table that long.

How can we use cursor to do the data in chunks. Still allowing most part of table available for on Line Gamers.


Any good technique will update few rows and release the lock on table and accquire lock again and do small update again.

DB2 ver 8.2 on windows server 2000


Thanks in adv,

DBFinder
Reply With Quote
  #2 (permalink)  
Old 03-27-09, 15:54
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Yes, open the cursor "with hold", and do a commit every 100 to 1000 updates. Normally a cursor is closed upon commit, but if you use "with hold" option it will stay open.

Also, open the cursor with UR isolation level, and do the update separately (not update where current of cursor). This assumes the table has a primary key.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 03-27-09, 23:37
DBFinder DBFinder is offline
Registered User
 
Join Date: Sep 2008
Location: Toronto,Canada
Posts: 606
Thanks Marcus,

I opened the cursor with hold and committed after 1000.

The procedure ran like fully loaded and finished in few minutes.

Cool,

Thanks again.

DBFinder
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On