TRUNCATE
Week #2: Articles
Learning Outcomes
- Learn how to truncate tables.
CREATE
StatementALTER
StatementDROP
StatementRENAME
StatementTRUNCATE
StatementCOMMENT
Statement
TRUNCATE
tables
This section shows you how to truncate tables.
Instruction Details →
The TRUNCATE
statement gives you the ability to remove data from any table without writing changes to a redo log file, or any archive log file. The TRUNCATE
statement deallocates all space previously used by the removed rows of a table in a dictionary-managed tablespace. The TRUNCATE
statement leaves the MINEXTENTS
storage parameter and resets the NEXT
storage parameter to the size of the last extent removed from the segment where the data was stored. The TRUNCATE
statement doesn’t shrink the size of the tablespace, which is where the internal segments and extents that manage data are stored. You can find more on the logical storage structures in the Oracle Database Concepts manual.
The TRUNCATE
statement removes all data from the item table with the following:
TRUNCATE TABLE item; |
You should use the TRUNCATE
statement when you want to remove data without a recovery point. It is very fast and DBAs typically use it when they’ve already copied data somewhere else. The DBA then removes the data with the TRUNCATE
statement and restructure the STORAGE
clause of the table.