Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Defragmentation of tablespace

RE: Defragmentation of tablespace

From: Stephen Lee <slee_at_dollar.com>
Date: Thu, 31 Oct 2002 08:28:53 -0800
Message-ID: <F001.004F899B.20021031082853@fatcity.com>

> -----Original Message-----
>
> Does anybody help me to defrag / reorganise the user tablespaces which
> is large in size.
> Is there any script for that ? If available can somebody send it to me
> ?
>

The two methods that come to mind are:

  1. Export the objects in the tablespace; drop them from the tablespace; coalesce the table tablespace; import the objects back in. If there are relationships between objects in this tablespace and those in another tablespace, it might be easier to export the entire schema, drop the schema's objects, then import the schema after coalescing all free space.
  2. Create a new tablespace (you might need to grant quota for a schema); move tables to that tablespace (which will require rebuilding any indexes on those tables after you are done); AND/OR rebuild indexes to that tablespace. If you are moving only indexes, you can do that online. You can move tables without taking down the database, but all the indexes go invalid when you move the table; so any DML activity will probably get clobbered. I suppose, if you wanted to go to the trouble, you could keep the database active by dropping indexes on any tables to be moved, then re-create the indexes after the tables were moved. This would allow at least some DML activity to continue -- at a reduced level of performance. Then move everything back to the original tablespace after coalescing if you need for the objects to reside in the original tablespace. (All the online stuff assumes your version of Oracle is recent enough to support it.)

Before going to all this trouble, try coalescing the free space in the tablespace, then look to see if you still have chunks of free space scattered all over the place, all of them smaller than you need, but the sum of which is considerable.

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Stephen Lee
  INET: slee_at_dollar.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Thu Oct 31 2002 - 10:28:53 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US