++ed by:

1 non-PAUSE user.

Richard Sutherland


defrag.pl -- Creates SQL*Plus command files to defragment a tablespace.


[ ? | -? | -h | --help ]












Note: descriptions of each of these arguments are provided via 'help', which may be displayed by entering 'defrag.pl' without any arguments.


Creates command files to defragment (reorganize) an entire Oracle Tablespace. Arguments are specified on the command line.

A "defrag" is usually performed to recapture the little fragments of unused (and unusable) space that tend to accumulate in Oracle tablespaces when objects are repeatedly created and dropped.. To fix this, data is first exported. Objects are then dropped and the tablespace is "coalesced" into one large extent of available space. The objects are then recreated using either the default sizing algorithm or a user supplied algorithm, and the data is imported. Space utilized is then contiguous, and the unused free space has been captured for use.

The steps in the process are:

    1.  Export all objects in the tablespace (tables, indexes, partitions).
    2.  Drop all objects.
    3.  Coalesce the tablespace.
    4.  Create all tables and partitions, resized appropriately.
    5.  Import the data into the new structures.
    6.  Recreate the indexes.
    7.  Restore all constraints.




The names and number of files output varies according to the Tablespace specified and the options selected. All .sql and .log files and shell scripts produced are displayed on STDOUT during the execution of the program.

Also, see 'README.defrag', which will be created when Help is displayed (by entering 'defrag.pl' without any arguments).


 Richard V. Sutherland


Copyright (c) 2000, 2001 Richard V. Sutherland. All rights reserved. This script is free software. It may be used, redistributed, and/or modified under the same terms as Perl itself. See: