Monday, 27 May 2013

Classic/Offline Reorg Phases

Offline table reorganization uses a shadow copy approach, building a full copy of the table that is being reorganized.

The shadow copy image is built within the table space that the table being reorganized resides in. Optionally, the copy can be built in a system temporary table space if the USE option is specified when issuing the REORG TABLE command.

There are four possible phases in a classic or offline table reorganization:

  1. SORT
    If an index is specified with the REORG TABLE command, or if a clustering index is defined on the table, the rows of the table are first sorted according to that index. If the INDEXSCAN option is specified, an index scan is used to sort the table, otherwise, a table scan sort is used. This phase only applies to a clustering REORG. Space reclaiming reorganizations begin at the build phase.
  2. BUILD
    In this phase, a reorganized copy of the entire table is build, either in the table space that the table being reorganized resides, or in a temporary table space specified with the REORG command.
  3. REPLACE
    In this phase, the original table object is replaced by either copying back from the temporary table space, or by pointing to the newly built object within the table space of the table being reorganized.
  4. RECREATE ALL INDEXES
    All indexes defined on the table are recreated.

You can monitor the progress of the table reorganization and determine which phase the process is currently in using the snapshot monitor or snapshot administrative views.

No comments:

Post a Comment