snippetMinor
How to free space after deleting the millions of rows from a table
Viewed 0 times
afterrowsdeletingspacethefreemillionshowfromtable
Problem
I performed a delete operation on my table . It deleted around 10 millions of rows from it
How do I free the space associated with the deleted data.
I used the query:
But it did not work for me. Do I need to concern about the index's associated with the table?
If that is the case, how do I need to do it.
How do I free the space associated with the deleted data.
I used the query:
alter table tablename shrink space;But it did not work for me. Do I need to concern about the index's associated with the table?
If that is the case, how do I need to do it.
Solution
alter table TABLENAME move;followed by rebuilding the indexes on that table should do what you want.
After 'moving' the table around, the indexes for the rows will become unusable (as you can verify with something like):
select index_name, status from all_indexes
where table_name = 'TABLENAME' and
owner = 'SOMEUSER';So, you would rebuild such an unusable index with a
alter index TABLENAME_IX_01 rebuild;Code Snippets
alter table TABLENAME move;select index_name, status from all_indexes
where table_name = 'TABLENAME' and
owner = 'SOMEUSER';alter index TABLENAME_IX_01 rebuild;Context
StackExchange Database Administrators Q#11339, answer score: 5
Revisions (0)
No revisions yet.