Next Extent Size Is Reset after Truncate
March 2nd, 2008
You can alter table’s next extent size in DMT tablespace.
But if the table has already allocated old size extents. The next extent size will be reset after truncate.
See below:
First, create a table in DMT tablespace with 5M next extent size.
- SQL> create table tt(x int) tablespace CSHAN_TEST storage(initial 5M next 5M pctincrease 0);
- Table created.
- SQL> alter table tt allocate extent;
- Table altered.
- SQL> /
- Table altered.
- SQL> /
- Table altered.
- SQL> /
- Table altered.
- SQL> /
- Table altered.
- SQL> /
- Table altered.
- SQL> select initial_extent,next_extent from dba_tables where table_name='TT' and owner='SYS';
- INITIAL_EXTENT NEXT_EXTENT
- -------------- -----------
- 5242880 5242880
- SQL> select extent_id,bytes from dba_extents where segment_name='TT' and owner='SYS';
- EXTENT_ID BYTES
- ---------- ----------
- 0 5242880
- 1 5242880
- 2 5242880
- 3 5242880
- 4 5242880
- 5 5242880
- 6 5242880
- 7 5242880
- 8 5242880
- 9 5242880
- 10 5242880
- 11 5242880
- 12 5242880
- 13 5242880
- 14 5242880
- 15 5242880
- 16 rows selected.
Then alter table’s next extent size to 10M.
- SQL> alter table tt storage(next 10M);
- Table altered.
- SQL> alter table tt allocate extent;
- Table altered.
- SQL> select extent_id,bytes from dba_extents where segment_name='TT' and owner='SYS';
- EXTENT_ID BYTES
- ---------- ----------
- 0 5242880
- 1 5242880
- 2 5242880
- 3 5242880
- 4 5242880
- 5 5242880
- 6 5242880
- 7 5242880
- 8 5242880
- 9 5242880
- 10 5242880
- 11 5242880
- 12 5242880
- 13 5242880
- 14 5242880
- 15 5242880
- 16 5242880
- 17 10485760
- 18 rows selected.
- SQL> select initial_extent,next_extent from dba_tables where table_name='TT' and owner='SYS';
- INITIAL_EXTENT NEXT_EXTENT
- -------------- -----------
- 5242880 10485760
Truncate table:
- SQL> truncate table tt;
- Table truncated.
You can see the table’s next extent size goes back to 5M.
- SQL> select initial_extent,next_extent from dba_tables where table_name='TT' and owner='SYS';
- INITIAL_EXTENT NEXT_EXTENT
- -------------- -----------
- 5242880 5242880
- SQL> alter table tt allocate extent;
- Table altered.
- SQL> select extent_id,bytes from dba_extents where segment_name='TT' and owner='SYS';
- EXTENT_ID BYTES
- ---------- ----------
- 0 5242880
- 1 5242880
- 2 5242880
- 3 5242880
- 4 5242880
- 5 5242880
- 6 5242880
- 7 5242880
- 8 5242880
- 9 5242880
- 10 5242880
- 11 rows selected.
Добавлю в избранное, написано не плохо