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 > equivalent of truncate command of ORACLE

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-28-03, 14:57
soumil soumil is offline
Registered User
 
Join Date: Jul 2003
Posts: 30
equivalent of truncate command of ORACLE

What would be the equivalent of truncate table command of ORACLE in UDB.

I need to clean up the tables without dropping it and without creating tons of log files.

What are my options ?

Also if I can pile on one more question : How do I put the user tablespace USER1 in an offline mode ? ( I would also appreciate if you can point me to any particular references for tablespace management)
Thanx
-Soumil
Reply With Quote
  #2 (permalink)  
Old 10-28-03, 15:15
manga manga is offline
Registered User
 
Join Date: Oct 2003
Posts: 18
Re: equivalent of truncate command of ORACLE

You can try using this command,

alter table .... activate not logged initiatlly with empty table..

this will delete all rows maintaining all other definitions.
Reply With Quote
  #3 (permalink)  
Old 10-28-03, 17:34
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Re: equivalent of truncate command of ORACLE

Quote:
Originally posted by manga
You can try using this command,

alter table .... activate not logged initiatlly with empty table..

... only if the table has been created with "NOT LOGGED INITIALLY" option.

You can effectively truncate a table by LOADing or IMPORTing an empty file into it (with REPLACE option).
Reply With Quote
  #4 (permalink)  
Old 10-28-03, 17:40
db2os390udbdba db2os390udbdba is offline
Registered User
 
Join Date: Oct 2003
Posts: 8
Arrow Re: equivalent of truncate command of ORACLE

create one dummy file
if it is unix

touch test.txt

replace table with dummy file, that ownt create log same as truncate table in Oracle

db2 load from test.txt of del replace into <table name>

--Raju
Reply With Quote
  #5 (permalink)  
Old 10-29-03, 02:13
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Re: equivalent of truncate command of ORACLE

For an empty file, you can use system's /dev/null ...

there is a windows equivalent also, unfortunately, I do not remember

Sathyaram

Quote:
Originally posted by db2os390udbdba
create one dummy file
if it is unix

touch test.txt

replace table with dummy file, that ownt create log same as truncate table in Oracle

db2 load from test.txt of del replace into <table name>

--Raju
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
Reply

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