473,386 Members | 1,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

truncate table for DB2 - differences

Hello all,

what is the internal difference between the following two truncate
table commands:
db2 import from /dev/null of del replace into <table_name>

and

alter table <table_nameactivate not logged initially with empty
table
Thank you very much in advance.

Kind regards,

Stefan

--
Stefan Mueller
Hamburg, Germany

Jun 20 '07 #1
7 6077
The IMPORT can be handled by roll-forward recovery.
The ALTER TABLE cannot.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jun 20 '07 #2
Hi Serge,

thank you very much for your fast reply.

Is it more likely to get a dead lock by using the IMPORT command
instead using the ALTER TABLE?

Kind regards,

Stefan

Jun 20 '07 #3
Stefan Mueller wrote:
Is it more likely to get a dead lock by using the IMPORT command
instead using the ALTER TABLE?
In general I would assume that table truncation is at the beginning of a
transaction (or on its own). I fail to see how that could cause a deadlock.

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jun 20 '07 #4
You may consider using LOAD instead of import.

@Ekta

Jun 23 '07 #5
On Sat, 23 Jun 2007 19:28:25 +0000, Ekta wrote:
You may consider using LOAD instead of import.
I generally try to use INSERT instead of LOAD whenever feasible. I've
seen LOAD result in rather nasty need-to-involve-the-DBA-and-even-
sometimes-IBM-support situations because of LOAD operations that failed.

--
Regards,
Troels Arvin <tr****@arvin.dk>
http://troels.arvin.dk/
Jun 24 '07 #6
On Sun, 24 Jun 2007 19:33:39 +0000, I wrote:
I generally try to use INSERT instead of LOAD whenever feasible. I've
seen LOAD result in rather nasty need-to-involve-the-DBA-and-even-
sometimes-IBM-support situations because of LOAD operations that failed.
I meant to write "IMPORT" (not INSERT).

--
Regards,
Troels Arvin <tr****@arvin.dk>
http://troels.arvin.dk/
Jun 25 '07 #7
On Mon, 25 Jun 2007 17:58:10 +0000, Troels Arvin scribbled:
On Sun, 24 Jun 2007 19:33:39 +0000, I wrote:
>I generally try to use INSERT instead of LOAD whenever feasible. I've
seen LOAD result in rather nasty need-to-involve-the-DBA-and-even-
sometimes-IBM-support situations because of LOAD operations that
failed.

I meant to write "IMPORT" (not INSERT).
FYI - I've only seen what you describe with LOAD in situations where the
database is set up to use archived logging. With circular logging, I've
always found LOAD to be perfectly reliable (although a few SET INTEGRITY
calls may be required afterward, if foreign keys are defined).

Admittedly, circular logging has several limitations (no online backup,
no rollforward recovery, etc.) and certainly isn't suitable for many
installations - but if it is used, LOAD should be seriously considered as
an alternative to IMPORT.

Cheers,

Dave.

Jul 4 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ed | last post by:
I am trying to get some information to compare and contrast the Truncate Table function and the Drop Table function. I know that using Truncate Table is faster and saves the structure of the table...
3
by: martin | last post by:
Hi, We have a heavily used production server and a table which logs every hit on a web site. This table has grown large over time and we want to clear it down as efficiently as possible. We would...
3
by: LineVoltageHalogen | last post by:
Greeting All, I have a stored proc that dynamically truncates all the tables in my databases. I use a cursor and some dynamic sql for this: ...... create cursor Loop through sysobjects and...
5
by: ronin 47th | last post by:
Hi group, In one of the books 'Gurus Guide to Transact SQL' i found this info: ------------------------------------------------------------ TRUNCATE TABLE empties a table without logging row...
9
by: Sumanth | last post by:
Are there any implementations of truncate in db2. Is it going to be implemented in the future? Is there an alternate way of doing a truncate of a table that has a high record count without using...
6
by: pramod | last post by:
Hi I know we can truncate a table in DB2 by first creating it with NOT LOGGED INITIALLY option. and when we need to truncate it, run the following command alter table <table name> activate...
2
by: Neil | last post by:
Can one use Truncate Table on a linked server table? When I try it, I get a message that only two prefixes are allowed. Here's what I'm using: Truncate Table svrname.dbname.dbo.tablename
10
by: Troels Arvin | last post by:
Hello, Until this date, I believed that DB2 has no TRUNCATE TABLE command. But then I came across...
8
by: ananthaisin | last post by:
How to reduce the table size for any table while using truncate or delete statements. In oracle 8i it was truncating the storage space but in 10g it is not .... I have given truncate statement in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.