Bulk delete from table using db2 connector?

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
karumudi7
Participant
Posts: 20
Joined: Sun Mar 11, 2012 3:30 am
Location: Detroit
Contact:

Bulk delete from table using db2 connector?

Post by karumudi7 »

Hi,
I have one table with 70 Million recs. I need to make fresh load into the table using a file have 72 Million recs.

So I created a job; Seq_file--->Transformer--->db2_connector

In db2_connector I tried with:
Write Mode- Insert & Table Action-Truncate - This caused by DB transaction log full while deleting the data from table.

I tried one more with Before routine:
db2 "connect to DBNAME user USERNAME using Pwd"; db2 "load from /dev/null of del replace into TABLE_NAME NONRECOVERABLE"

and made the db2 connector as Write mode - Insert & table action - Append.

In this case, the first query executed successfully but for the second one I got "SQL1024N A database connection does not exist. SQLSTATE=08003"

Anyother way where I can achieve this?
DataStage 11.3 on AIX 7.1 with DB2.
MT
Premium Member
Premium Member
Posts: 198
Joined: Fri Mar 09, 2007 3:51 am

Post by MT »

Hi karumudi7,

you were close to the solution already.

Try following settings in the DB2 Connector
Write mode: Insert
Table action: Truncate
Generate truncate statement at runtime: No
Truncate statement: truncate tabe_xxx reuse storage immediate

This is assuming you have at least DB2 9.7 running.
Otherwise use following statement as Truncate statement:
alter table table_xxx activate not logged initially with empty table
regards

Michael
karumudi7
Participant
Posts: 20
Joined: Sun Mar 11, 2012 3:30 am
Location: Detroit
Contact:

Post by karumudi7 »

The statement generated is ALTER TABLE TABLE_NAME ACTIVATE NOT LOGGED INITIALLY WITH EMPTY TABLE.

The ALTER TABLE statement failed, most likely due to insufficient user privileges. A DELETE statement will be executed instead.

Due to delete query execution I am getting DB Tx log full.
DataStage 11.3 on AIX 7.1 with DB2.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Then get privileges to effect that particular ALTER TABLE statement.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply