DB2 Utilities
DB2 Utilities
DB2 Utilities
Table of Contents
Point 2: DB2 Utilities........................................................................................................................1
Online Utilities...................................................................................................................................2
Data Consistency Utilities.......................................................................................................2
Data Organization Utilities......................................................................................................6
Backup and Recovery Utilities................................................................................................8
Catalog Manipulation Utilities................................................................................................12
Offline Utilities................................................................................................................................15
Change Log Inventory Utility.................................................................................................15
Print Log Map Utility..............................................................................................................15
The DB2 Log Preformat Utility..............................................................................................16
Miscellaneous Utilities...................................................................................................................17
Online Utilities.......................................................................................................................17
Offline Utilities.......................................................................................................................19
Related Topics................................................................................................................................20
Point 2: DB2 Utilities
Shweta Bashani
DB2 provides utilities that help structure data in its databases. These utilities also help create
backup and recover application data. You can also use these utilities to assemble statistical
information about DB2 databases.
DB2 provides both online and offline utilities. Online utilities work only when the DB2 environment is
active. The offline utilities do not require DB2 to be active at the time of execution.
This ReferencePoint explains the various DB2 utilities with their syntax. In addition, it covers various
scenarios in which these utilities can be put to use.
Reprinted for dzpkhz, EDS Web Universities/Training SkillSoft, SkillSoft Corporation (c) 2002, Copying Prohibited
Online Utilities
The DB2 environment should be active during the execution of an online utility. Online utilities use
individual attach mechanisms to connect with DB2, instead of running under the Terminal Monitor
Program (TMP) of DB2.
To run a utility, you need to generate a control statement that identifies the task that the utility has to
perform. When an online utility is running, the SYSIN DD input statement obtains the control
statement for the utility.
DB2 utilities allow the concatenation of input datasets with varying block sizes, record lengths, or
applied formats. This is not permitted for output datasets.
• CHECK
• REPAIR
• REPORT
• DIAGNOSE
The CHECK utility verifies the integrity of DB2 data structures. It also verifies that the data values
adhere to the specified table constraints, the joined tables follow the specified rules, and the
indexes correspond to the data. For example, you could specify that a field as not NULL while
designing a table. This means the column corresponding to that field in the table cannot have any
NULL values.
The CHECK utility is used to check whether the data in the table matches the specified criteria and
the applied restriction. This utility is used with two options − CHECK DATA and CHECK INDEX.
Reprinted for dzpkhz, EDS Web Universities/Training SkillSoft, SkillSoft Corporation (c) 2002, Copying Prohibited
DB2 ReferencePoint Suite 3
The CHECK DATA option checks the violation of the referential integrity rules between two tables. It
also checks whether data values conform to the data validation constraints applied to the table
space that is specified with the utility command. For example, if two tables EMP and DEPT are
joined with the data field dept_no, the utility will check whether the values in both tables correspond
with each other. If the utility detects any error, it will report the error and possibly resolve it.
The utility can be run for a single or multiple table space or for a specific partition of a table space. If
the utility encounters any violation, it deletes the invalid rows of data or copies them to an exception
table. The table space being checked is placed in the CHECK−pending status. After reporting and
solving the errors, the CHECK−pending status is reset.
The CHECK DATA option runs after a conditional restart or when the base tables do not correspond
to each other. Some scenarios in which this utility works are:
• When a table is loaded without the ENFORCE CONSTRAINT option. This option of the
LOAD utility implements the constraints that were defined when the table was created.
• When a check constraint is added in an existing table and it violates the existing data.
• When the CHECK DATA utility detects any violation of the data integrity rules, while deleting
rows of erroneous data during its execution. You can run the utility again to fix the problem.
• When you need to perform partial recovery of the table spaces that are referentially joined.
• When the reliability of data that binds the table spaces referentially needs to be checked.
• When the CHECK−pending status of the table space is to be removed for future access and
use of data.
The above CHECK DATA statement works on the DSN9D41A.DSN9S41D table space. The utility
checks that the DSN9410.DESIG dataset meets all the referential constraints. If a violation is
encountered, the utility deletes all improper rows and puts them into the exception table
DSN9410.DESIG_EXCPTN.
Reprinted for dzpkhz, EDS Web Universities/Training SkillSoft, SkillSoft Corporation (c) 2002, Copying Prohibited
DB2 ReferencePoint Suite 4
Note The CHECK DATA utility run parallel to the DIAGNOSE, MERGECOPY, MODIFY,
REPORT, and STOSPACE utilities.
The CHECK INDEX option is applied while checking the consistency of index data with its
corresponding table data. It detects and states the Record ID (RID) pointer errors if index keys are
absent or if they do not match with the table data. CHECK INDEX can function in the case of a full
index or a single index partition. You have to fix the problem using the RECOVER INDEX utility
because CHECK INDEX only detects and reports the invalid index entries.
You need to execute the CHECK INDEX option after every conditional restart or partial recovery
and before running CHECK DATA to ensure that the indexes that CHECK DATA uses are valid,
especially when the DELETE YES option is specified.
In the above example, the first CHECK INDEX statement checks all the indexes for the
DSN9D41A.DSN9S41D table space. Subsequent CHECK INDEX statements check only specified
indexes, such as DSN9410.XDES1 and DSN9410.XDES2.
Note The CHECK INDEX utility is compatible with the CHECK DATA, LOAD, RECOVER,
REORG INDEX, REPAIR REPLACE, and REPAIR DELETE utilities.
The REPAIR utility repairs or fixes data in tables and their related data structures. The data can be
of any type, such as data contained in a table or data that is generally not accessed, such as map
pages and index entries. The options of the REPAIR utility are:
• REPAIR DBD: Tests Database Descriptors (DBDs) that point to corresponding data items in
the DB2 catalog database.
• REPAIR LOCATE: Changes the data at specified locations of a dataset. The result of a
REPAIR utility usually contains the altered page or pages in the specified DB2 table or index
and a dump of the contents. The REPAIR utility with the Log YES option can be used to
ensure that all changes made are logged and recovered. The REPAIR utility should be
carefully used because it substitutes the existing data with new data.
REPAIR OBJECT
LOCATE TABLESPACE DSN9D41A.DSN9S41D PAGE X'05'
VERIFY OFFSET 50 DATA X'A00'
REPLACE OFFSET 50 DATA X'D11'
DUMP OFFSET 50 LENGTH 4
//*
The above REPAIR statement alters the data on the fifth page at offset 50 from its initial value
XA00 to XD11. The utility statement first checks whether or not the location matches the value
XA00 and then modifies the data by replacing it with the new data specified. The four characters
are dumped to ensure that the changes made are correct.
• Tablespace set report: Contains the names of the table spaces and the tables joined by
referential integrity.
• Recovery report: Contains information that is fundamental for the recovery of tables and its
indexes.
REPORT TABLESPACESET is useful for documentation as well as the validation of DB2 objects
according to referential integrity rules.
REPORT RECOVERY is useful when information related to the recovery of a table space is
required.
The above REPORT statement operates on DSN9D41A.DSN9S41D table space. The utility
produces a report of names of all table spaces that are referentially linked with the specified table
space.
The DIAGNOSE utility is useful in identifying problems with other utilities. It is used to format the
information in SYSIBM.SYSUTILX for printing.
The preceding DIAGNOSE statement displays all rows in the SYSIBM.SYSUTIL DB2 Directory
table.
Reprinted for dzpkhz, EDS Web Universities/Training SkillSoft, SkillSoft Corporation (c) 2002, Copying Prohibited
DB2 ReferencePoint Suite 6
The LOAD utility loads data in a table space or in the dataset of a table space. It also performs the
following tasks:
• Inserting data into an existing table to preserve the existing data integrity.
The LOAD utility is governed by two principles. The first principle sets aside sufficient Direct Access
Storage Device (DASD). This is used to record the LOAD work datasets that are useful when the
execution of a utility is stopped. The second principle does not allow additional DASD and the work
datasets are treated as temporary, resulting in loss of datasets.
• To append or replace bulk rows by using the REPLACE option or the RESUME (YES)
option, respectively.
• To delete all rows from a non−segmented table space by specifying an empty input dataset.
• To insert data in a DB2 table for the first time by using LOAD in place of lengthy application
program code.
The above LOAD DATA statement adds the data from the SYSRECAC file to the table
DSN9D41A.ACT. The RESUME YES option is used to load records in a nonempty table. If the table
space is empty, the loading is resumed after a warning message.
Reprinted for dzpkhz, EDS Web Universities/Training SkillSoft, SkillSoft Corporation (c) 2002, Copying Prohibited
DB2 ReferencePoint Suite 7
Note The LOAD utility can run simultaneously with the DIAGNOSE, MODIFY
STATISTICS, REPORT, and STOSPACE utilities.
The REORG utility is used to reorganize table spaces and indexes to increases the efficiency of
accessing DB2 objects. The utility includes:
• A RUNSTAT job for registering information on the active table space or indexes in the DB2
catalog so that the DB2 optimizer can determine the access path.
• Two copy jobs − one before running the REORG utility and the other after running the
REORG utility to ensure that the data can be recovered.
• A REBIND job to set a new access path based on the latest statistics supplied by
RUNSTATS.
The REORG utility works at two levels − index and table space.
The REORG INDEX utility reorganizes index space, which improves data accessibility and the
ability to retrieve fragmented space. The STATISTICS keyword helps define the statistics for
accessing and assembling online statistics.
The REORG TABLESPACE utility reorganizes a table space to enhance the access and retrieval of
data. The utility can work on a single partition or an array of partitions of the partitioned table space.
The utility can also delete rows if the DISCARD option is specified using REORG TABLESPACE.
• Reorganize several partitions of a partitioned table space concurrently. Using the REORG
utility on different partitions requires less time than the time taken to run a single REORG
utility for the entire partitioned table space.
• Ensure a cost−effective system performance, REORG INDEX can be run on a table space.
The first REORG statement reorganizes the table space DSN9D41A.DSN9S41D while the second
statement reorganizes the specified index. The option SHRLEVEL REFERENCE allows
simultaneous read access during both the UNLOAD and RELOAD phases of the REORG utility.
The STATISTICS keyword enables the utility to collect the online statistics of the specified index.
Reprinted for dzpkhz, EDS Web Universities/Training SkillSoft, SkillSoft Corporation (c) 2002, Copying Prohibited
DB2 ReferencePoint Suite 8
Note REORG is governed by the same principles as the LOAD utility. The first principle is
recommended for the REORG facility also.
The COPY utility produces image copies or backup datasets for DB2 objects, such as table spaces,
table space partitions, datasets of table spaces, and index space or index partitions. You can create
two types of image copies:
• Full image copy: A complete copy of all the pages of data that are stored in the table space,
partition, dataset, or index that is being copied.
• Incremental image copy: A copy of only those pages of data that have been modified since
the last full or incremental image copy was generated.
The COPY utility generates up to four image copies of the dataset. After each image copy is
created, the SYSIBM.SYSCOPY catalog table is updated with the information specifying the status
of the image copy. This information can later be used by the RECOVER utility to recover objects.
If a full image copy is made, the COPY−pending status is set to off. DB2 does not reset this status if
only a single piece of a dataset is copied. If a single partitioned table space is copied, the
COPY−pending status is reset only for the partition that is copied and not the entire table space.
• Check the table space status because a table cannot be copied if it is in a COPY−pending or
RECOVER−pending status.
• Create a full image copy of the entire table space, if a non−partitioned table space is in a
COPY−pending status. This is a better approach than making full image copies of individual
datasets to fix the problem.
You can generate copies using the COPY utility in the following situations:
• If the table space is large and the number of modifications made is less, an incremental
image copy works well.
• If 40 percent or more pages of a table space need to be modified, a full image copy can be
used.
Reprinted for dzpkhz, EDS Web Universities/Training SkillSoft, SkillSoft Corporation (c) 2002, Copying Prohibited
DB2 ReferencePoint Suite 9
• If data has to be accessed in a sequence, a full image copy works faster than an incremental
image copy by sequentially reading the pages of a table space.
The above example creates a full image copy of the table space DSN9D41A.DSN9S41D.
//DSNUPROC.SYSIN DD *
COPY TABLESPACE DSN9D41A.DSN9S41D
SHARELEVEL REFERENCE FULL NO
//*
The example above produces an incremental image copy. The use of the SHARELEVEL
REFERENCE option reduces the time required for table space recovery.
The MERGECOPY utility merges or unites several image copies to generate a new image copy.
The utility can make image copies produced by the COPY utility or inline copies produced by LOAD
or the REORG utility as input. It can accept inputs in two ways to provide different results:
• Numerous incremental image copies with a full image copy to create a new full image copy.
The MERGECOPY utility does not run on original table spaces but only on the image copy datasets
of table spaces. Listing 5−2−7 shows an example of the MERGECOPY utility:
The above MERGECOPY statements create a full and an incremental copy for the DSN9D41A
table space, respectively. The NEWCOPY option with a YES creates a full image copy. An
incremental image copy is made when NO is specified.
Reprinted for dzpkhz, EDS Web Universities/Training SkillSoft, SkillSoft Corporation (c) 2002, Copying Prohibited
DB2 ReferencePoint Suite 10
Note The utility can run parallel with the COPY, MERGECOPY, MODIFY RECOVERY,
and RECOVER utilities.
The QUIESCE utility determines a consistency point known as the quiesce point for related table
spaces and updates this information in the catalog table SYSIBM.SYSCOPY. A quiesce point refers
to the current RBA log information of a table space, datasets of a table space, or a partition of a
table space. The successful completion of this utility makes it easier to ascertain the referential
integrity between the table spaces. The RECOVER or COPY utility can utilize the recovery points
documented by the QUIESCE utility for future recoveries.
• Set up provisional points of recovery between frequently planned image copies, which will
help the RECOVER and COPY utilities.
• Ensure that referentially joined tables maintain data integrity. The tables may possibly be
combined using the rules determined by DB2 or by the application code.
• Facilitate the recovery of table spaces that are regularly modified online until the last full
image copy is made.
• Regulate the backup and recovery policy of a DBA and execute the QUIESCE utility at the
partition level.
The above QUIESCE statement establishes a quiesce point for the table space set specified in the
statement.
Note QUIESCE is compatible with the CHECK INDEX, DIAGNOSE, MERGECOPY, MODIFY,
REORG UNLOAD ONLY, REPORT, RUNSTATS, STOSPACE, and REPAIR LOCATE
utilities.
The RECOVER utility helps recover data from the current or previous positions. This is done by
using the information related to data recovery. In addition, it helps make the desired changes with
respect to the directions of DBMS and the parameters specified with the RECOVER utility
command.
The utility can recover many DB2 objects, such as a single page, a complete table space, index or
index spaces, partitions, or datasets. While recovering an object, it uses the latest full image copy of
the object and the log records along with all the modifications. If the recent image copy is not
available, the utility uses the image copies prior to the latest copy.
The RECOVER utility can be applied at two levels, table space and index. The RECOVER
TABLESPACE option recovers or restores a table space back to its current state. The utility first
examines the DB2 catalog for a full or incremental image copy of the table space. It then studies the
DB2 logs to identify the changes and apply them to the table space.
Reprinted for dzpkhz, EDS Web Universities/Training SkillSoft, SkillSoft Corporation (c) 2002, Copying Prohibited
DB2 ReferencePoint Suite 11
The RECOVER INDEX option restores or rebuilds indexes from the present data. The utility works
on the original table spaces or datasets and not on the image copies and log data. It examines the
entire table in which the index originates and recreates the index pertaining to the existing data.
The RECOVER INDEX utility needs to be executed regularly to check the validity of indexes,
especially when partial recovery has been made. Even if the DB2 catalog and DB2 Directory table
spaces and indexes are not rearranged, the RECOVER INDEX can be used to recover the indexes.
The RECOVER TABLESPACE utility statement above recovers the DSN9D41A.DSN9S41D table
space to the specified image copy dataset.
//DSNUPROC.SYSIN DD *
RECOVER INDEX (ALL) TABLESPACE DSN9D41A.DSN9S41D
RECOVER INDEX (DSN9410.XMNGR1)
//*
The first RECOVER INDEX statement rebuilds the indexes on tables in the DSN9D41A.DSN9S41D
table space and the next statement restores only the DSN9410.XMNGR1 index.
Note RECOVER TABLESPACE can run along with the DIAGNOSE, MODIFY
STATISTICS, REPORT, and STOSPACE utilities. RECOVER INDEX can execute
in parallel with the COPY SHRLEVEL REFERENCE, DIAGNOSE, MERGECOPY,
MODIFY, REPORT, RUNSTATS TABLESPACE, and STOSPACE utilities.
The REPORT RECOVERY utility is the second type of the REPORT utility. This utility generates a
report on the recovery information of a table space present in the DB2 catalog, the DB2 Directory,
and the Boot Start Dataset (BSDS). The utility can work on a table space or within a single partition
of a table space.
In addition to the recovery information, the report includes information related to the image copies,
log RBA, and archive log of the specified table spaces. The report produced can be instrumental in
establishing the availability of backups for a table space and analyzing the requirements for making
backups and recovering table spaces.
The REPORT RECOVERY utility can run concurrently with all other DB2 utility. It is best suited
when the datasets required by the RECOVER utility have to be chosen and checked for availability.
The REPORT RECOVERY statement in the above example reports all the DB2 recovery
information related to the table space DSN9D41A.DSN9S41D.
Reprinted for dzpkhz, EDS Web Universities/Training SkillSoft, SkillSoft Corporation (c) 2002, Copying Prohibited
DB2 ReferencePoint Suite 12
The CATMAINT utility updates the DB2 catalog while changing from one version or release of DB2
to another. The utility amends the organization of DB2 catalog by creating tables and indexes using
particular hashes and links in the DB2 catalog database.
While running this utility, it may succeed or fail. Changes are implemented, only after the utility runs
successfully. Changes are not implemented if the utility fails.
While executing the CATMAINT utility, the task of sorting is done by work file database. As a result,
to run the CATMAINT utility, you need to estimate the size of the work file database. The result of
the utility is usually an updated catalog. The catalog or directory indexes are not accessible to any
other task or utility during the execution of CATMAINT utility.
The MODIFY utility is used to clear the DB2 catalog and DB2 Directory tables by erasing
unnecessary and obsolete data rows. The utility can be used with two elements − MODIFY
RECOVERY and MODIFY STATISTICS.
MODIFY RECOVERY deletes rows containing information related to data recovery from both DB2
catalog and DB2 Directory. The utility either removes rows that are older than the number of days
specified, or the rows having date that is earlier than the specified date.
The MODIFY RECOVERY utility is run regularly to filter old recovery data that is no longer required.
The utility only deletes rows from the catalog tables SYSIBM.SYSCOPY and SYSIBM.SYSLGRNX.
As a result, the corresponding Log and image copy dataset are deleted separately.
In the above code, the first statement deletes all the SYSCOPY information pertaining to the
DSN9D41A.DSN9S41D table space older than 75 days. The second statement deletes all the
information where the DATE is before October 21, 1992 for the specified table space.
Note MODIFY RECOVERY can run with the COPY, LOAD, MERGECOPY, MODIFY
RECOVERY, RECOVER, and REORG utilities.
MODIFY STATISTICS deletes Non−Uniform Distribution Statistics (NUDS) from relevant catalog
tables. NUDS are accumulated in SYSCOLDIST and SYSCOLDISTATS (version 3 onwards) or
SYSFIELDS (prior to version 3) system file(s).
The utility can work on the whole table space, index space, or index of a table space. It can delete
statistics that appear before a specified date.
Reprinted for dzpkhz, EDS Web Universities/Training SkillSoft, SkillSoft Corporation (c) 2002, Copying Prohibited
DB2 ReferencePoint Suite 13
The MODIFY STATISTICS utility is of no use for DB2 version 3 and later because the system files
updated by the utility can be directly accessed using SQL. If a table space is in the
RECOVER−pending or CHECK−pending state, running the utility on the table space is not possible.
In the code above, the utility statement deletes all SYSFIELDS information from the DEPTNO
column of the DSN9410.DEPT table.
The RUNSTATS utility is used to accumulate facts or information about DB2 objects, such as
tables, table spaces, partitions, and indexes. The RUNSTATS utility places this information in DB2
catalog tables to be used by DBA or the system administrator. At times, it generates only a report
containing these particulars.
The statistics recorded are useful in providing information about the organization to the DBA and in
assisting the DB2 optimizer to select an optimum access path for SQL queries.
RUNSTATS works with two formats, RUNSTATS TABLESPACE and RUNSTATS INDEX.
RUNSTATS TABLESPACE gathers information about tables for table spaces, indexes, and
columns. The RUNSTATS INDEX collects information of indexes only.
• After modifying a particular table when many update, delete, and insertion commands are to
be issued.
Reprinted for dzpkhz, EDS Web Universities/Training SkillSoft, SkillSoft Corporation (c) 2002, Copying Prohibited
DB2 ReferencePoint Suite 14
In the above example, the first RUNSTATS statement collects statistics for all the tables in the
DSN9D41A.DSN9S41D table space. The second statement accumulates statistics related to the
specified columns of the DSN9410.EMPDET table in the table space.
//SYSIN DD *
RUNSTATS INDEX (DSN9410.XEMPDT)
/*
//
The preceding RUNSTATS INDEX statement gathers statistics for the DSN9410.XEMPDT index.
Note The RUNSTATS utility can run along with the CHECK INDEX, COPY, DIAGNOSE,
MERGECOPY, MODIFY, QUIESCE, REORG UNLOAD ONLY, REPAIR, REPORT,
RUNSTATS, and STOSPACE utilities.
The STOSPACE utility operates on a DB2 storage group or a number of groups known as
STOGROUP. The utility updates DB2 catalog with the information of the storage space allotted to
STOGROUP along with the corresponding table spaces and indexes. The data is collected from the
ICF Catalog indicated in the STOGROUP. The STOSPACE utility is executed for this STOGROUP.
The above STOSPACE statement fills the DB2 catalog with storage statistics of all the
STOGROUPs.
The STOSPACE can run parallel with all utilities of DB2. The STOGROUPS associated with table
spaces and indexes should run this utility at regular intervals. You can run the utility every month for
all existing STOGROUPs to increase the system efficiency.
Reprinted for dzpkhz, EDS Web Universities/Training SkillSoft, SkillSoft Corporation (c) 2002, Copying Prohibited
Offline Utilities
Offline utilities are also known as stand−alone utilities. The utilities in this category can run without
running the DB2 environment. These do not require DB2 to be active during execution. To start with
the process of running the utility, a utility control statement along with the parameters are set, which
identifies the basic function of the utility. Most offline utilities can scan this statement through an
input stream to identify their definitions while other utilities parse the JCL EXEC PARAM parameters
supplied with the utility to acquire their task descriptions.
• Generates a control record pertaining to the conditional restart that helps in controlling the
next initiation of DB2 subsystems.
• Log datasets that are currently available for new log data.
If the utility is working in a data sharing condition, the utility can provide information from all BSDSs
that make up the data−sharing group.
Reprinted for dzpkhz, EDS Web Universities/Training SkillSoft, SkillSoft Corporation (c) 2002, Copying Prohibited
DB2 ReferencePoint Suite 16
//SYSPRINT DDSYSOUT=*
//
The print log map utility is useful before and after the instances of the change log utility. The output
of the first utility, DSNJU004, can be utilized when recording the log changes being applied.
The DSNJLOGF utility can be utilized to avoid delays that occur because log datasets are
preformatted at the time of execution.
Reprinted for dzpkhz, EDS Web Universities/Training SkillSoft, SkillSoft Corporation (c) 2002, Copying Prohibited
Miscellaneous Utilities
Some new utilities that DB2 offers with its latest version are used interchangeably with the other
utilities that are a part of DBMS. The utilities enhance the subsystem and supervise data
management processes.
Online utilities have been introduced in version 7 of DB2 and compiled primarily for OS/390. Other
supporting aids and tools that function like offline utilities are also discussed in this section.
Online Utilities
These utilities work only when the DB2 environment is active. Some of these utilities are an
improvement on the existing utilities and function similar to the utilities of earlier versions.
EXEC SQL
The control statement of the EXEC SQL utility is used to declare a cursor or carry out dynamic SQL
statements within the DB2 family functions.
While executing a dynamic SQL statement, the string contained in the statement is parsed and
verified for errors. If the statement is invalid, stop the execution of the utility and describe the error
condition. If the statement is valid, but an error has occurred during the execution of the statement,
report the error condition and quit the utility.
For example, the following code inserts the data in the table DSN9410.EMP to a new file MYEMP:
EXEC SQL
INSERT INTO MYEMP SELECT * FROM DSN9410.EMP
ENDEXEC
The following code creates a cursor, C1, with the data from the table DSN9410.DEPT:
EXEC SQL
DECLARE C1 CURSOR FOR SELECT * FROM DSN9410.DEPT
ENDEXEC
LISTDEF
In the earlier versions of DB2, you needed to execute utilities for the proper management of the
system. In the new version of DB2, you do not need to query the catalog table to identify objects
and change the utility control statement to specify the appropriate utility to be run. The new version
allows the administrator to insert the objects into re−utilizable lists. These lists can be dynamically
appended to the utility datasets required to process them.
The LISTDEF control statement combines a number of DB2 objects to define a list and assign a
name to it. An example of the code that creates a list, LST1 is:
LISTDEF LST1 INCLUDE TABLESPACES DATABASE EMPLOYEE
INCLUDE INDEXSPACES DATABASE EMPLOYEE
The list LST1 contains all the table spaces and the index spaces of the database named
EMPLOYEE.
REBUILD INDEX
REBUILD INDEX rebuilds or recreates indexes of the table they refer. Earlier versions of DB2 use
RECOVER INDEX for this job.
Reprinted for dzpkhz, EDS Web Universities/Training SkillSoft, SkillSoft Corporation (c) 2002, Copying Prohibited
DB2 ReferencePoint Suite 18
OPTIONS
The OPTIONS utility is used to enumerate the processing options available for various utilities. This
utility can be used to:
TEMPLATE
The TEMPLATE utility is used to allocate datasets dynamically while the list defined by LISTDEF is
being processed. The utility does not use JCL DD cards like other utilities. The utility control
statement produces a dynamic allocation template, which is allotted a name to be used in the future.
UNLOAD
The UNLOAD utility is an improved version of the REORG UNLOAD EXTERNAL utility option. The
utility unloads data from one DB2 object to other sequential datasets in a format that is external to
DB2. The utility can be performed on objects like table spaces or image copy datasets. You need to
run the utility on the same computer containing the definitions of DB2 objects for which the utility is
being run.
Reprinted for dzpkhz, EDS Web Universities/Training SkillSoft, SkillSoft Corporation (c) 2002, Copying Prohibited
DB2 ReferencePoint Suite 19
This utility statement unloads rows where the DEPT column matches D1 and SALARY is greater
than 30000 from the DSN9410.EMP table of the DSN9D41A.DSN9S41E table space.
Offline Utilities
Some service tools or programs offered by DB2 run like batch utilities and are independent of the
DB2 subsystem. These programs or utilities are useful when the DB2 system is inactive.
DSN1CHKR
The DSN1CHKR utility verifies and authenticates the integrity of DB2 catalog and DB2 Directory,
the two most eminent parts of DB2. If this utility is performed at uniform intervals, problems can be
detected at an early stage.
DSN1COMP
The DSN1COMP utility, also called a compression analyzer aid, evaluates and estimates the
outcome accomplished by DB2 data compression in table spaces. The utility can work on table
space datasets, sequential datasets having a DB2 table space or partitions, and full or incremental
image copy datasets.
DSN1COPY
The DSN1COPY utility is a copy tool or a program that offers DB2 with several benefits:
• Copies datasets and verifies the authenticity of table space and index pages.
• Converts DB2 object descriptors (OBIDs) into an appropriate form when the objects are
transferred to another version of DB2 and retrieves data from objects that are dropped by
mistake.
DSN1LOGP
The DSN1LOGP utility is a recovery log extractor that generates a formatted citation of the recovery
log of a particular DB2 object. The utility can produce two types of reports:
• A summary report that specifies only the relevant information of the log records.
DSN1PRNT
The DSN1PRNT utility is used to print hexadecimal and formatted dumps of a table space, indexes,
and image copies. The utility is useful when the values contained in the table space are to be
examined and dumped according to a specified value.
DSN1SDMP
The DSN1SDMP utility is a selective dump utility. The utility is an application program of DB2
although IBM has labeled it as a service aid. The utility can trace records to a dataset indicated in
the input statement of the utility and influence the dumping of DB2 objects on instances of a
particular event. The utility has to be used under the guidance of IBM Support Centre.
Reprinted for dzpkhz, EDS Web Universities/Training SkillSoft, SkillSoft Corporation (c) 2002, Copying Prohibited
Related Topics
For related information on this topic, you can refer to:
• DB2 Programming
Reprinted for dzpkhz, EDS Web Universities/Training SkillSoft, SkillSoft Corporation (c) 2002, Copying Prohibited