Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'Truncating' a Table

Tips and Tricks

'Truncating' a Table

by  sathyarams  Posted    (Edited  )
The following discussion holds good for V7 ...

1. Using DELETE

DELETE FROM <tablename>

This causes all the rows in the table to be deleted. Log records are written. If the table is large(in terms of millions of records), a very large active log space is required. DELETE Triggers are fired.

2. Using IMPORT/LOAD

IMPORT from /dev/null of del
replace into <tablename>
LOAD from /dev/null of del
replace into <tablename> NONRECOVERABLE

More privelages are required for these tasks. IMPORT .. REPLACE requires CONTROL on the table and LOAD requires LOAD Authority on the table. Good thing about this is that there is minimal logging.
The tables may be left in check pending state. DELETE Triggers are not fired.

From the database recovery point of view, it is advisable to use IMPORT

3. Using NLI

ALTER TABLE <tablename> NOT LOGGED INITIALLY WITH EMPLY TABLE

The table should have been created with the NLI Option. No logging is done. DELETE triggers are not fired.






Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top