DB2 Version 9.7 for Linux, UNIX, and Windows

Reorganizing tables online

An online or inplace table reorganization allows users to access a table while it is being reorganized.

About this task

After you have identified the tables that require reorganization, you can run the reorg utility against those tables and, optionally, against any indexes that are defined on those tables.

Before you begin

You must have SYSADM, SYSCTRL, SYSMAINT, DBADM, or SQLADM authority, or CONTROL privilege on the table that is to be reorganized. You must also have a database connection to reorganize a table.

Procedure

  1. To reorganize a table online using the REORG TABLE command, simply specify the name of the table and the INPLACE option. For example:
       reorg table employee inplace
  2. To reorganize a table online using an SQL CALL statement, specify the REORG TABLE command with the ADMIN_CMD procedure. For example:
       call sysproc.admin_cmd ('reorg table employee inplace')
  3. To reorganize a table online using the administrative application programming interface, call the db2Reorg API.

Results

What to do next

After reorganizing a table, collect statistics on that table so that the optimizer has the most accurate data for evaluating query access plans.