Running Db2 utilities on table spaces

Many Db2 utilities run against table spaces. You can use Db2 Admin Tool to specify the utility options and generate the JCL to run these utilities.

About this task

If you want to run a utility against a LISTDEF list of table spaces, see Running utilities on LISTDEF lists.

If you want to run redirected recovery, see Running a redirected recovery on a table space.

Tip: Start of changeWhen you run COPY, REORG and RUNSTATS on multiple objects, consider enabling the use of LISTDEF lists in the generated utility jobs [the Generate utilities with LISTDEF option on the Utility Settings (ADBPPIU2) panel]. For details, see Specifying whether LISTDEF is used in generated utility jobs. End of change

Procedure

To run Db2 utilities on table spaces:

  1. Select the table spaces on which you want to run the utility:
    1. On the DB2 Administration Menu (ADB2) panel, select option 1.
    2. On the System Catalog (ADB21) panel, if you want to select all table spaces in one or more databases, select option D. Otherwise, select option S. Optionally specify any filtering criteria at the bottom of the panel, and press Enter.
    3. If the Databases (ADB21D) panel is displayed, filter the list as needed, and specify the UTIL primary command.
    4. If the Table Spaces (ADB21S) panel is displayed, select one or more table spaces:
      • If you want to select one table space, issue the UT line command next to the table space name, and press Enter.
      • If you want to select more than one table space, filter the list as needed, specify the UTIL primary command, and press Enter.
    The Table Space Utilities (ADB2US) panel is displayed:
    Figure 1. Table Space Utilities (ADB2US) panel
    ADB2US in ------------------ DD1A Table Space Utilities ----------------- 23:16
    Option ===>                                                                 
                                                                                   
     Execute utility on                                      DB2 System: DD1A      
        table space DSN8D81A.DSN8S81D                        DB2 SQL ID: ADM001     
                                                                       More:     + 
        C - Copy full            CI - Copy incremental     C2 - Copytocopy  
       CC - Copy concurrent                                                        
        E - Mergecopy            EN - Mergecopy newcopy                            
        K - Check index          KD - Check data           KL - Check LOB          
       LC - Load with Cross loader (force review/modify options)                   
        M - Modify recovery      MS - Modify statistics                            
        N - Repair 
        O - Reorg                OU - Reorg unload only    OO - Online reorg       
       OC - Reorg with Inline Copy                                                 
        P - Report recovery       Q - Quiesce                                      
        R - Runstats             RT - Runstats table all   RR - Runstats report    
       RX - Runstats (to invalidate dynamic cache)                                 
        V - Recover              VC - Recover tocopy       VG - Recover to last GDG
       VI - Rebuild index        VR - Recover torba        VL - Recover logonly    
       DG - Define GDG for       VF - Redirected recovery  VP - Recover tologpoint 
            copy data sets
        U - Unload
                                                                                   
       SM - Standard Maintenance  C O R                                            
       BP - Change batch job parameters                                            
       TU - Specify Template Usage                                                 
                                                                                                                                         
    Utility control options                                 
      List/Customize DB2 Utility options . YES  (Yes/No)    
      Generate work statement list . . . . NO   (Yes/No)    
      Generate template statements . . . . YES  (Yes/No)    
      Generate modify after copy . . . . . NO   (Yes/No) 
    Note: The LC option is displayed only when all of the following conditions are true:
    • The table does not contain XML columns.
    • The panel is displayed for one table space.
    • The table space contains only one table.
    • The table space is not a LOB table space.
    • The target table does not contain GENERATED ALWAYS columns.
  2. Optional: Specify the following options as needed:
    BP
    If you plan to generate a batch utility job stream and want to change the JOB statement or other system parameters, specify BP and press Enter. On the resulting Batch Job Utility Parameters (ADB2UPA) panel, specify the options that you want to change. Then, press PF3 to save your changes and return to the Table Space Utilities (ADB2US) panel.
    TU
    If you plan to use templates and want to specify which template to use for a given utility option, specify TU. Then, follow the instructions in Associating data set templates with keywords.
    Tip: When you run the COPY utility, by default one copy is written to the data set that is defined by the SYSCOPY DD statement. If you want more than one copy of the output, you can create and use templates for COPYDDN 1, COPYDDN2, RECOVERYDDN1, and RECOVERYDDN2.
    SM
    If you want to run the listed series of utilities, specify the SM command. The utilities are processed in the order specified in this field. For example, the following field shows that COPY (C), REORG (O), and RUNSTATS (R) will be run in that order.
    SM - Standard Maintenance  C O R  

    If you specify SM, you cannot set List/Customize DB2 Utility options to YES.

  3. In the Option field, specify a utility to run on the selected table. For example, specify O to run the REORG utility.
  4. Change any of the following control options, and press Enter:
    List/Customize DB2 Utility options
    Specify whether you want to review and edit the utility options. If the value is NO, the default options for the selected utility are used.

    Start of changeFor the REPAIR utility (option N), you must select which REPAIR function you want to run. Therefore, Db2 Admin Tool always uses a value of YES for this field and displays a subsequent option panel, Specify Utility Options - REPAIR TABLESPACE (ADB2USN) panel, even if you set this field to NO. End of change

    Generate work statement list
    Specify whether you want the utility control statements to be added to a work statement list (WSL). If the value is NO, an executable utility job stream is generated instead.

    When you specify the CHECK utility, a batch statement list, which is similar to a WSL, is generated by default, regardless of the value of the Generate work statement list field. The batch statement list is required as an input file to the Batch Restart program (ADBTEP2), which manages the CHECK utility function.

    Generate template statements
    Specify whether you want templates to be used. If the value is YES, Db2 Admin Tool uses the active templates that are defined. (If you want to change these templates, specify the TU option.)

    Db2 Admin Tool does not generate any TSODELETE statements to delete any existing data sets for the template first. To ensure that any existing data sets are deleted, consider using one of the following techniques when you define the template:

    • Specify the data set name pattern as a GDG (generation data group) where the next data set in the sequence is generated (+1), and change the other common options so that the GDGLIMIT is 1. This setup causes the data sets in the group to roll off so that only one data set exists at any one time. For example, a data set pattern name might be specified as &db..&ts..&name..ic(+1).
    • Specify a DISP option of NEW, DELETE, DELETE for the data set, if appropriate.

    When you specify the CHECK utility, templates are used regardless of the value of the Generate template statements field, because the CHECK utility function requires the use of templates. Either the default templates or the templates that you specify are used.

    Tip: Start of changeIf you want the generated REORG and COPY jobs to use LISTDEF lists and the use of LISTDEF is enabled (see Specifying whether LISTDEF is used in generated utility jobs), templates must be set up for these utilities, and the Generate template statements field must be set to YES.End of change
    Generate modify after copy
    Specify whether the generated JCL includes a job step to run the MODIFY utility after a full image copy.
  5. If the Specify Utility Options panel is displayed, specify any additional options, and press Enter.
    Start of changeThis panel is displayed if List/Customize DB2 Utility options = YES or if the utility selected is N (REPAIR) or LC (Load with Cross loader).

    You must specify the options according to the Db2 syntax rules for utilities. For additional information, restrictions, and recommendations on various utility options, see Db2 online utilities (Db2 13 for z/OS).

    End of change
  6. If you requested a work statement list (WSL): On the Specify Work Statement List (ADB2WLDA) panel, specify the WSL information, and press Enter.
    The utility statements are added to the WSL.
  7. If you requested a batch job stream: On the ISPF edit session, change the generated job as needed or copy it to another it to another data set.

    You can use standard ISPF editor commands to manually modify the JCL.

    Db2 Admin Tool supports unloading tables or table spaces that produce a record length that is less than 32 KB. When a table or table space with LOB objects is unloaded, the required record length might exceed 32 KB. In this case, modify the unload job or work statement list (WSL) to specify the utility parameters that allow unloading the table or table space.

    The following figure shows an example of the generated JCL. In this example, the C - Copy full option was chosen on the Table Space Utilities (ADB2US) panel.

    Figure 2. Edit generated JCL panel (COPY utility)
    -------------------------------------------------------------------------------
    EDIT       ISTJE.SPFTEMP2.CNTL                             Columns 00001 00072 
    Command ===>                                                  Scroll ===> PAGE 
    000007 //*                                                                     
    000008 //**********************************************************************
    000009 //*                                                                     
    000010 //* DB2 ADMIN GENERATED JOB TO RUN COPY ON SELECTED TABLESPACES         
    000011 //*                                                                     
    000012 //************************************************************ADB2USC***
    000013 //*                                                                     
    000014 //**********************************************************************
    000015 //* STEP COPY: COPY TABLESPACE DSN8D81A.DSN8S81D                        
    000016 //************************************************************ADB2USC1**
    000017 //COPY EXEC DSNUPROC,SYSTEM=DB2X,                                       
    000018 //             LIB='SYS1.DSNDB2X.SDSNLOAD',                             
    000019 //             UID='ISTJE'                                              
    000020 //DSNUPROC.SYSCOPY DD DSN=ISTJE.DB2X.IC.DSN8D81A.DSN8S81D(+1),          
    000021 //             DISP=(NEW,CATLG),                                        
    000022 //             SPACE=(8192,(7,5),RLSE),                                 
    000023 //             UNIT=SYSDA                                               
    000024 //DSNUPROC.SYSIN  DD  *                                                 
    000025 COPY TABLESPACE DSN8D81A.DSN8S81D DSNUM ALL FULL YES                    
    000026 /*                                                                      
    000027 //**********************************************************************
    000028 //* STEP MOD: MODIFY RECOVERY TABLESPACE DSN8D81A.DSN8S81D              
    000029 //**********************************************************************
    000030 //MOD EXEC DSNUPROC,SYSTEM=DB2X,                                        
    000031 //             LIB='SYS1.DSNDB2X.SDSNLOAD',                             
    000032 //             UID='ISTJE'                                              
    000033 //DSNUPROC.SYSIN  DD  *                                                 
    000034 MODIFY RECOVERY TABLESPACE DSN8D81A.DSN8S81D DSNUM ALL                  
    000035     DELETE AGE(35)                                                      
    000036 /*                                                                      
    ****** **************************** Bottom of Data ****************************
    
  8. Submit the generated JCL job or run the specified WSL to run the utility.