Kwil,
There are a couple of interpretations of "reclaim...space":
1) Make the freed tablespace space available to Oracle for use by other objects in the same tablespace, and,
2) Make the freed tablespace disk space available to the file system for use by the operating system.
If you have DELETEd data from one or more tables, the "deleted" space is available for reuse only by that table for new or expanded rows. To make the space available to other tables/objects in the same tablespace, you can simply say:
Code:
ALTER TABLE <tablename> MOVE PARALLEL NOLOGGING;
This causes a
very fast reorganisation of the table, freeing up intra-table "Swiss Cheese" holes of freespace to the tablespace. If you empty out a table by using the "TRUNCATE TABLE <tablename>;" command, then the freed space returns automatically to the tablespace for re-use by the same, or other, tables.
If you wish to follow Option 2, above (to return freespace to the file system for re-use/re-allocation by the o/s to other Oracle or non-Oracle files), then you must "empty out" the entire tablespace into another tablespace, then drop the Oracle datafiles that formerly provided storage space to the newly emptied tablespace. To do this, you can
1) export to a dump file all of the Oracle users/schemas that have objects in the tablespace that you have targetted for dropping. Then,
2)
Code:
DROP TABLESPACE <tablespace_name>;
CREATE TABLESPACE <same tablespace_name>
DATAFILE '<same filename as before>' 10M [B]REUSE[/B]
AUTOEXTEND ON NEXT 10M MAXSIZE 2000M
EXTENT MANAGEMENT LOCAL AUTOALLOCATE; -- (my preference)
3) import the dump file that you created in step 1.
The above strategy returns to the operating system's file system all of the "Swiss Cheese" freespace that may have existed amongst all Oracle objects in the subject tablespace.
If any questions remain, please follow up.
![[santa] [santa] [santa]](/data/assets/smilies/santa.gif)
Mufasa
(aka Dave of Sandy, Utah, USA)
[
Providing low-cost remote Database Admin services]
Click here to join
Utah Oracle Users Group on Tek-Tips if you use
Oracle in
Utah USA.