0

Running DB2 9.7.5 LUW on Windows 2008. I'm transfering data hourly from a MS SQL 2008 server over the WAN. I read the data from MS SQL, parse the data and batch insert into a work table in DB2, then in DB2 merge the data from the work table to the master table. Once the merge is done, I clear the work table to prepare for next load. I've noticed that my log files are very big. Since the db session is open and closed during data exchange, temporary tables are not suitable, hence the use of work tables. The data is transfered by a java app which I made.

I don't need to have the work table transactions logged. I've read this article from IBM and found that logging doesn't happen in the same work unit as when the table was created.

Using CREATE TABLE...NOT LOGGED INITIALLY and ALTER TABLE...NOT LOGGED INITIALLY really work? From what I understand once you have created the table that logging begins after the first commit?

Do I need to create the table everytime with not logged and then clear it with alter table not logged? Is there a better way?

4

2 回答 2

0

您不需要每次都创建表。ALTER TABLE...NOT LOGGED INITIALLY您在将数据插入同一工作单元(事务)中的表之前发出。

您没有说明如何清理工作台;我希望您正在使用该TRUNCATE TABLE语句,它比删除表记录更有效,并且可以最大限度地减少日志记录。

于 2014-03-24T18:11:10.020 回答
0

您无需更改最初未记录的表。您只需要每次使用 alter table tablename activate 来激活它,但最初没有记录。

于 2014-06-24T15:03:22.757 回答