English

How To: Compress a versioned database to state 0

Summary

Instructions provided describe how to compress a versioned database to state 0. The objective of a compress is to delete non-referenced states, combine states that share the same lineage, and move rows from the delta tables into the base tables. If the compress command does not return an error, the compress is successful. If the intention is to compress the entire instance to state 0, then additional steps must first be performed prior to executing the compress command.

If the instance has not been compressed to state 0 and there is an attempt to unregister a class as versioned, a warning message may be encountered.
[O] Show me
The warning may occur because the delta tables of the versioned class still contain rows that have not been compressed and are still being referenced by a version.

The frequency required for compressing is dependent upon the volume of edits. There is no harm in executing compress frequently; for example, daily, and it may be beneficial. The compress command removes as many un-referenced states as possible and, if applicable, moves rows from the delta tables to the base tables. Edits that are still referenced by a version continue to reside in the delta tables.

Procedure

Follow the steps below.

  1. Reconcile and post all versions which are ready to be applied to the DEFAULT version. Alternatively, delete the versions.
  2. Delete all versions, excluding the sde.DEFAULT version.
  3. Verify no users are connected. A connection acquires a state lock and a locked state cannot be compressed.
  4. Compress the database.
    Compress the database using command line:

    Code:
    sdeversion -o compress [-N] -u sde -p sde_password -i -s
    -D

    Alternatively, compress the database using the Compress Database tool in ArcCatalog. Add this tool as follows:
    1. Navigate to Tools > Customize
    2. Drag and drop the compress database tool to the menu bar in ArcCatalog. Now this tool is available to be used for compressing the SDE databases.
    [O-Image] [O] Show me
  5. Verify the DEFAULT version references state_id 0 by describing the version with the ArcSDE utility sdeversion –o describe once the compress command completes. The output should show the value for the DEFAULT version’s state_id to be 0. The delta tables of the versioned class should be empty.
  6. Analyze the database to update database statistics for best performance.