DB2 Utilities – Why You Need REORGCHK

REORGCHK utility improves performance when you run it on a selected table space. If you get errors like Reorg-Check pending status then you need this utility to resolve the issue. Gaps can get created in tablespace containers over the life of a database.

So how do you know how much storage space is currently being utilized by data and how much is free, but part of an unusable gap? You can obtain this information by using DB2’s REORGCHK utility.

Execution

When executed, this utility generates statistics on the database, and analyzes the statistics produced to determine whether or not one or more tables need to be reorganized (which will cause existing internal gaps to be removed).

Syntax

The REORGCHK utility is invoked by executing the REORGCHK command using the DB2 Command Line Processor. The basic syntax for this command is:

REORGCHK
<UPDATE STATISTICS | CURRENT STATISTICS>
<ON TABLE USER |
ON SCHEMA [SchemaName] |
ON TABLE [USER | SYSTEM | ALL | [TableName]>

where:

SchemaName Identifies the name assigned to a schema whose objects are to be analyzed to determine whether or not they need to be reorganized.
TableName Identifies the name assigned to a specific table that is to be analyzed to determine whether or not it needs to be reorganized.

So if you wanted to generate statistics for all tables that reside in the PAY-ROLL schema and have those statistics analyzed to determine whether or not one or more tables needs to be reorganized, you could do so by executing a REORGCHK command that looks something like this:

Command to run REORGCHK

  REORGCHK UPDATE STATISTICS ON SCHEMA PAYROLL

Related posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.