Unix Technical Forum

alter table activate not logged initially

This is a discussion on alter table activate not logged initially within the DB2 forums, part of the Database Server Software category; --> hi, i have a table with create ddl using not logged initially, CREATE TABLE "NJIPD "."IVPWGMR" ("IVDY01" DECIMAL(2,0) , ...


Go Back   Unix Technical Forum > Database Server Software > DB2

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-26-2008, 05:56 PM
xixi
 
Posts: n/a
Default alter table activate not logged initially

hi, i have a table with create ddl using not logged initially,

CREATE TABLE "NJIPD "."IVPWGMR" ("IVDY01" DECIMAL(2,0) , "IVMO01"
DECIMAL(2,0) , "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY
( START WITH +1 , INCREMENT BY +1 , NO CACHE ) ) IN "USERSPACE1" NOT
LOGGED INITIALLY ;

right now i have to delete almost one million rows in the table, so i
found that i can use alter table activate not logged initially before
i execute delete, but i found that delete still use the transaction
log and cause log error full problem , why is that?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-26-2008, 05:56 PM
Matt Emmerton
 
Posts: n/a
Default Re: alter table activate not logged initially


"xixi" <dai_xi@yahoo.com> wrote in message
news:c0f33a17.0405051212.634143be@posting.google.c om...
> hi, i have a table with create ddl using not logged initially,
>
> CREATE TABLE "NJIPD "."IVPWGMR" ("IVDY01" DECIMAL(2,0) , "IVMO01"
> DECIMAL(2,0) , "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY
> ( START WITH +1 , INCREMENT BY +1 , NO CACHE ) ) IN "USERSPACE1" NOT
> LOGGED INITIALLY ;
>
> right now i have to delete almost one million rows in the table, so i
> found that i can use alter table activate not logged initially before
> i execute delete, but i found that delete still use the transaction
> log and cause log error full problem , why is that?


"not logged initially" is turned off after the first commit. So it will
only help you if you're deleting all the rows via one DELETE statement and
then committing the changes.

--
Matt Emmerton


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-26-2008, 05:56 PM
Mark A
 
Posts: n/a
Default Re: alter table activate not logged initially


"Matt Emmerton" <memmerto@yahoo.com> wrote in message
news:e1cmc.410093$2oI1.211961@twister01.bloor.is.n et.cable.rogers.com...
>
> "xixi" <dai_xi@yahoo.com> wrote in message
> news:c0f33a17.0405051212.634143be@posting.google.c om...
> > hi, i have a table with create ddl using not logged initially,
> >
> > CREATE TABLE "NJIPD "."IVPWGMR" ("IVDY01" DECIMAL(2,0) , "IVMO01"
> > DECIMAL(2,0) , "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY
> > ( START WITH +1 , INCREMENT BY +1 , NO CACHE ) ) IN "USERSPACE1" NOT
> > LOGGED INITIALLY ;
> >
> > right now i have to delete almost one million rows in the table, so i
> > found that i can use alter table activate not logged initially before
> > i execute delete, but i found that delete still use the transaction
> > log and cause log error full problem , why is that?

>
> "not logged initially" is turned off after the first commit. So it will
> only help you if you're deleting all the rows via one DELETE statement and
> then committing the changes.
>
> --
> Matt Emmerton
>

To add to what Matt has said, you need turn off auto-commit for this to
work, and then explicitly commit after the delete. This can be done with the
+c parm on the db2 command line. For example.

db2 +c -tvf input.sql

In input.sql you will have 3 SQL statements:

alter table ... (to set not logged initially) ;
delete ... ;
commit;


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:44 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com