Skip to content

Instantly share code, notes, and snippets.

@davidhooey
Last active December 25, 2015 05:19
Show Gist options
  • Save davidhooey/6923363 to your computer and use it in GitHub Desktop.
Save davidhooey/6923363 to your computer and use it in GitHub Desktop.
Oracle Segment Shrink
-- ROW MOVEMENT is required to move rows.
-- SHRINK SPACE COMPACT moves the rows without resetting the high water mark.
-- SHRINK SPACE moves the rows and resets the high water mark which temporarily locks the table.
-- May need to rebuild the indexes after a shrink.
alter table [tableName] enable row movement;
alter table [tableName] shrink space compact;
alter table [tableName] shrink space;
alter index [indexName] shrink space compact;
alter index [indexName] shrink space;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment