Use the PACK command on an open database to recover unusable disk space.
Packs File 1 (schema information), File 2 (data), File 3 (indexes), and File 4 (large object data).
Specifies the name of the database to pack.
Specifies a particular table whose indices you want to PACK.
Use this option to PACK all indices for the currently connected database. PACK INDEX is supported in multi-user environments.
Packs a specified index from File 3 (indexes); this option will work when STATICDB is set on. PACK INDEX indexname is now supported in multi-user environments. This command will execute on the currently connected database.
Packs only File 3 (indexes).
Use this option to remove deleted rows from the SYS_PASSWORDS table. A "PACK TABLE SYS_PASSWORDS" is performed upon the system table. The completion of the PACK PASSWORD command will also assign the correct row count to the SYS_PASSWORDS table. The PACK PASSWORD command is supported in a multi-user session. The database must be connected in order to use this command.
Packs only File 1 (schema information). The database schema stores the internal order in which tables and views were defined. When the database structure is unloaded, the order is used for primary key tables to be created before foreign key tables. Views are also stored in the order of creation, where views based on other views are unloaded after all the other views it is dependent upon.
If any view that another view it is dependent upon is deleted and redefined, a PACK SCHEMA should be performed. Then, the view with the dependencies should be deleted and recreated. This would place the view with the dependencies after all the other views it is dependent upon within the internal order. The steps would ensure a database UNLOAD and rebuild is successful where views with the dependencies are created last.
Packing a single table when MULTI is set ON. This parameter is very beneficial with databases that are always is use.
WITH USER CASE
Replaces the case folding/collating tables in the database with those defined in the user configuration file.
About the PACK Command
Disk space becomes unusable when you delete rows or indexes, remove columns or tables, or add or modify columns with the ALTER TABLE command. To use the PACK command, a database must be open. If the database you want to pack is not in the current directory, include the drive, path, and database name. When you pack a database that is in a different directory, R:BASE closes any open database, then opens the database you want to pack.
PACK requires the database owner's user identifier if the database is protected by the owner's user identifier.
You cannot use PACK when a database is stored on a network drive and MULTI has been set on, unless you are ONLY packing one table. Set MULTI off before packing the database.
PACK is unavailable when transaction processing is on.
Because you pack an open database, backup your database before you pack it. An interruption to a pack could cause damage to your database.
PACK Versus RELOAD
Both the PACK and RELOAD commands recover unusable disk space; however, RELOAD requires more disk space than PACK because RELOAD copies a database table by table, collects the rows of each table, then reorganizes the rows on the disk.
PACK KEYS versus PACK INDEX
PACK KEYS is to be used with MULTI set OFF as it recreates a new index file with clean indexes. PACK INDEX can be used while users are connected to the database with MULTI set ON, only adding to the current index file. After using PACK KEYS, you should see a decrease in the index file size.
The following command packs the ConComp database in the RBTI directory on drive C: