Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

reuse old datafile space

user8786417Jan 30 2015 — edited Jan 30 2015

Hi all,

I have a tabelspace which has 6 datafiles, i went through a mass delete operation, which should free up the space taken in the older datafiles. My question is how can i get oracle to reuse the tablespace again? when i had a look at the tablespace it was still showing as 95% used.

I found the following link, but i am not sure if this is something that looks safe (not a dba):

ALTER TABLE MYTABLE ENABLE ROW MOVEMENT;

This enables row movement of the table. THis is necessary so that oracle is able to actually move the rows to other free extents in order to shrink the space needed.

SQL> ALTER TABLE MYTABLE SHRINK SPACE COMPACT;

This shrinks the used space of the table, but does not update the HWM. This is usefull if you don't want to have a table-level lock during business hours.

SQL> ALTER TABLE MYTABLE SHRINK SPACE;

This command shrinks the contents of the table and subsequently updates the HWM. This statement can also be used after a shrink with 'compact' option has been done, just to update the HWM.

SQL> ALTER TABLE MYTABLE SHRINK SPACE CASCADE;

This command shrinks the contents of the table and all dependent objects like indexes.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 27 2015
Added on Jan 30 2015
8 comments
1,964 views