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 > db2 - transaction log is full

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-05-12, 05:15
maniv.dk maniv.dk is offline
Registered User
 
Join Date: Jan 2012
Posts: 14
Red face db2 - transaction log is full

Hi,
in my db2 database, in a table i have 80,000 rows, when i try to delete programmatically

"delete from table"

This end up with error - "SQL0964C The transaction log for the database is full"

In my config files,
i have LOGRETAIN = OFF and
USEREXIT = OFF

already i have used enough space to allocate log path.

What else i need to do, to make log off...?

any idea..?
Reply With Quote
  #2 (permalink)  
Old 01-05-12, 05:24
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
2 options
alter table xx not logged initially
delete from table
both operation in the same uow
or try to call db2admin stored proc to execute import from /dev/null of del replace into xx
from application
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #3 (permalink)  
Old 01-05-12, 07:14
fengsun2 fengsun2 is offline
Registered User
 
Join Date: Nov 2011
Posts: 124
another option:
increase log file size or/and log file number....
Reply With Quote
  #4 (permalink)  
Old 01-05-12, 07:14
maniv.dk maniv.dk is offline
Registered User
 
Join Date: Jan 2012
Posts: 14
Quote:
Originally Posted by przytula_guy View Post
2 options
alter table xx not logged initially
delete from table
both operation in the same uow
or try to call db2admin stored proc to execute import from /dev/null of del replace into xx
from application
I tried the first option,
"Alter table xxx activate not logged initially" executed this command, But didnt work....

second option is like changing the query... if i do this..i need to make alot of changes in my app. so envt config settings would be better to do... and which handle future scenarios as well
Reply With Quote
  #5 (permalink)  
Old 01-05-12, 07:20
maniv.dk maniv.dk is offline
Registered User
 
Join Date: Jan 2012
Posts: 14
Quote:
Originally Posted by fengsun2 View Post
another option:
increase log file size or/and log file number....
Increase the log file size is allowing to write more log...
But this could impact in Hard disk space... i dnt want to to do that....
Reply With Quote
  #6 (permalink)  
Old 01-05-12, 07:32
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
as indicated before :
both operation in the same uow
the commit command (explicit or implicit) will remove this setting
Reducing logging with the NOT LOGGED INITIALLY parameter
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #7 (permalink)  
Old 01-05-12, 07:47
maniv.dk maniv.dk is offline
Registered User
 
Join Date: Jan 2012
Posts: 14
"Alter table" and "delete records" these both operation should we use in same unit of work... ? is this what you meant...?

I am not sure how to make it same unit of work....?

Could you give me the comments in this....
Reply With Quote
  #8 (permalink)  
Old 01-05-12, 08:09
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
if started from a file in command line - look at command options and autocommit
LIST COMMAND OPTIONS
if from an application : no commit in between
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #9 (permalink)  
Old 01-05-12, 08:15
fengsun2 fengsun2 is offline
Registered User
 
Join Date: Nov 2011
Posts: 124
basically that means "Alter table" and "delete records" should be in the same transaction.....
Do not commit work between the operation of alter table and delete records。
PLZ turn off the autocommit option/attributes in your program if it is on....

Last edited by fengsun2; 01-05-12 at 08:20.
Reply With Quote
  #10 (permalink)  
Old 01-06-12, 05:28
thawfii88 thawfii88 is offline
Registered User
 
Join Date: Nov 2011
Posts: 13
Hope this would work.

alter table XXX activate not logged initially;
delete from XXX;
commit work;
Reply With Quote
  #11 (permalink)  
Old 01-09-12, 05:11
maniv.dk maniv.dk is offline
Registered User
 
Join Date: Jan 2012
Posts: 14
Quote:
Originally Posted by thawfii88 View Post
Hope this would work.

alter table XXX activate not logged initially;
delete from XXX;
commit work;
Hi,
i have turned off my autocommit options, and in program i applied the above queries.....
alter table xxxx activate not logged initially;
and then
delete from xxxx

But it throws exception during delete query execution..... says Transaction log is full.....

am i missing any thing.. ?
Reply With Quote
  #12 (permalink)  
Old 01-09-12, 05:22
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
have you started the script with +c option
otherwise it is autocommitted and alter table is committed and not used
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #13 (permalink)  
Old 01-09-12, 07:06
maniv.dk maniv.dk is offline
Registered User
 
Join Date: Jan 2012
Posts: 14
Quote:
Originally Posted by przytula_guy View Post
have you started the script with +c option
otherwise it is autocommitted and alter table is committed and not used
This change adding +c with query , will be like modifying queries everywhere i needed... If i have 200+ places, changing it to all the area is not good way of solution. I am trying to make it config level itself.... So that in future the same problem will not happen in any other areas.....
Reply With Quote
  #14 (permalink)  
Old 01-09-12, 11:19
nvk@vhv nvk@vhv is offline
Registered User
 
Join Date: Jan 2010
Posts: 294
You have not specified your environment. If you have DB2 9.7, then you could use truncate!
TRUNCATE statement - IBM DB2 9.7 for Linux, UNIX, and Windows
Reply With Quote
  #15 (permalink)  
Old 01-09-12, 11:50
dbareddy dbareddy is offline
Registered User
 
Join Date: Aug 2011
Posts: 1
if you are on db2 9.7 try below command to delete all the rows from the table...hope you already have the backup, just in case...

db2 "truncate table schema.table reuse storage immediate"

If you want to reclaim the space try the below command on the tablespace under which this table resides.

db2 "alter tablespace TSNAME reduce max"
Reply With Quote
Reply

Tags
db2 9.7

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