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 > Trasaction logs full while delete

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-29-09, 09:59
DB Guide DB Guide is offline
Registered User
 
Join Date: Oct 2009
Posts: 14
Trasaction logs full while delete

Hello,

This is very basic error that we face many times.

Last time I had faced it while deleting all rows from table and the table had millions of rows.
I went on increasing the LOGSECOND parameter & reach to the maximum limit, still i couldn't empty the table.

Finally i need to drop the table and recreated it to make it empty.

Ok. My question is... is there any other way to delete all data from table without making transaction logs full?

Thanks!


P.S. -- db2 v9.1 on AIX 5

Last edited by DB Guide; 12-29-09 at 10:02.
Reply With Quote
  #2 (permalink)  
Old 12-29-09, 10:07
MarkhamDBA MarkhamDBA is offline
Registered User
 
Join Date: Dec 2008
Location: Toronto, Canada
Posts: 381
load of an empty file with replace option might do the trick
__________________
DB2 v9.5 ESE on AIX v6.1/ v9./10 on z/OS
Reply With Quote
  #3 (permalink)  
Old 12-29-09, 16:42
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
you may want to use import instead of load if your db is using archival logging
Reply With Quote
  #4 (permalink)  
Old 12-29-09, 20:12
yhangw yhangw is offline
Registered User
 
Join Date: Nov 2009
Posts: 5
Quote:
Originally Posted by DB Guide View Post
Hello,

This is very basic error that we face many times.

Last time I had faced it while deleting all rows from table and the table had millions of rows.
I went on increasing the LOGSECOND parameter & reach to the maximum limit, still i couldn't empty the table.

Finally i need to drop the table and recreated it to make it empty.

Ok. My question is... is there any other way to delete all data from table without making transaction logs full?

Thanks!


P.S. -- db2 v9.1 on AIX 5

set logsecond to -1.

or increase your logfilsiz/logprimary

or load from null or other truncate tricks

Last edited by yhangw; 12-29-09 at 20:21.
Reply With Quote
  #5 (permalink)  
Old 12-30-09, 07:43
DB Guide DB Guide is offline
Registered User
 
Join Date: Oct 2009
Posts: 14
Thank you all for your replies.

"Load/Import" is really a good option to empty the table.

Thanks a lot.
Reply With Quote
  #6 (permalink)  
Old 01-12-10, 14:18
usc usc is offline
Registered User
 
Join Date: Apr 2007
Posts: 21
Simple method to empty the table is

ALTER TABLE x ACTIVATE NOT LOGGED INITIALLY WITH EMPTY TABLE;
Reply With Quote
  #7 (permalink)  
Old 01-12-10, 15:24
Lenny77 Lenny77 is offline
Registered User
 
Join Date: Jul 2009
Location: NY
Posts: 886
Quote:
Originally Posted by DB Guide View Post
Hello,

This is very basic error that we face many times.

Last time I had faced it while deleting all rows from table and the table had millions of rows.
I went on increasing the LOGSECOND parameter & reach to the maximum limit, still i couldn't empty the table.

Finally i need to drop the table and recreated it to make it empty.

Ok. My question is... is there any other way to delete all data from table without making transaction logs full?

Thanks!


P.S. -- db2 v9.1 on AIX 5
You can use COMMITS after some number of deleted records, or better
use LOAD table with REPLACE, using DUMMY input file.

Lenny
Reply With Quote
  #8 (permalink)  
Old 01-12-10, 16:05
dav1mo dav1mo is offline
Registered User
 
Join Date: Dec 2007
Location: Richmond, VA
Posts: 782
Lenny mentioned commits, which is very important when you are trying to delete millions and less of rows, but not the entire table. If you are attempting to delete some subset of rows, you would want to do the deletes within a loop and commit after a particular count of records.

Dave
Reply With Quote
  #9 (permalink)  
Old 01-13-10, 17:41
blazer789 blazer789 is offline
Registered User
 
Join Date: Jun 2009
Posts: 221
If you are in 9.7 you can also use truncate table command.

db2 "truncate table tablename IGNORE DELETE TRIGGERS drop storage immediate"
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