1137
DB2 Version 9.1 for z/OS Utility Guide and Reference SC18-9855-05

DB2 Utility Guide and Reference.pdf

  • Upload
    lamoxx

  • View
    92

  • Download
    1

Embed Size (px)

Citation preview

  • DB2 Version 9.1 for z/OS

    Utility Guide and Reference

    SC18-9855-05

  • DB2 Version 9.1 for z/OS

    Utility Guide and Reference

    SC18-9855-05

  • NoteBefore using this information and the product it supports, be sure to read the general information under Notices at theend of this information.

    Sixth edition (December 2009)

    This edition applies to DB2 Version 9.1 for z/OS (DB2 V9.1 for z/OS), product number 5635-DB2, and to anysubsequent releases until otherwise indicated in new editions. Make sure you are using the correct edition for thelevel of the product.

    Specific changes are indicated by a vertical bar to the left of a change. A vertical bar to the left of a figure captionindicates that the figure has changed. Editorial changes that have no technical significance are not noted.

    Copyright International Business Machines Corporation 1983, 2009.US Government Users Restricted Rights Use, duplication or disclosure restricted by GSA ADP Schedule Contractwith IBM Corp.

  • ContentsAbout this information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvWho should read this information . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvDB2 Utilities Suite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvTerminology and citations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvAccessibility features for DB2 Version 9.1 for z/OS . . . . . . . . . . . . . . . . . . . . . . xviHow to send your comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviiNaming conventions used in this information . . . . . . . . . . . . . . . . . . . . . . . xviiHow to read syntax diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx

    Part 1. Introduction to the DB2 utilities. . . . . . . . . . . . . . . . . . . . . 1

    Chapter 1. Basic information about the DB2 utilities. . . . . . . . . . . . . . . . . 3Types of DB2 utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3Privileges and authorization IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3Utilities that can be run on declared temporary objects . . . . . . . . . . . . . . . . . . . . . 4Effect of utilities on objects that have the DEFINE NO attribute . . . . . . . . . . . . . . . . . . 4Effect of utilities on data that is encrypted through built-in functions . . . . . . . . . . . . . . . . 5

    Chapter 2. DB2 utilities packaging . . . . . . . . . . . . . . . . . . . . . . . . 7SMP/E jobs for DB2 utility products . . . . . . . . . . . . . . . . . . . . . . . . . . . 7The operation of DB2 utilities in a mixed-release data sharing environment . . . . . . . . . . . . . . 8

    Part 2. DB2 online utilities . . . . . . . . . . . . . . . . . . . . . . . . . . 11

    Chapter 3. Invoking DB2 online utilities. . . . . . . . . . . . . . . . . . . . . . 13Data sets that online utilities use . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13Utility control statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15Required authorizations for invoking online utilities on tables that have multilevel security with row-levelgranularity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18Invoking DB2 online utilities in a trusted connection . . . . . . . . . . . . . . . . . . . . . 18Using the DB2 Utilities panel in DB2I . . . . . . . . . . . . . . . . . . . . . . . . . . 18Invoking a DB2 utility by using the DSNU CLIST command in TSO . . . . . . . . . . . . . . . . 21

    DSNU CLIST command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22Invoking a DB2 utility by using the supplied JCL procedure (DSNUPROC) . . . . . . . . . . . . . . 28Invoking a DB2 utility by creating the JCL data set yourself . . . . . . . . . . . . . . . . . . . 30

    Chapter 4. Monitoring and controlling online utilities . . . . . . . . . . . . . . . . 33Monitoring utilities with the DISPLAY UTILITY command . . . . . . . . . . . . . . . . . . . 33Running utilities concurrently . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34Online utilities in a data sharing environment . . . . . . . . . . . . . . . . . . . . . . . . 35Termination of an online utility with the TERM UTILITY command . . . . . . . . . . . . . . . . 36Restart of an online utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

    Using the RESTART parameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39Adding or deleting utility statements . . . . . . . . . . . . . . . . . . . . . . . . . . 40Modifying utility control statements . . . . . . . . . . . . . . . . . . . . . . . . . . 40Restarting after the output data set is full . . . . . . . . . . . . . . . . . . . . . . . . 40Restarting with templates. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40How DB2 restarts with lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

    Chapter 5. BACKUP SYSTEM . . . . . . . . . . . . . . . . . . . . . . . . . . 43Syntax and options of the BACKUP SYSTEM control statement . . . . . . . . . . . . . . . . . . 44Before running BACKUP SYSTEM. . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

    Data sets that BACKUP SYSTEM uses . . . . . . . . . . . . . . . . . . . . . . . . . 47

    Copyright IBM Corp. 1983, 2009 iii

    ||

  • Concurrency and compatibility for BACKUP SYSTEM . . . . . . . . . . . . . . . . . . . . 47Dumping a fast replication copy to tape . . . . . . . . . . . . . . . . . . . . . . . . . . 47Termination or restart of BACKUP SYSTEM . . . . . . . . . . . . . . . . . . . . . . . . 48Sample BACKUP SYSTEM control statements . . . . . . . . . . . . . . . . . . . . . . . . 48

    Chapter 6. CATENFM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51Syntax and options of the control statement . . . . . . . . . . . . . . . . . . . . . . . . 51Before converting the catalog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

    Data sets that CATENFM uses when converting the catalog . . . . . . . . . . . . . . . . . . 52Concurrency and compatibility for CATENFM. . . . . . . . . . . . . . . . . . . . . . . 53

    Converting to new-function mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53Termination or halt of CATENFM . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

    Chapter 7. CATMAINT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55Syntax and options of the CATMAINT control statement . . . . . . . . . . . . . . . . . . . . 55Before running CATMAINT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

    Data sets that CATMAINT uses . . . . . . . . . . . . . . . . . . . . . . . . . . . 56Concurrency and compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

    Updating the catalog for a new release . . . . . . . . . . . . . . . . . . . . . . . . . . 57Renaming the owner, creator, and schema of database objects . . . . . . . . . . . . . . . . . . 57Changing the ownership of objects from an authorization ID to a role . . . . . . . . . . . . . . . . 57Changing the catalog name used by storage groups or index spaces and table spaces. . . . . . . . . . . 58Identifying invalidated plans and packages after the owner, creator, or schema name of an object is renamed . . 58Termination or restart of CATMAINT. . . . . . . . . . . . . . . . . . . . . . . . . . . 58

    Chapter 8. CHECK DATA . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61Syntax and options of the CHECK DATA control statement . . . . . . . . . . . . . . . . . . . 62Before running CHECK DATA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

    Data sets that CHECK DATA uses . . . . . . . . . . . . . . . . . . . . . . . . . . . 70Concurrency and compatibility for CHECK DATA . . . . . . . . . . . . . . . . . . . . . 74

    Create exception tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76Exception processing for tables with auxiliary columns . . . . . . . . . . . . . . . . . . . . . 77Specifying the scope of CHECK DATA . . . . . . . . . . . . . . . . . . . . . . . . . . 77How violations are identified . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77Detect and correct constraint violations . . . . . . . . . . . . . . . . . . . . . . . . . . 78Resetting CHECK-pending status . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78LOB column errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79Resetting auxiliary CHECK-pending status . . . . . . . . . . . . . . . . . . . . . . . . . 80Termination and restart of CHECK DATA . . . . . . . . . . . . . . . . . . . . . . . . . 80Sample CHECK DATA control statements . . . . . . . . . . . . . . . . . . . . . . . . . 81

    Chapter 9. CHECK INDEX. . . . . . . . . . . . . . . . . . . . . . . . . . . . 85Syntax and options of the CHECK INDEX control statement . . . . . . . . . . . . . . . . . . . 86Data sets that CHECK INDEX uses . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

    Defining the work data set for CHECK INDEX . . . . . . . . . . . . . . . . . . . . . . 90Shadow data sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

    Concurrency and compatibility for CHECK INDEX . . . . . . . . . . . . . . . . . . . . . . 92Single logical partitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94Indexes in parallel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95Reviewing CHECK INDEX output. . . . . . . . . . . . . . . . . . . . . . . . . . . . 98Termination or restart of CHECK INDEX . . . . . . . . . . . . . . . . . . . . . . . . . 99Correcting XML data after running CHECK INDEX . . . . . . . . . . . . . . . . . . . . . . 99Sample CHECK INDEX control statements . . . . . . . . . . . . . . . . . . . . . . . . . 99

    Chapter 10. CHECK LOB . . . . . . . . . . . . . . . . . . . . . . . . . . . 103Syntax and options of the CHECK LOB control statement . . . . . . . . . . . . . . . . . . . 104Before running CHECK LOB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107

    Data sets that CHECK LOB uses . . . . . . . . . . . . . . . . . . . . . . . . . . . 107Concurrency and compatibility for CHECK LOB . . . . . . . . . . . . . . . . . . . . . 109

    How CHECK LOB identifies violations . . . . . . . . . . . . . . . . . . . . . . . . . . 110

    iv Utility Guide and Reference

    ||||||||

    ||

  • Resetting CHECK-pending status for a LOB table space . . . . . . . . . . . . . . . . . . . . 110Resolving media failure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111Termination or restart of CHECK LOB . . . . . . . . . . . . . . . . . . . . . . . . . . 111Sample CHECK LOB control statements . . . . . . . . . . . . . . . . . . . . . . . . . 111

    Chapter 11. COPY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113Syntax and options of the COPY control statement . . . . . . . . . . . . . . . . . . . . . . 114Before running COPY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124

    Data sets that COPY uses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124Concurrency and compatibility for COPY . . . . . . . . . . . . . . . . . . . . . . . . 126

    Full image copies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129Incremental image copies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130Multiple image copies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131Copying a list of objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133Using more than one COPY statement . . . . . . . . . . . . . . . . . . . . . . . . . . 134Copying segmented table spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135Copying partitions or data sets in separate jobs . . . . . . . . . . . . . . . . . . . . . . . 135Copying partition-by-growth table spaces . . . . . . . . . . . . . . . . . . . . . . . . . 135Copying an XML table space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135Copying indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136Using DFSMSdss concurrent copy . . . . . . . . . . . . . . . . . . . . . . . . . . . 136Specifying conditional image copies . . . . . . . . . . . . . . . . . . . . . . . . . . . 138Preparing for recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139Improving performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140Copying table spaces with mixed volume IDs . . . . . . . . . . . . . . . . . . . . . . . 141Defining generation data groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141Using DB2 with DFSMS products . . . . . . . . . . . . . . . . . . . . . . . . . . . 141Image copies on tape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141Termination of COPY. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142Restart of COPY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142Sample COPY control statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

    Chapter 12. COPYTOCOPY . . . . . . . . . . . . . . . . . . . . . . . . . . 155Syntax and options of the COPYTOCOPY control statement . . . . . . . . . . . . . . . . . . . 156Data sets that COPYTOCOPY uses . . . . . . . . . . . . . . . . . . . . . . . . . . . 161Concurrency and compatibility for COPYTOCOPY . . . . . . . . . . . . . . . . . . . . . . 162Full or incremental image copies with COPYTOCOPY. . . . . . . . . . . . . . . . . . . . . 163Incremental image copies with COPYTOCOPY . . . . . . . . . . . . . . . . . . . . . . . 163Using more than one COPYTOCOPY statement . . . . . . . . . . . . . . . . . . . . . . . 164Copying an inline copy made by REORG with a range of partitions . . . . . . . . . . . . . . . . 164Copying from a specific image copy. . . . . . . . . . . . . . . . . . . . . . . . . . . 164Using TEMPLATE with COPYTOCOPY . . . . . . . . . . . . . . . . . . . . . . . . . 164Updating SYSCOPY records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164How to determine which input copy to use . . . . . . . . . . . . . . . . . . . . . . . . 165Defining generation data groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165Using DB2 with DFSMS products . . . . . . . . . . . . . . . . . . . . . . . . . . . 165Image copies on tape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166Copying a LOB table space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166Copying a list of objects from tape . . . . . . . . . . . . . . . . . . . . . . . . . . . 166Termination or restart of COPYTOCOPY . . . . . . . . . . . . . . . . . . . . . . . . . 167Sample COPYTOCOPY control statements. . . . . . . . . . . . . . . . . . . . . . . . . 167

    Chapter 13. DIAGNOSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173Syntax and options of the DIAGNOSE control statement . . . . . . . . . . . . . . . . . . . . 173Data sets that DIAGNOSE uses . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177Concurrency and compatibility for DIAGNOSE . . . . . . . . . . . . . . . . . . . . . . . 177Forcing a utility abend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177Termination or restart of DIAGNOSE . . . . . . . . . . . . . . . . . . . . . . . . . . 178Sample DIAGNOSE control statements . . . . . . . . . . . . . . . . . . . . . . . . . . 178

    Contents v

    ||||||

  • Chapter 14. EXEC SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181Syntax and options of the EXEC SQL control statement . . . . . . . . . . . . . . . . . . . . 181Concurrency and compatibility for EXEC SQL . . . . . . . . . . . . . . . . . . . . . . . 183Termination or restart of EXEC SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . 183Sample EXEC SQL control statements . . . . . . . . . . . . . . . . . . . . . . . . . . 183

    Chapter 15. LISTDEF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185Syntax and options of the LISTDEF control statement . . . . . . . . . . . . . . . . . . . . . 185Concurrency and compatibility for LISTDEF . . . . . . . . . . . . . . . . . . . . . . . . 193Creating the LISTDEF control statement . . . . . . . . . . . . . . . . . . . . . . . . . 193Including objects in a list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194Previewing the contents of a list . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197Creating LISTDEF libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197Using lists in other utility jobs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198Using the TEMPLATE utility with LISTDEF . . . . . . . . . . . . . . . . . . . . . . . . 199Using the OPTIONS utility with LISTDEF . . . . . . . . . . . . . . . . . . . . . . . . . 200Termination or restart of LISTDEF . . . . . . . . . . . . . . . . . . . . . . . . . . . 200Sample LISTDEF control statements . . . . . . . . . . . . . . . . . . . . . . . . . . . 200

    Chapter 16. LOAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205Syntax and options of the LOAD control statement. . . . . . . . . . . . . . . . . . . . . . 207Before running LOAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248

    Data sets that LOAD uses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249Concurrency and compatibility for LOAD . . . . . . . . . . . . . . . . . . . . . . . . 253

    When to use SORTKEYS NO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256Loading variable-length data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256How LOAD orders loaded records . . . . . . . . . . . . . . . . . . . . . . . . . . . 256Replacing data with LOAD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257Using LOAD for tables with identity columns, ROWID columns, or row change timestamp columns . . . . . 259Adding more data to a table or partition . . . . . . . . . . . . . . . . . . . . . . . . . 260Deleting all the data in a table space . . . . . . . . . . . . . . . . . . . . . . . . . . 260Loading partitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260Partition-by-growth table spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262Loading data containing XML columns . . . . . . . . . . . . . . . . . . . . . . . . . . 262Loading delimited files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263Loading data with referential constraints . . . . . . . . . . . . . . . . . . . . . . . . . 265Correcting referential constraint violations. . . . . . . . . . . . . . . . . . . . . . . . . 267Compressing data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267Loading data from DL/I . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269Loading data by using the cross-loader function. . . . . . . . . . . . . . . . . . . . . . . 270Using inline COPY with LOAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271Improving LOAD performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272

    Improving performance for parallel processing . . . . . . . . . . . . . . . . . . . . . . 273Improved performance with SORTKEYS . . . . . . . . . . . . . . . . . . . . . . . . 273Improving performance with LOAD or REORG PREFORMAT . . . . . . . . . . . . . . . . . 274

    Converting input data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275Specifying input fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276Specifying the TRUNCATE and STRIP options . . . . . . . . . . . . . . . . . . . . . . . 277How LOAD builds indexes while loading data . . . . . . . . . . . . . . . . . . . . . . . 277Building indexes in parallel for LOAD . . . . . . . . . . . . . . . . . . . . . . . . . . 278How LOAD leaves free space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280Loading with RECOVER-pending, REBUILD-pending, or REORG-pending status . . . . . . . . . . . 281Exit procedures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281Loading ROWID columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282Loading a LOB column . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282LOAD LOG on a LOB table space . . . . . . . . . . . . . . . . . . . . . . . . . . . 283Loading an XML column . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283LOAD LOG on an XML table space . . . . . . . . . . . . . . . . . . . . . . . . . . . 284Running LOAD RESUME YES SHRLEVEL CHANGE without logging . . . . . . . . . . . . . . . 284Collecting inline statistics while loading a table . . . . . . . . . . . . . . . . . . . . . . . 285

    vi Utility Guide and Reference

    ||

    ||||

    ||||

  • Inline COPY for a base table space . . . . . . . . . . . . . . . . . . . . . . . . . . . 285Termination of LOAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285Restart of LOAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286After running LOAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288

    Copying the loaded table space or partition . . . . . . . . . . . . . . . . . . . . . . . 288Resetting COPY-pending status . . . . . . . . . . . . . . . . . . . . . . . . . . . 288Resetting REBUILD-pending status . . . . . . . . . . . . . . . . . . . . . . . . . . 288Resetting the CHECK-pending status . . . . . . . . . . . . . . . . . . . . . . . . . 289Running CHECK INDEX after loading a table that has indexes. . . . . . . . . . . . . . . . . 291Recovering a failed LOAD job . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291Reorganization of an auxiliary index after LOAD . . . . . . . . . . . . . . . . . . . . . 292

    Effects of running LOAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292Sample LOAD control statements. . . . . . . . . . . . . . . . . . . . . . . . . . . . 293

    Chapter 17. MERGECOPY . . . . . . . . . . . . . . . . . . . . . . . . . . . 307Syntax and options of the MERGECOPY control statement . . . . . . . . . . . . . . . . . . . 308Data sets that MERGECOPY uses . . . . . . . . . . . . . . . . . . . . . . . . . . . 310Concurrency and compatibility for MERGECOPY . . . . . . . . . . . . . . . . . . . . . . 311Full or incremental image copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312How to determine which input copy MERGECOPY uses . . . . . . . . . . . . . . . . . . . . 313Merging online copies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313Using MERGECOPY with individual data sets . . . . . . . . . . . . . . . . . . . . . . . 313Using MERGECOPY or COPY. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313Avoiding MERGECOPY LOG RBA inconsistencies . . . . . . . . . . . . . . . . . . . . . . 313Creating image copies in a JES3 environment. . . . . . . . . . . . . . . . . . . . . . . . 314Terminating or restart of MERGECOPY. . . . . . . . . . . . . . . . . . . . . . . . . . 314Sample MERGECOPY control statements . . . . . . . . . . . . . . . . . . . . . . . . . 314

    Chapter 18. MODIFY RECOVERY . . . . . . . . . . . . . . . . . . . . . . . . 317Syntax and options of the MODIFY RECOVERY control statement . . . . . . . . . . . . . . . . 318Before running MODIFY RECOVERY . . . . . . . . . . . . . . . . . . . . . . . . . . 321

    Data sets that MODIFY RECOVERY uses . . . . . . . . . . . . . . . . . . . . . . . . 321Concurrency and compatibility for MODIFY RECOVERY. . . . . . . . . . . . . . . . . . . 321

    How MODIFY RECOVERY deletes rows . . . . . . . . . . . . . . . . . . . . . . . . . 322How MODIFY RECOVERY deletes SYSOBDS entries . . . . . . . . . . . . . . . . . . . . . 323Reclaiming space in the DBD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323Improving REORG performance after adding a column . . . . . . . . . . . . . . . . . . . . 324Termination or restart of MODIFY RECOVERY . . . . . . . . . . . . . . . . . . . . . . . 324The effect of MODIFY RECOVERY on version numbers . . . . . . . . . . . . . . . . . . . . 324Sample MODIFY RECOVERY control statements . . . . . . . . . . . . . . . . . . . . . . 325

    Chapter 19. MODIFY STATISTICS . . . . . . . . . . . . . . . . . . . . . . . . 327Syntax and options of the MODIFY STATISTICS control statement . . . . . . . . . . . . . . . . 328Data sets that MODIFY STATISTICS uses . . . . . . . . . . . . . . . . . . . . . . . . . 330Concurrency and compatibility for MODIFY STATISTICS. . . . . . . . . . . . . . . . . . . . 330Deciding which statistics history rows to delete . . . . . . . . . . . . . . . . . . . . . . . 331Deleting specific statistics history rows . . . . . . . . . . . . . . . . . . . . . . . . . . 331Termination or restart of MODIFY STATISTICS . . . . . . . . . . . . . . . . . . . . . . . 331Sample MODIFY STATISTICS control statements . . . . . . . . . . . . . . . . . . . . . . 332

    Chapter 20. OPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335Syntax and options of the OPTIONS control statement . . . . . . . . . . . . . . . . . . . . 335Concurrency and compatibility for OPTIONS. . . . . . . . . . . . . . . . . . . . . . . . 338Executing statements in preview mode . . . . . . . . . . . . . . . . . . . . . . . . . . 339Specifying LISTDEF and TEMPLATE libraries . . . . . . . . . . . . . . . . . . . . . . . 339Overriding standard utility processing behavior . . . . . . . . . . . . . . . . . . . . . . . 339Termination or restart of OPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . 339Sample OPTIONS control statements . . . . . . . . . . . . . . . . . . . . . . . . . . 339

    Chapter 21. QUIESCE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343Contents vii

  • Syntax and options of the QUIESCE control statement. . . . . . . . . . . . . . . . . . . . . 344Before running QUIESCE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345

    Data sets that QUIESCE uses . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346Concurrency and compatibility for QUIESCE . . . . . . . . . . . . . . . . . . . . . . . 346

    Using QUIESCE on catalog and directory objects . . . . . . . . . . . . . . . . . . . . . . 348Common quiesce points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348Specifying a list of table spaces and table space sets . . . . . . . . . . . . . . . . . . . . . 348Running QUIESCE on a table space in pending status . . . . . . . . . . . . . . . . . . . . . 349Determining why the write to disk fails . . . . . . . . . . . . . . . . . . . . . . . . . 349Termination and restart of QUIESCE . . . . . . . . . . . . . . . . . . . . . . . . . . 350Sample QUIESCE control statements . . . . . . . . . . . . . . . . . . . . . . . . . . 350

    Chapter 22. REBUILD INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . 353Syntax and options of the REBUILD INDEX control statement . . . . . . . . . . . . . . . . . . 353Before running REBUILD INDEX. . . . . . . . . . . . . . . . . . . . . . . . . . . . 361

    Data sets that REBUILD INDEX uses . . . . . . . . . . . . . . . . . . . . . . . . . 362Concurrency and compatibility for REBUILD INDEX . . . . . . . . . . . . . . . . . . . . 364

    Access with REBUILD INDEX SHRLEVEL . . . . . . . . . . . . . . . . . . . . . . . . 366Rebuilding index partitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366Rebuilding indexes on partition-by-growth table spaces . . . . . . . . . . . . . . . . . . . . 367Improving performance when rebuilding index partitions . . . . . . . . . . . . . . . . . . . 367Rebuilding multiple indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368Resetting the REBUILD-pending status . . . . . . . . . . . . . . . . . . . . . . . . . . 372Rebuilding critical catalog indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . 373Recoverability of a rebuilt index . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373Termination or restart of REBUILD INDEX . . . . . . . . . . . . . . . . . . . . . . . . 373The effect of REBUILD INDEX on index version numbers . . . . . . . . . . . . . . . . . . . 373Sample REBUILD INDEX control statements . . . . . . . . . . . . . . . . . . . . . . . . 374

    Chapter 23. RECOVER . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377Syntax and options of the RECOVER control statement . . . . . . . . . . . . . . . . . . . . 379Before running RECOVER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387

    Data sets that RECOVER uses . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387Concurrency and compatibility for RECOVER . . . . . . . . . . . . . . . . . . . . . . 388

    Using a system-level backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390How to determine which system-level backups DB2 recovers . . . . . . . . . . . . . . . . . . 390Determining the recovery base . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391Determining whether the system-level backups reside on disk or tape . . . . . . . . . . . . . . . 391Recovering a table space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391Recovering a list of objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392Recovering a data set or partition . . . . . . . . . . . . . . . . . . . . . . . . . . . 393Recovering with incremental copies . . . . . . . . . . . . . . . . . . . . . . . . . . . 393Recovering a page. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394Recovering an error range . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394Effect on RECOVER of the NOT LOGGED or LOGGED table space attributes . . . . . . . . . . . . . 395Recovering with a data set copy that is not made by DB2 . . . . . . . . . . . . . . . . . . . 395Recovering catalog and directory objects . . . . . . . . . . . . . . . . . . . . . . . . . 396Reinitializing DSNDB01.SYSUTILX . . . . . . . . . . . . . . . . . . . . . . . . . . . 401Recovering a table space that contains LOB or XML data . . . . . . . . . . . . . . . . . . . . 401Recovering a table space that contains clone objects . . . . . . . . . . . . . . . . . . . . . 402Point-in-time recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403Avoiding specific image copy data sets . . . . . . . . . . . . . . . . . . . . . . . . . . 408Improving RECOVER performance . . . . . . . . . . . . . . . . . . . . . . . . . . . 409Optimizing the LOGAPPLY phase . . . . . . . . . . . . . . . . . . . . . . . . . . . 409Recovering image copies in a JES3 environment . . . . . . . . . . . . . . . . . . . . . . . 411Resetting RECOVER-pending or REBUILD pending status . . . . . . . . . . . . . . . . . . . 411How the RECOVER utility allocates incremental image copies . . . . . . . . . . . . . . . . . . 412How the RECOVER utility performs fallback recovery. . . . . . . . . . . . . . . . . . . . . 412How the RECOVER utility retains tape mounts . . . . . . . . . . . . . . . . . . . . . . . 413Avoiding damaged media . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413

    viii Utility Guide and Reference

    ||

    ||||||

    ||

    ||||

  • Termination or restart of RECOVER . . . . . . . . . . . . . . . . . . . . . . . . . . . 413Effects of running RECOVER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414Sample RECOVER control statements . . . . . . . . . . . . . . . . . . . . . . . . . . 414

    Chapter 24. REORG INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . 419Syntax and options of the REORG INDEX control statement . . . . . . . . . . . . . . . . . . 420Before running REORG INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432

    Data sets that REORG INDEX uses . . . . . . . . . . . . . . . . . . . . . . . . . . 433Concurrency and compatibility for REORG INDEX. . . . . . . . . . . . . . . . . . . . . 437

    Determining when an index requires reorganization . . . . . . . . . . . . . . . . . . . . . 439Using the LEAFDISTLIMIT and REPORTONLY options to determine when reorganization is needed . . . . . 439Access with REORG INDEX SHRLEVEL . . . . . . . . . . . . . . . . . . . . . . . . . 440Temporarily interrupting REORG. . . . . . . . . . . . . . . . . . . . . . . . . . . . 441Improving performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442Termination of REORG INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442Restart of REORG INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443Review of REORG INDEX output . . . . . . . . . . . . . . . . . . . . . . . . . . . 444Effect of REORG INDEX on index version numbers . . . . . . . . . . . . . . . . . . . . . 445Sample REORG INDEX control statements . . . . . . . . . . . . . . . . . . . . . . . . 445

    Chapter 25. REORG TABLESPACE . . . . . . . . . . . . . . . . . . . . . . . 449Syntax and options of the REORG TABLESPACE control statement . . . . . . . . . . . . . . . . 452Before running REORG TABLESPACE . . . . . . . . . . . . . . . . . . . . . . . . . . 481

    Data sets that REORG TABLESPACE uses . . . . . . . . . . . . . . . . . . . . . . . . 486Concurrency and compatibility for REORG TABLESPACE . . . . . . . . . . . . . . . . . . 493

    Determining when an object requires reorganization . . . . . . . . . . . . . . . . . . . . . 498Access with REORG TABLESPACE SHRLEVEL . . . . . . . . . . . . . . . . . . . . . . . 499Omitting the output data set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501Unloading without reloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 502Reclaiming space from dropped tables . . . . . . . . . . . . . . . . . . . . . . . . . . 502Reorganizing the catalog and directory . . . . . . . . . . . . . . . . . . . . . . . . . . 502Changing data set definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504Temporarily interrupting REORG. . . . . . . . . . . . . . . . . . . . . . . . . . . . 504Building a compression dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . 505Overriding dynamic DFSORT and SORTDATA allocation. . . . . . . . . . . . . . . . . . . . 505Rebalancing partitions by using REORG . . . . . . . . . . . . . . . . . . . . . . . . . 505How to unload and reload partitions in parallel . . . . . . . . . . . . . . . . . . . . . . . 507Using inline copy with REORG TABLESPACE . . . . . . . . . . . . . . . . . . . . . . . 507Improving REORG TABLESPACE performance . . . . . . . . . . . . . . . . . . . . . . . 508Parallel index building for REORG TABLESPACE . . . . . . . . . . . . . . . . . . . . . . 509Methods of unloading data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512Encountering an error in the RELOAD phase. . . . . . . . . . . . . . . . . . . . . . . . 513Reorganization of partitioned table spaces . . . . . . . . . . . . . . . . . . . . . . . . . 513Reorganization of partition-by-growth table spaces . . . . . . . . . . . . . . . . . . . . . . 513Reorganization of segmented table spaces . . . . . . . . . . . . . . . . . . . . . . . . . 514Counting records loaded during RELOAD phase . . . . . . . . . . . . . . . . . . . . . . 514Reorganization of a LOB table space. . . . . . . . . . . . . . . . . . . . . . . . . . . 514Termination of REORG TABLESPACE . . . . . . . . . . . . . . . . . . . . . . . . . . 515Restart of REORG TABLESPACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517Review of REORG TABLESPACE output . . . . . . . . . . . . . . . . . . . . . . . . . 519After running REORG TABLESPACE . . . . . . . . . . . . . . . . . . . . . . . . . . 519Effects of running REORG TABLESPACE . . . . . . . . . . . . . . . . . . . . . . . . . 520Sample REORG TABLESPACE control statements . . . . . . . . . . . . . . . . . . . . . . 521

    Chapter 26. REPAIR. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535Syntax and options of the REPAIR control statement . . . . . . . . . . . . . . . . . . . . . 536Before running REPAIR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550

    Data sets that REPAIR uses. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551Concurrency and compatibility for REPAIR . . . . . . . . . . . . . . . . . . . . . . . 551

    Resetting table space status. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554

    Contents ix

    ||

  • Resetting index space status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555Repairing a damaged page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555Using the DBD statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555Locating rows by key. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556Using VERIFY with REPLACE and DELETE operations . . . . . . . . . . . . . . . . . . . . 557Repairing critical catalog table spaces and indexes . . . . . . . . . . . . . . . . . . . . . . 557Updating version information when moving objects to another subsystem . . . . . . . . . . . . . . 557Termination or restart of REPAIR . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558Review of REPAIR output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558After running REPAIR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559Sample REPAIR control statements . . . . . . . . . . . . . . . . . . . . . . . . . . . 559

    Chapter 27. REPORT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 563Syntax and options of the REPORT control statement . . . . . . . . . . . . . . . . . . . . . 564Data sets that REPORT uses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568Concurrency and compatibility for REPORT . . . . . . . . . . . . . . . . . . . . . . . . 568How REPORT recovers information . . . . . . . . . . . . . . . . . . . . . . . . . . . 568Running REPORT on the catalog and directory . . . . . . . . . . . . . . . . . . . . . . . 570Terminating or restarting REPORT . . . . . . . . . . . . . . . . . . . . . . . . . . . 570Review of REPORT output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571Sample REPORT control statements . . . . . . . . . . . . . . . . . . . . . . . . . . . 577

    Chapter 28. RESTORE SYSTEM . . . . . . . . . . . . . . . . . . . . . . . . 585Syntax and options of the RESTORE SYSTEM control statement . . . . . . . . . . . . . . . . . 586Before running RESTORE SYSTEM . . . . . . . . . . . . . . . . . . . . . . . . . . . 587

    Data sets that RESTORE SYSTEM uses . . . . . . . . . . . . . . . . . . . . . . . . . 588Concurrency and compatibility for RESTORE SYSTEM . . . . . . . . . . . . . . . . . . . 589

    Restoring data in a data sharing environment . . . . . . . . . . . . . . . . . . . . . . . 589Using DISPLAY UTILITY with RESTORE SYSTEM . . . . . . . . . . . . . . . . . . . . . . 589Termination and restart of RESTORE SYSTEM . . . . . . . . . . . . . . . . . . . . . . . 589Effects of running RESTORE SYSTEM . . . . . . . . . . . . . . . . . . . . . . . . . . 590After running RESTORE SYSTEM . . . . . . . . . . . . . . . . . . . . . . . . . . . 590Sample RESTORE SYSTEM control statements . . . . . . . . . . . . . . . . . . . . . . . 590

    Chapter 29. RUNSTATS . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593Syntax and options of the RUNSTATS control statement . . . . . . . . . . . . . . . . . . . . 594Before running RUNSTATS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608

    Data sets that RUNSTATS uses . . . . . . . . . . . . . . . . . . . . . . . . . . . 608Concurrency and compatibility for RUNSTATS . . . . . . . . . . . . . . . . . . . . . . 610

    When to use RUNSTATS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612Assessing table space status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612Collecting distribution statistics for column groups . . . . . . . . . . . . . . . . . . . . . . 613Updating statistics for a partitioned table space . . . . . . . . . . . . . . . . . . . . . . . 613Running RUNSTATS on the DB2 catalog . . . . . . . . . . . . . . . . . . . . . . . . . 613Improving RUNSTATS performance . . . . . . . . . . . . . . . . . . . . . . . . . . . 613Collecting frequency statistics for data-partitioned secondary indexes . . . . . . . . . . . . . . . 614Invalidating statements in the dynamic statement cache . . . . . . . . . . . . . . . . . . . . 615Collecting statistics history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615Collecting statistics on LOB table spaces . . . . . . . . . . . . . . . . . . . . . . . . . 615Termination or restart of RUNSTATS . . . . . . . . . . . . . . . . . . . . . . . . . . 615Review of RUNSTATS output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615

    Access path statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 620Space statistics (columns for tuning information) . . . . . . . . . . . . . . . . . . . . . 623

    After running RUNSTATS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629Sample RUNSTATS control statements . . . . . . . . . . . . . . . . . . . . . . . . . . 629

    Chapter 30. STOSPACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635Syntax and options of the STOSPACE control statement . . . . . . . . . . . . . . . . . . . . 636Data sets that STOSPACE uses . . . . . . . . . . . . . . . . . . . . . . . . . . . . 636Concurrency and compatibility for STOSPACE . . . . . . . . . . . . . . . . . . . . . . . 637

    x Utility Guide and Reference

    ||

  • How STOSPACE ensures availability of objects it STOSPACE requires . . . . . . . . . . . . . . . 637Obtaining statistical information with STOSPACE . . . . . . . . . . . . . . . . . . . . . . 637Analysis of the values in a SPACE or SPACEF column . . . . . . . . . . . . . . . . . . . . 638Terminate or restart of STOSPACE . . . . . . . . . . . . . . . . . . . . . . . . . . . 638Sample STOSPACE control statement . . . . . . . . . . . . . . . . . . . . . . . . . . 639

    Chapter 31. TEMPLATE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641Syntax and options of the TEMPLATE control statement . . . . . . . . . . . . . . . . . . . . 641Before running TEMPLATE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 654

    Concurrency and compatibility for TEMPLATE . . . . . . . . . . . . . . . . . . . . . . 654Key TEMPLATE operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 654Creating data set names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 655Controlling data set size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656Default space calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656Working with TAPE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657Working with GDGs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657Template switching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657Termination or restart of TEMPLATE . . . . . . . . . . . . . . . . . . . . . . . . . . 658Sample TEMPLATE control statements . . . . . . . . . . . . . . . . . . . . . . . . . . 658

    Chapter 32. UNLOAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 663Syntax and options of the UNLOAD control statement . . . . . . . . . . . . . . . . . . . . 664Before running UNLOAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699

    Data sets that UNLOAD uses . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699Concurrency and compatibility for UNLOAD . . . . . . . . . . . . . . . . . . . . . . 700

    Unloading partitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702Unloading XML data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702Selecting tables and rows to unload . . . . . . . . . . . . . . . . . . . . . . . . . . . 703Selecting and ordering columns to unload . . . . . . . . . . . . . . . . . . . . . . . . . 703Unloading data from image copy data sets . . . . . . . . . . . . . . . . . . . . . . . . 703Converting data with the UNLOAD utility . . . . . . . . . . . . . . . . . . . . . . . . 705Output field types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705Output field positioning and size. . . . . . . . . . . . . . . . . . . . . . . . . . . . 707Layout of output fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 708Unloading delimited files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710Specifying TRUNCATE and STRIP options for output data . . . . . . . . . . . . . . . . . . . 713Generating LOAD statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713Unloading compressed data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714Field specification errors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714Termination or restart of UNLOAD . . . . . . . . . . . . . . . . . . . . . . . . . . . 714Sample UNLOAD control statements . . . . . . . . . . . . . . . . . . . . . . . . . . 715

    Part 3. DB2 stand-alone utilities . . . . . . . . . . . . . . . . . . . . . . . 721

    Chapter 33. Invoking stand-alone utilities . . . . . . . . . . . . . . . . . . . . 723Creating utility control statements . . . . . . . . . . . . . . . . . . . . . . . . . . . 723Specifying options by using the JCL EXEC PARM parameter . . . . . . . . . . . . . . . . . . 723Effects of invoking stand-alone utilities on tables that have multilevel security with row-level granularity . . . 724

    Chapter 34. DSNJCNVB . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725

    Chapter 35. DSNJLOGF (preformat active log) . . . . . . . . . . . . . . . . . . 727Chapter 36. DSNJU003 (change log inventory) . . . . . . . . . . . . . . . . . . 729Syntax and options of the DSNJU003 control statement . . . . . . . . . . . . . . . . . . . . 730Making changes for active logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 743Making changes for archive logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 745Creating a conditional restart control record . . . . . . . . . . . . . . . . . . . . . . . . 745Deleting log data sets with errors. . . . . . . . . . . . . . . . . . . . . . . . . . . . 746

    Contents xi

    ||

    ||

  • Altering references to NEWLOG and DELETE data sets . . . . . . . . . . . . . . . . . . . . 747Defining the high-level qualifier for catalog and directory objects . . . . . . . . . . . . . . . . . 747Renaming DB2 system data sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . 748Renaming DB2 active log data sets . . . . . . . . . . . . . . . . . . . . . . . . . . . 748Renaming DB2 archive log data sets . . . . . . . . . . . . . . . . . . . . . . . . . . . 748Sample DSNJU003 control statements . . . . . . . . . . . . . . . . . . . . . . . . . . 748

    Chapter 37. DSNJU004 (print log map) . . . . . . . . . . . . . . . . . . . . . 751Syntax and options of the DSNJU004 control statement . . . . . . . . . . . . . . . . . . . . 752Sample DSNJU004 control statement . . . . . . . . . . . . . . . . . . . . . . . . . . 753DSNJU004 (print log map) output . . . . . . . . . . . . . . . . . . . . . . . . . . . 753

    Chapter 38. DSN1CHKR . . . . . . . . . . . . . . . . . . . . . . . . . . . . 763Syntax and options of the DSN1CHKR control statement . . . . . . . . . . . . . . . . . . . . 764Sample DSN1CHKR control statements. . . . . . . . . . . . . . . . . . . . . . . . . . 766

    Chapter 39. DSN1COMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . 771Syntax and options of the DSN1COMP control statement. . . . . . . . . . . . . . . . . . . . 772Before running DSN1COMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 775Estimating compression savings achieved with option REORG . . . . . . . . . . . . . . . . . . 776Free space in compression calculations on table space . . . . . . . . . . . . . . . . . . . . . 776The effect of running DSN1COMP on a table space with identical rows . . . . . . . . . . . . . . . 777Sample DSN1COMP control statements . . . . . . . . . . . . . . . . . . . . . . . . . 777DSN1COMP output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 779

    Chapter 40. DSN1COPY . . . . . . . . . . . . . . . . . . . . . . . . . . . . 781Syntax and options of the DSN1COPY control statement . . . . . . . . . . . . . . . . . . . . 783Before running DSN1COPY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 788

    Data sets that DSN1COPY uses . . . . . . . . . . . . . . . . . . . . . . . . . . . 789The effect of altering a table before running DSN1COPY . . . . . . . . . . . . . . . . . . . . 794Checking for inconsistent data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 794The effects of not specifying the OBIDXLAT option. . . . . . . . . . . . . . . . . . . . . . 794Requirements for using an image copy as input to DSN1COPY. . . . . . . . . . . . . . . . . . 795Resetting page log RBAs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 795Copying from an image copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 795Restoring indexes with DSN1COPY . . . . . . . . . . . . . . . . . . . . . . . . . . . 796Restoring table spaces with DSN1COPY . . . . . . . . . . . . . . . . . . . . . . . . . 796Printing with DSN1COPY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 797Copying tables from one subsystem to another . . . . . . . . . . . . . . . . . . . . . . . 797Sample DSN1COPY control statements . . . . . . . . . . . . . . . . . . . . . . . . . . 798

    Chapter 41. DSN1LOGP . . . . . . . . . . . . . . . . . . . . . . . . . . . . 803Syntax and options of the DSN1LOGP control statement . . . . . . . . . . . . . . . . . . . . 805Determining the PSID for base and clone objects . . . . . . . . . . . . . . . . . . . . . . 811Reading archive log data sets on tape . . . . . . . . . . . . . . . . . . . . . . . . . . 812Locating table and index identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . 813Sample DSN1LOGP control statements . . . . . . . . . . . . . . . . . . . . . . . . . . 813DSN1LOGP output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 816

    Chapter 42. DSN1PRNT . . . . . . . . . . . . . . . . . . . . . . . . . . . . 823Syntax and options of the DSN1PRNT control statement . . . . . . . . . . . . . . . . . . . . 824Printing with DSN1PRNT instead of DSN1COPY . . . . . . . . . . . . . . . . . . . . . . 830Determining page size and DSSIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . 830Sample DSN1PRNT control statements . . . . . . . . . . . . . . . . . . . . . . . . . . 831

    Chapter 43. DSN1SDMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . 833Syntax and options of the DSN1SDMP control statement . . . . . . . . . . . . . . . . . . . . 834Assigning buffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 839Conditions for generating a dump . . . . . . . . . . . . . . . . . . . . . . . . . . . 840

    xii Utility Guide and Reference

    ||

  • Stopping or modifying DSN1SDMP traces . . . . . . . . . . . . . . . . . . . . . . . . . 840Sample DSN1SDMP control statements . . . . . . . . . . . . . . . . . . . . . . . . . . 841

    Part 4. Appendixes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 845

    Appendix A. Limits in DB2 for z/OS . . . . . . . . . . . . . . . . . . . . . . . 847

    Appendix B. DB2-supplied stored procedures . . . . . . . . . . . . . . . . . . 853DSNUTILS stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 860DSNUTILU stored procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 871DSNACCOR stored procedure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 874DSNACCOX stored procedure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 895

    Appendix C. Advisory or restrictive states . . . . . . . . . . . . . . . . . . . . 925Auxiliary CHECK-pending status . . . . . . . . . . . . . . . . . . . . . . . . . . . 925Auxiliary warning status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 926CHECK-pending status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 927COPY-pending status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 927DBET error status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 928Group buffer pool RECOVER-pending status . . . . . . . . . . . . . . . . . . . . . . . . 928Informational COPY-pending status . . . . . . . . . . . . . . . . . . . . . . . . . . . 929REBUILD-pending status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 929RECOVER-pending status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 930REFRESH-pending status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 931REORG-pending status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 931Restart-pending status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 932

    Appendix D. Productivity-aid sample programs . . . . . . . . . . . . . . . . . . 933DSNTIAUL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 934DSNTIAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 940DSNTEP2 and DSNTEP4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 941

    Appendix E. How real-time statistics are used by DB2 utilities . . . . . . . . . . . 947

    Appendix F. Real-time statistics . . . . . . . . . . . . . . . . . . . . . . . . 949Setting up your system for real-time statistics . . . . . . . . . . . . . . . . . . . . . . . 949

    Setting the interval for writing real-time statistics . . . . . . . . . . . . . . . . . . . . . 949Establishing base values for real-time statistics . . . . . . . . . . . . . . . . . . . . . . 949

    Contents of the real-time statistics tables . . . . . . . . . . . . . . . . . . . . . . . . . 949Operating with real-time statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . 949

    DSNACCOX stored procedure. . . . . . . . . . . . . . . . . . . . . . . . . . . . 950DSNACCOR stored procedure. . . . . . . . . . . . . . . . . . . . . . . . . . . . 978When DB2 externalizes real-time statistics . . . . . . . . . . . . . . . . . . . . . . . . 999How DB2 utilities affect the real-time statistics . . . . . . . . . . . . . . . . . . . . . . 999How non-DB2 utilities affect real-time statistics. . . . . . . . . . . . . . . . . . . . . . 1007Real-time statistics on objects in work file databases and the TEMP database . . . . . . . . . . . . 1007Real-time statistics for DEFINE NO objects . . . . . . . . . . . . . . . . . . . . . . . 1007Real-time statistics on read-only or nonmodified objects . . . . . . . . . . . . . . . . . . . 1007How dropping objects affects real-time statistics . . . . . . . . . . . . . . . . . . . . . 1007How SQL operations affect real-time statistics counters . . . . . . . . . . . . . . . . . . . 1007Real-time statistics in data sharing . . . . . . . . . . . . . . . . . . . . . . . . . . 1009How the EXCHANGE command affects real-time statistics . . . . . . . . . . . . . . . . . . 1009Improving concurrency with real-time statistics . . . . . . . . . . . . . . . . . . . . . 1010Recovering the real-time statistics tables . . . . . . . . . . . . . . . . . . . . . . . . 1010Statistics accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1010

    Appendix G. Delimited file format . . . . . . . . . . . . . . . . . . . . . . . 1011Delimited data types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1012Examples of delimited files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1013

    Contents xiii

    ||

    ||

    ||

  • Information resources for DB2 for z/OS and related products . . . . . . . . . . . 1015

    How to obtain DB2 information . . . . . . . . . . . . . . . . . . . . . . . . 1021

    How to use the DB2 library . . . . . . . . . . . . . . . . . . . . . . . . . . 1025

    Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1029Programming Interface Information . . . . . . . . . . . . . . . . . . . . . . . . . . 1030

    General-use Programming Interface and Associated Guidance Information . . . . . . . . . . . . 1031Product-sensitive Programming Interface and Associated Guidance Information. . . . . . . . . . . 1031

    Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1031

    Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1033

    Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1077

    xiv Utility Guide and Reference

  • About this informationThis information contains usage information for the tasks of system administration,database administration, and operation. It presents detailed information aboutusing utilities, specifying syntax (including keyword and parameter descriptions),and starting, stopping, and restarting utilities. This book also includes job controllanguage (JCL) and control statements for each utility.

    This information assumes that your DB2 subsystem is running in Version 9.1new-function mode. Generally, new functions that are described, including changesto existing functions, statements, and limits, are available only in new-functionmode. Two exceptions to this general statement are new and changed utilities andoptimization enhancements, which are also available in conversion mode unlessstated otherwise.

    Who should read this informationThis information is intended for system administrators, database administrators,system operators, and application programmers of DB2 online and stand-aloneutilities.

    Recommendation: Familiarize yourself with DB2 for z/OS prior to using thisbook.

    DB2 Utilities SuiteImportant: In this version of DB2 for z/OS, the DB2 Utilities Suite is available asan optional product. You must separately order and purchase a license to suchutilities, and discussion of those utility functions in this publication is not intendedto otherwise imply that you have a license to them.

    The DB2 Utilities Suite is designed to work with the DFSORT program, which youare licensed to use in support of the DB2 utilities even if you do not otherwiselicense DFSORT for general use. If your primary sort product is not DFSORT,consider the following informational APARs mandatory reading:v II14047/II14213: USE OF DFSORT BY DB2 UTILITIESv II13495: HOW DFSORT TAKES ADVANTAGE OF 64-BIT REALARCHITECTURE

    These informational APARs are periodically updated.Related information

    DB2 utilities packaging (Utility Guide)

    Terminology and citationsIn this information, DB2 Version 9.1 for z/OS is referred to as DB2 for z/OS. Incases where the context makes the meaning clear, DB2 for z/OS is referred to asDB2. When this information refers to titles of DB2 for z/OS books, a short title isused. (For example, See DB2 SQL Reference is a citation to IBM DB2 Version 9.1for z/OS SQL Reference.)

    Copyright IBM Corp. 1983, 2009 xv

  • When referring to a DB2 product other than DB2 for z/OS, this information usesthe products full name to avoid ambiguity.

    The following terms are used as indicated:

    DB2 Represents either the DB2 licensed program or a particular DB2 subsystem.

    OMEGAMON

    Refers to any of the following products:v IBM Tivoli OMEGAMON XE for DB2 Performance Expert on z/OSv IBM Tivoli OMEGAMON XE for DB2 Performance Monitor on z/OSv IBM DB2 Performance Expert for Multiplatforms and Workgroupsv IBM DB2 Buffer Pool Analyzer for z/OS

    C, C++, and C languageRepresent the C or C++ programming language.

    CICS Represents CICS Transaction Server for z/OS.

    IMS Represents the IMS Database Manager or IMS Transaction Manager.

    MVS Represents the MVS element of the z/OS operating system, which isequivalent to the Base Control Program (BCP) component of the z/OSoperating system.

    RACF

    Represents the functions that are provided by the RACF component of thez/OS Security Server.

    Accessibility features for DB2 Version 9.1 for z/OSAccessibility features help a user who has a physical disability, such as restrictedmobility or limited vision, to use information technology products successfully.

    Accessibility features

    The following list includes the major accessibility features in z/OS products,including DB2 Version 9.1 for z/OS. These features support:v Keyboard-only operation.v Interfaces that are commonly used by screen readers and screen magnifiers.v Customization of display attributes such as color, contrast, and font size

    Tip: The Information Management Software for z/OS Solutions InformationCenter (which includes information for DB2 Version 9.1 for z/OS) and its relatedpublications are accessibility-enabled for the IBM Home Page Reader. You canoperate all features using the keyboard instead of the mouse.

    Keyboard navigation

    You can access DB2 Version 9.1 for z/OS ISPF panel functions by using a keyboardor keyboard shortcut keys.

    For information about navigating the DB2 Version 9.1 for z/OS ISPF panels usingTSO/E or ISPF, refer to the z/OS TSO/E Primer, the z/OS TSO/E Users Guide, andthe z/OS ISPF Users Guide. These guides describe how to navigate each interface,including the use of keyboard shortcuts or function keys (PF keys). Each guideincludes the default settings for the PF keys and explains how to modify theirfunctions.

    xvi Utility Guide and Reference

    |

  • Related accessibility information

    Online documentation for DB2 Version 9.1 for z/OS is available in the InformationManagement Software for z/OS Solutions Information Center, which is available atthe following Web site: http://publib.boulder.ibm.com/infocenter/dzichelp

    IBM and accessibility

    See the IBM Accessibility Center at http://www.ibm.com/able for more informationabout the commitment that IBM has to accessibility.

    How to send your commentsYour feedback helps IBM to provide quality information. Please send anycomments that you have about this book or other DB2 for z/OS documentation.You can use the following methods to provide comments:v Send your comments by e-mail to [email protected] and include the nameof the product, the version number of the product, and the number of the book.If you are commenting on specific text, please list the location of the text (forexample, a chapter and section title or a help topic title).

    v You can send comments from the Web. Visit the DB2 for z/OS - TechnicalResources Web site at:

    http://www.ibm.com/support/docview.wss?&uid=swg27011656

    This Web site has an online reader comment form that you can use to sendcomments.

    v You can also send comments by using the feedback link at the footer of eachpage in the Information Management Software for z/OS Solutions InformationCenter at http://publib.boulder.ibm.com/infocenter/db2zhelp.

    Naming conventions used in this informationThis topic describes naming conventions that are unique to commands andutilities.

    When you use a parameter for an object that is created by SQL statements (forexample, tables, table spaces, and indexes), identify the object by following theSQL syntactical naming conventions. See the description for naming conventions inDB2 SQL Reference.

    In this book, characters are classified as letters, digits, or special characters.v A letter is any one of the uppercase characters A through Z (including the threecharacters that are reserved in the United States as alphabetic extenders fornational languages, #, @, and $.).

    v A digit is any one of the characters 0 through 9.v A special character is any character other than a letter or a digit.

    See DB2 SQL Reference for an additional explanation of long identifiers, shortidentifiers, and location identifiers.

    authorization-idA short identifier of one to eight letters, digits, or the underscore that identifiesa set of privileges. An authorization ID must begin with a letter.

    About this information xvii

  • connection-nameAn identifier of one to eight characters that identifies an address spaceconnection to DB2. A connection identifier is one of the following values:v TSO (for DSN processes that run in TSO foreground).v BATCH (for DSN processes that run in TSO batch).v DB2CALL (for the call attachment facility (CAF)).v The system identification name (for IMS and CICS processes).See DB2 Administration Guide for more information about managing DB2connections.

    correlation-idAn identifier of 1 to 12 characters that identifies a process within an addressspace connection. A correlation ID must begin with a letter.

    A correlation ID can be one of the following values:v The TSO logon identifier (for DSN processes that run in TSO foregroundand for CAF processes).

    v The job name (for DSN processes that run in TSO batch).v The PST#.PSBNAME (for IMS processes).v The entry identifier.thread_number.transaction_identifier (for CICSprocesses).

    See DB2 Administration Guide for more information about correlation IDs.

    cursor-nameAn identifier that designates a result set. Cursor names that are specified withthe EXEC SQL and LOAD utilities cannot be longer than eight characters.

    database-nameA short identifier that identifies a database. The identifier must start with aletter and must not include special characters.

    data-set-nameAn identifier of 1 to 44 characters that identifies a data set.

    dbrm-member-nameAn identifier of one to eight letters or digits that identifies a member of apartitioned data set.

    A DBRM member name should not begin with DSN because of a potentialconflict with DB2-provided DBRM member names. If you specify a DBRMmember name that begins with DSN, DB2 issues a warning message.

    dbrm-pds-nameAn identifier of 1 to 44 characters that identifies a partitioned data set.

    ddnameAn identifier of one to eight characters that identifies the name of a DDstatement.

    hexadecimal-constantA sequence of digits or any of the letters from A to F (uppercase or lowercase).

    hexadecimal-stringAn X followed by a sequence of characters that begins and ends with thestring delimiter, an apostrophe. The characters between the string delimitersmust be a hexadecimal number.

    index-nameA qualified or unqualified name that identifies an index.

    xviii Utility Guide and Reference

    |

  • A qualified index name is a schema name followed by a period and anidentifier.

    An unqualified index name is an identifier with an implicit schema namequalifier. The implicit schema is determined by the rules in DB2 SQL Reference.

    If the index name contains a blank character, the name must be enclosed inquotation marks when specified in a utility control statement.

    location-nameA location identifier of 1 to 16 letters (but excluding the alphabetic extenders),digits, or the underscore that identifies an instance of a database managementsystem. A location name must begin with a letter.

    lunameAn SQL short identifier of one to eight characters that identifies a logical unitname. A LU name must begin with a letter.

    member-nameAn identifier of one to eight letters (including the three alphabetic extenders)or digits that identifies a member of a partitioned data set.

    A member name should not begin with DSN because of a potential conflictwith DB2-provided member names. If you specify a member name that beginswith DSN, DB2 issues a warning message.

    qualifier-nameAn SQL short identifier of one to eight letters, digits, or the underscore thatidentifies the implicit qualifier for unqualified table names, views, indexes, andaliases.

    stringA sequence of characters that begins and ends with an apostrophe.

    subsystem-nameAn identifier that specifies the DB2 subsystem as it is known to the operatingsystem.

    table-nameA qualified or unqualified name that designates a table.

    A fully qualified table name is a three-part name. The first part is a locationname that designates the DBMS at which the table is stored. The second part isa schema name. The third part is an SQL identifier. A period must separateeach of the parts.

    A two-part table name is implicitly qualified by the location name of thecurrent server. The first part is a schema name. The second part is an SQLidentifier. A period must separate the two parts.

    A one-part or unqualified table name is an SQL identifier with two implicitqualifiers. The first implicit qualifier is the location name of the current server.The second is a schema name, which is determined by the rules in DB2 SQLReference.

    If the table name contains a blank, the name must be enclosed in quotationmarks when specified in a utility control statement.

    table-space-nameA short identifier that identifies a table space of an identified database. Theidentifier must start with a letter and must not include special characters. If adatabase is not identified, a table space name specifies a table space ofdatabase DSNDB04.

    About this information xix

    ||||||

    ||||||||||||||

  • utility-idAn identifier of 1 to 16 characters that uniquely identifies a utility processwithin DB2. A utility ID must begin with a letter. The remaining characters canbe uppercase and lowercase letters, numbers 0 through 9, and the followingcharacters: #, $, ., , !, , and @.

    How to read syntax diagramsCertain conventions apply to the syntax diagrams that are used in IBMdocumentation.

    Apply the following rules when reading the syntax diagrams that are used in DB2for z/OS documentation:v Read the syntax diagrams from left to right, from top to bottom, following thepath of the line.The symbol indicates the beginning of a statement.The symbol indicates that the statement syntax is continued on the nextline.The symbol indicates that a statement is continued from the previous line.The symbol indicates the end of a statement.

    v Required items appear on the horizontal line (the main path).

    required_item

    v Optional items appear below the main path.

    required_itemoptional_item

    If an optional item appears above the main path, that item has no effect on theexecution of the statement and is used only for readability.

    optional_item

    required_item

    v If you can choose from two or more items, they appear vertically, in a stack.If you must choose one of the items, one item of the stack appears on the mainpath.

    required_item required_choice1required_choice2

    If choosing one of the items is optional, the entire stack appears below the mainpath.

    required_itemoptional_choice1optional_choice2

    If one of the items is the default, it appears above the main path and theremaining choices are shown below.

    xx Utility Guide and Reference

  • required_itemdefault_choice

    optional_choiceoptional_choice

    v An arrow returning to the left, above the main line, indicates an item that can berepeated.

    required_item repeatable_item

    If the repeat arrow contains a comma, you must separate repeated items with acomma.

    required_item

    ,

    repeatable_item

    A repeat arrow above a stack indicates that you can repeat the items in thestack.

    v Sometimes a diagram must be split into fragments. The syntax fragment isshown separately from the main syntax diagram, but the contents of thefragment should be read as if they are on the main path of the diagram.

    required_item fragment-name

    fragment-name:

    required_itemoptional_name

    v With the exception of XPath keywords, keywords appear in uppercase (forexample, FROM). Keywords must be spelled exactly as shown. XPath keywordsare defined as lowercase names, and must be spelled exactly as shown. Variablesappear in all lowercase letters (for example, column-name). They representuser-supplied names or values.

    v If punctuation marks, parentheses, arithmetic operators, or other such symbolsare shown, you must enter them as part of the syntax.

    About this information xxi

    ||||||||||||||||||||||||||||||||||||||

  • xxii Utility Guide and Reference

  • Part 1. Introduction to the DB2 utilitiesThese topics provide an overview of the DB2 for z/OS utilities, including the typesof utilities and several restrictions when running utilities on certain objects. Thesetopics also include information about utilities packaging and installation.

    Copyright IBM Corp. 1983, 2009 1

  • 2 Utility Guide and Reference

  • Chapter 1. Basic information about the DB2 utilitiesDB2 online and stand-alone utilities have specific authorization rules for codingutility control statements and the data sets that the utilities use.

    Types of DB2 utilitiesThere are two types of DB2 utilities: online utilities and stand-alone utilities.

    DB2 online utilities run as standard batch jobs or stored procedures, and theyrequire DB2 to be running. They do not run under control of the terminal monitorprogram (TMP); they have their own attachment mechanism and they invoke DB2control facility services directly.

    The stand-alone utilities run as batch jobs that are independent of DB2. The onlyway to run these utilities is to use JCL. See the topics on the individual utilities forinformation about the ways to run these utilities.Related concepts

    Chapter 33, Invoking stand-alone utilities, on page 723Related tasks

    Chapter 3, Invoking DB2 online utilities, on page 13

    Privileges and authorization IDsA command or a utility job can be issued by an individual user, by a program thatruns in batch mode, or by an IMS or CICS transaction.

    The term process describes any of these initiators.

    A process is represented to DB2 by a set of identifiers (IDs). What the process cando with DB2 is determined by privileges and privileges that can be held by itsidentifiers. The phrase privilege set of a process means the entire set of privilegesand authorities that can be used by the process in a specific situation.

    Three types of identifiers exist: primary authorization IDs, secondary authorizationIDs, and SQL authorization IDs.v Generally, the primary authorization ID identifies a specific process. For example,in the process that is initiated through the TSO attachment facility, the primaryauthorization ID is identical to the TSO logon ID. A trace record identifies theprocess by that ID.

    v Secondary authorization IDs, which are optional, can hold additional privilegesthat are available to the process. A secondary authorization ID is often aSecureWay Security Server Resource Access Control Facility (RACF) group ID.For example, a process can belong to a RACF group that holds the LOADprivilege on a particular database. Any member of the group can run the LOADutility to load table spaces in the database.DB2 commands that are entered from a z/OS console are not associated withany secondary authorization IDs.

    v An SQL authorization ID (SQL ID) holds the privileges that are exercised whenissuing certain dynamic SQL statements. Generally, this topic does not discussthe SQL ID.

    Copyright IBM Corp. 1983, 2009 3

  • Within DB2, a process can be represented by a primary authorization ID andpossibly one or more secondary IDs. For DB2 online utilities, the process can berepresented by a primary authorization ID, possibly one or more secondary IDs,and role, if running in a trusted connection with an associated role.

    An administrator can grant or revoke a privilege or authority for an identifier byexecuting an SQL GRANT or a REVOKE statement.

    If you use the access control authorization exit routine, that exit routine mightcontrol the authorization rules, rather than the exit routines that are documentedfor each utility.Related information

    Processing of sign-on requests (DB2 Administration Guide)

    Utilities that can be run on declared temporary objectsThe REPAIR DBD utility and the STOSPACE utility can be run on declaredtemporary objects.v You can use the REPAIR DBD utility on declared temporary tables, which mustbe created in a database that is defined with the AS TEMP clause.

    v You can use the STOSPACE utility on storage groups that have objects withintemporary databases.

    No other DB2 utilities can be used on a declared temporary table, its indexes, or itstable spaces.

    For detailed information about target object support, see the Concurrency andcompatibility topic for each utility.

    Effect of utilities on objects that have the DEFINE NO attributeWith DB2 Version 7 or above, you can run certain online utilities on table spaces orindex spaces that were defined with the DEFINE NO attribute. When you specifythis attribute, the table space or index space is defined, but DB2 does not allocatethe associated data sets until a row is inserted or loaded into a table in that tablespace.

    You can populate table spaces whose data sets are not yet defined by using theLOAD utility with either the RESUME keyword, the REPLACE keyword, or both.Using LOAD to populate these table spaces results in the following actions:1. DB2 allocates the data sets.2. DB2 updates the SPACE column in the catalog table to show that data sets

    exist.3. DB2 loads the specified table space.

    For a partitioned table space, all partitions are allocated even if the LOAD utility isloading only one partition. Avoid attempting to populate a partitioned table spacewith concurrent LOAD PART jobs until after one of the jobs has caused all the datasets to be created.

    Online utilities that encounter an undefined target object might issue informationalmessage DSNU185I, but processing continues.

    4 Utility Guide and Reference

  • The following online utilities issue informational message DSNU185I when a tablespace or index space with the DEFINE NO attribute is encountered. The object isnot processed.v CHECK DATAv CHECK INDEXv COPYv MERGECOPYv MODIFY RECOVERYv QUIESCEv REBUILD INDEXv RECOVERv REORG INDEXv REORG TABLESPACEv REPAIR, but not REPAIR DBDv RUNSTATS TABLESPACE INDEX(ALL) 1v RUNSTATS INDEX 1v UNLOAD

    Note:

    1. RUNSTATS recognizes DEFINE NO objects and updates the catalogs accesspath statistics to reflect the empty objects.

    You cannot use stand-alone utilities on objects whose data sets have not beendefined.

    Effect of utilities on data that is encrypted through built-in functionsYou can copy and recover encrypted data. You can also move encrypted databetween systems. Data remains encrypted throughout these processes.

    However, running any of the following utilities on encrypted data might produceunexpected results:v CHECK DATAv LOADv REBUILD INDEXv REORG TABLESPACEv REPAIRv RUNSTATSv UNLOADv DSN1PRNT

    Chapter 1. Basic information about the DB2 utilities 5

  • 6 Utility Guide and Reference

  • Chapter 2. DB2 utilities packagingSeveral utilities are included with DB2 at no extra charge. Other utilities areavailable as a separate product.

    The following utilities are core utilities, which are included (at no extra charge)with Version 9.1 of DB2 for z/OS:v CATENFMv CATMAINTv DIAGNOSEv LISTDEFv OPTIONSv QUIESCEv REPAIRv REPORTv TEMPLATEv All DSN stand-alone utilities

    All other utilities are available as a separate product called the DB2 Utilities Suite(5655-N97, FMIDs JDB991K), which includes the following utilities:v BACKUP SYSTEMv CHECK DATAv CHECK INDEXv CHECK LOBv COPYv COPYTOCOPYv EXEC SQLv LOADv MERGECOPYv MODIFY RECOVERYv MODIFY STATISTICSv REBUILD INDEXv RECOVERv REORG INDEXv REORG TABLESPACEv RESTORE SYSTEMv RUNSTATSv STOSPACEv UNLOAD

    All DB2 utilities operate on catalog, directory, and sample objects, withoutrequiring any additional products.

    SMP/E jobs for DB2 utility productsTo load the DB2 utility products, use System Modification Program Extended(SMP/E). SMP/E processes the installation cartridges and creates DB2 distributiontarget libraries.

    DB2 provides several jobs that invoke SMP/E. These jobs are on the cartridge thatyou received with the utility product. The job prologues in these jobs containdirections on how to tailor the job for your site. Follow these directions carefully toensure that your DB2 Utilities Suite SMP/E process works correctly.

    Copyright IBM Corp. 1983, 2009 7

    ||

    ||

  • The SMP/E RECEIVE job, DSNRECVK, loads the DB2 Utilities Suite Version 9program modules, macros, and procedures into temporary data sets (SMPTLIBs). Ifthese jobs fail or abnormally terminate, correct the problem and rerun the jobs.

    The SMP/E APPLY job, DSNAPPLK, copies and link-edits the program modules,macros, and procedures for the DB2 Utilities Suite Version 9 into the DB2 targetlibraries.

    The SMP/E ACCEPT job, DSNACCPK, copies the program modules, macros, andprocedures for the DB2 Utilities Suite Version 9 into the DB2 distributed libraries.Related information

    SMP/E step 4: Run the receive jobs: DSNRECV1, DSNRECV2, DSNRECV3,DSNRECV4 (DB2 Installation Guide)SMP/E step 6: Run the apply job: DSNAPPL1 (DB2 Installation Guide)SMP/E step 7: Run the accept job: DSNACEP1 (DB2 Installation Guide)

    The operation of DB2 utilities in a mixed-release data sharingenvironment

    The utilities batch module, DSNUTILB, is split into multiple parts: arelease-independent module called DSNUTILB and multiple release-dependentmodules, DSNUT910 and the utility-dependent load modules that are listed in thefollowing table.

    To operate in a mixed-release data sharing environment, you must have therelease-dependent modules from both releases and all applicable utility-dependentmodules available to the utility jobs that operate across the data sharing group.The procedure for sharing utility modules is explained in DB2 Data Sharing:Planning and Administration. Use the information in the following table and theprocedures that are outlined in DB2 Data Sharing: Planning and Administration toimplement a mixed-release data sharing environment.

    Table 1. Relationship between utility names and load modulesUtility name Load module name

    BACKUP SYSTEM and RESTORE SYSTEM DSNU91LV

    CATMAINT and CATENFM DSNU91LA

    CHECK DSNU91LB

    COPY DSNU91LC

    COPYTOCOPY DSNU91LT

    DIAGNOSE DSNU91LD

    EXEC SQL DSNU91LU

    LISTDEF DSNU91LE

    LOAD DSNU91LF

    MERGECOPY DSNU91LG

    MODIFY RECOVERY and MODIFYSTATISTICS

    DSNU91LH

    OPTIONS DSNU91LI

    QUIESCE DSNU91LJ

    REBUILD INDEX DSNU91LK

    8 Utility Guide and Reference

    ||||||||

    |||||||||||||||||||||||||||

    ||||||

  • Table 1. Relationship between utility names and load modules (continued)Utility name Load module name

    RECOVER DSNU91LL

    REORG INDEX and REORG TABLESPACE DSNU91LM

    REPAIR DSNU91LN

    REPORT DSNU91LO

    RUNSTATS DSNU91LP

    STOSPACE DSNU91LQ

    TEMPLATE DSNU91LR

    UNLOAD DSNU91LS

    Chapter 2. DB2 utilities packaging 9

    ||||||||||||||||||||

  • 10 Utility Guide and Reference

  • Part 2. DB2 online utilitiesDB2 online utilities run as standard batch jobs or stored procedures, and theyrequire DB2 to be running. They do not run under control of the terminal monitorprogram (TMP); they have their own attachment mechanism and they invoke DB2control facility services directly.

    Copyright IBM Corp. 1983, 2009 11

  • 12 Utility Guide and Reference

  • Chapter 3. Invoking DB2 online utilitiesYou can invoke DB2 online utilities using one of five methods.

    Requirement: In the JCL for all utility jobs, specify a load library that is at amaintenance level that is compatible with the DB2 system. Otherwise, errors canoccur.

    To run DB2 online utilities:1. Prepare the necessary data sets.2. Create a utility control statement using the syntax, option descriptions, and

    samples.3. Check for any concurrency and compatibility restrictions.4. Plan for a restart in case the utility job does not complete.5. Invoke the online utilities using one of the following methods:

    v Use the DB2 Utilities panel in DB2I.This method involves little involvement with JCL. You can edit the generatedJCL to alter or add necessary fields on the JOB or ROUTE cards before yousubmit the job.

    Requirement: To use this method you must have TSO and access to the DB2Utilities Panel in DB2 Interactive (DB2I).

    v Use the DSNU CLIST command in TSO.This method involves little involvement with JCL. You can edit the generatedJCL to alter or add necessary fields on the JOB or ROUTE cards before yousubmit the job.

    Requirement: To use this method you must have TSO.v Use the supplied JCL procedure (DSNUPROC).This method involves working with or creating your own JCL.

    v Use the EXEC statement to create the JCL data set yourself.This method involves working with or creating your own JCL.

    v Use the DSNUTILS or DSNUTILT stored procedure.This method involves invoking online utilities from a DB2 applicationprogram.

    Related concepts

    Appendix B, DB2-supplied stored procedures, on page 853Related reference

    DSNUTILS stored procedure on page 860DSNUTILU stored procedure on page 871DSNACCOR stored procedure on page 874DSNACCOX stored procedure on page 895

    Data sets that online utilities useEvery online utility job requires a SYSIN DD statement to describe an input dataset; some utilities also require other data sets.

    Copyright IBM Corp. 1983, 2009 13

  • For input data setsThe online utilities use the logical record length (LRECL), the recordformat (RECFM) and the block size (BLKSIZE) with which the data set wascreated. Variable-spanned (VS) or variable-blocked-spanned (VBS) recordformats are not allowed for utility input data sets. The only exception is forthe LOAD utility, which accepts unloaded data in VBS format.

    For output data setsThe online utilities determine both the logical record length and the recordformat. Any specified values for LRECL or RECFM are ignored. If yousupply block size, that size is used; otherwise, the utility lets the systemdetermine the optimal block size for the storage device. DB2 supports thelarge block interface (LBI) that allows block sizes that are greater than 32KB on certain tape drives. LBI is supported in new function mode (NFM)only. Partitioned data sets (PDS) are not allowed for output data sets. TheTAPEBLKSZLIM parameter of the DEVSUPxx member of SYS1.PARMLIBcontrols the block size limit for tapes. See the z/OS MVS Initialization andTuning Guide for more details.

    For both input and output data setsThe online utilities use the value that you supply for the number of buffers(BUFNO), with a maximum of 99 buffers. The default number of buffers is20. The utilities set the number of channel programs equal to the numberof buffers. The parameters that specify the buffer size (BUFSIZE) and thenumber of channel programs (NCP) are ignored. If you omit any DCBparameters, the utilities choose default values.

    Increasing the number of buffers (BUFNO) can result in an increase in realstorage utilization and page fixing below the 16-MB line.

    Restriction: DB2 does not support the undefined record format (RECFM=U) forany data set.

    Data set concatenation

    DB2 utilities let you concatenate unlike input data sets. Therefore, the data sets in aconcatenation list can have different block sizes, logical record lengths, and recordformats. If you want to concatenate variable and fixed-blocked data sets, the logicalrecord length must be 8 bytes smaller than the block size.

    You cannot concatenate output data sets.

    Controlling data set disposition

    Most data sets need to exist only during utility execution (for example, duringreorganization). However, you must retain several data sets in certaincircumstances:v Retain the image copy data sets until you no longer need them for recovery.v Retain the unload data sets if you specify UNLOAD PAUSE, UNLOAD ONLY,UNLOAD EXTERNAL, or DISCARD for the REORG utility.

    v Retain the SYSPUNCH data set if you specify UNLOAD EXTERNAL orDISCARD for the REORG utility until you no longer need the contents forsubsequent loads.

    v Retain the discard data set until you no longer need the contents for subsequentloads.

    14 Utility Guide and Reference

    ||||

  • Because you might need to restart a utility, take the following precautions whendefining the disposition of data sets:v Use DISP=(NEW,CATLG,CATLG) or DISP=(MOD,CATLG) for data sets that youwant to retain.

    v Use DISP=(MOD,DELETE,CATLG) for data sets that you want to discard afterutility execution.

    v Use DISP=(NEW,DELETE) for DFSORT SORTWKnn data sets, or refer toDFSORT Application Programming: Guide for alternatives.

    v Do not use temporary data set names.

    Preventing unauthorized access to data sets

    To prevent unauthorized access to data sets (for example, image copies), you canprotect the data sets with the Resource Access Control Facility (RACF) licensedprogram. To use a utility with a data set that is p