Reorg table DB2

Step 1

run reorgchk:
——CODE START—————
db2 reorgchk update statistics on table all > output.out
——CODE END——————

Running the command this way will run across all tables rather than RUNSTATS across every table.
The reorgchk update statistics report has two sections; the first section is the table information and
the second section is the indexes. If there’s an asterisk in the last column a reorganization is needed.
To reorganize the tables with an asterisk in the last column:

——-CODE START—————-
db2 reorg table table_name
——-CODE END——————
where table_name is the name of the table to be reorganized; for example, MYDB.MYTABLE.
Generally speaking, because most data in databases  is accessed by index, reorganizing tables is usually not as beneficial as reorganizing indexes.

To reorganize the indexes with an asterisk in the last column

———-CODE START——————-
db2 reorg table table_name index index_name
———-CODE END———————

where table_name is the name of the table; for example, MYDB.MYTABLE
index_name is the name of the index

Run reorgchk again. The output from reorgchk can then be used to determine whether the reorganization worked and whether it introduced other tables and indexes that need reorganizing.

Reorg table DB2 is straightforward but, If it’s a production database , run the db2 reorg procedure at a low activity time. Reorg table DB2 can be a resource intensive procedure

Author: Jack Vamvas

Leave a Reply

Discover more from ciquery

Subscribe now to keep reading and get access to the full archive.

Continue reading