RE: shrinking space

From: Bobak, Mark <>
Date: Wed, 1 Jun 2011 15:39:30 -0400
Message-ID: <>

Good point, Niall. If you have the resources available, by all means, use parallel!

From: Niall Litchfield [] Sent: Wednesday, June 01, 2011 3:30 PM
To: Bobak, Mark
Cc: Eugene Pipko; Subject: Re: shrinking space

Pretty fast - parallel dml might well speed up the and almost certainly the index builds.. On Wed, Jun 1, 2011 at 6:23 PM, Bobak, Mark <<>> wrote: Cool.

To expand a bit on my suggestion, now that I'm at a real keyboard and not on my phone......

Create table data_you_want to_keep nologging as select * from target_table where <stuff you want to keep>; Truncate table target_table;
For each index on target_table do:
Alter index <index_name> unusable;
End loop
Alter table target_table nologging;
Insert /*+ append */ into target table select * from data_you_want_to_keep; For each index on target table do:
Alter index <index_name> rebuild nologging; End loop

You're done.

That should be, by far, the fastest method.

Hope it helps,


From: Eugene Pipko [<>] Sent: Wednesday, June 01, 2011 1:16 PM
To: Bobak, Mark;<> Subject: RE: shrinking space

Thanks everyone for your responses.
I have a luxury of having downtime most weekends, so I will CTAS new table. That seem to be the simplest approach.

From: Bobak, Mark [<>] Sent: Tuesday, May 31, 2011 8:31 PM
To: Eugene Pipko;<> Subject: Re: shrinking space

Depending on if you can get maintenance window, I would CTAS new table with rows to keep, truncate original table, and then insert rows from temp table into empty table. Do as much as possible with nologging.


Sent from my Motorola ATRIX(tm) 4G on AT&T

-----Original message-----

From: Eugene Pipko <<>> To: "<>" <<>> Sent: Wed, Jun 1, 2011 03:21:03 GMT+00:00 Subject: shrinking space
Hi all,
Oracle on Win 2003.
SAP admitted a bug in their app, which resulted in millions of rows inserted in a couple of tables. They came up with a script to delete them, but failing to provide any solutions on how to reclaim unused space. One of the tables has CLOB column and another has BLOB column in them.

Question: how do I shrink tables with CLOB and BLOB columns?



Niall Litchfield
Oracle DBA

-- Received on Wed Jun 01 2011 - 14:39:30 CDT

Original text of this message