Db2 Tools for z/OS

 View Only

Db2 Administration Tool 13.1: Converting partition-by-growth (PBG) table spaces to partition-by-range (PBR) table spaces online

By Kate Wheat posted Mon June 06, 2022 12:51 PM

  

In previous versions of Db2 Admin Tool, you can change a PBG table space to a PBR table space by using a series of commands. Db2 Admin Tool then dropped and recreated the table space as requested. Beginning in Db2 Admin Tool 13.1, you can use the same series of commands to change a table space from PBG to PBR, and if Db2 Admin Tool is bound with an APPLCOMPAT value of V13R1M500 or higher, this conversion is performed by using the new Db2 13 ALTER syntax and a REORG utility operation (if the table space is defined).  Using an ALTER operation (instead of DROP and CREATE operations) minimizes any outages.

For example, suppose you have PBG table space RDBKXMP that you want to convert to PBR by using Db2 Admin Tool. First, you need to navigate to the table space by using the catalog navigation feature. Then, you can use the ALT function followed by the MAKEPBR2 command to specify that you want to convert the table space to PBR. Db2 Admin Tool then generates the corresponding ALTER and REORG statements. The specific steps are as follows:

  1. On the main menu, specify option 1 (DB2 System Catalog), and press Enter:


  2. On the System Catalog panel (ADB21), specify option S (Table spaces) and any filtering criteria to help you find your table space, and press Enter.

    Tip: If you do not see the panel ID ADB21S in the upper left corner of the panel, specify PANELID and press Enter to turn on the panel IDs. You can use the PANELID command to toggle the IDs on and off.

    You can enter filtering criteria at the bottom of the panel. In the following example, RDBK% in the Name field indicates that you want to see only those table spaces whose names start with RDBK.

    Your table space, RDBKXMP, (and any others that qualify) are displayed on the Table Spaces panel (ADB21S). Notice that the T (Type) column contains a G to indicate that it is a PBG table space:



  3. Recommended: On the ADB21S panel, specify the PDC line command next to RDBKXMP, and press Enter to check for any pending changes.

    Because Db2 restricts altering a table space from PBG to PBR if pending changes exist, checking for any pending changes now can help ensure that the conversion is successful.

    In this case, the following message is displayed to indicate that RDBKXMP has no pending changes:

    However, if it did have pending changes, you need to materialize those changes by running REORG before continuing.

  4. On the ADB21S panel, specify the ALT line command next to RDBKXMP, and press Enter to begin the process of altering the table space.

    Tip: You must use the ALT line command (not the AL line command) to alter a table space from PBG to PBR with the new Db2 13 ALTER syntax.

  5. If the Change Management (CM) prompt is displayed, specify NO, and press Enter.
    This example does not use CM.

  6. On the Redefine Table Space panel (ADB21SAR), specify MAKEPBR2 and press Enter:


    After you press Enter, the values of the Max Partitions and PAGENUM fields change:

    Also notice the new message in the CREATE TABLESPACE field:

    Enhanced PBR means that the table space uses relative page numbering.

  7. Specify any other changes on the ADB21SAR panel, and press Enter.
    This example also increases the number of partitions (in the Numparts field) to 5:


  8. Specify NEXT, and press Enter.

  9. On the Alter Table panel (ADB21TAP), specify the partitioning key by using the nnn A|D line command, where nnn is a number to indicate sequence and the letters ‘A’  and ‘D’ indicate order ('A' for ascending and ‘D’ for descending). Then press Enter.

    For example, specifying 1A next to column A indicates that this column is the first (and in this case only) column in the partitioning key and ascending order is used:


    Your specification is displayed in the ColSeq and Order columns:
      
  10. Specify Next, and press Enter.

  11. On the Alter Partitioned Table panel (ADB21TAV), specify the limit key values, and press Enter:

    You must ensure that the high limit key for the last partition is MAXVALUE (for ascending columns) or MINVALUE (for descending columns). This specification is a Db2 requirement to avoid the data being discarded during a subsequent REORG operation.

  12. Specify NEXT, and press Enter.

  13. On the Alter Objects panel (ADB27CA), specify NEXT again, and press Enter:


  14. On the ALTER – Build Analyze and Apply Job panel (ADBPALT), specify the job options, and press Enter:
    • Specify whether you want to implement these changes by using a work statement list (WSL) in the As work statement list field. Otherwise, Db2 Admin Tool generates the changes as a JCL job stream in a PDS. This example uses a WSL.
    • Make sure that the Run REORG/REBUILD field is set to allow for any necessary REORGs. Converting from PBG to PBR is a pending change (unless the data sets for the table space are not already created), so you want to generate the necessary REORG statement to materialize the change.


       A job is generated in the ADBALTER member. This ADBALTER job has two parts: an analyze step and an apply step. The analyze step determines the actions that are needed to make the requested changes. The apply step generates an apply job either as a WSL  or a JCL job stream in a PDS. In this case, the apply job will be a WSL.

  15. Submit the generated ADBALTER job.

  16. Run the resulting WSL to execute the ALTER statement.

    Tip: To navigate to your WSL, specify the WSL command and then option 1 and then select your WSL. Specify the E line command to view the statements in the WSL. Specify the R line command to run it.

    Notice that the WSL has new ALTER TABLE statement syntax:


  17. If you navigate back to the table space by using the catalog navigation feature, you can see that the table space is changed to PBR:

#Db2Toolsforz/OS
0 comments
19 views

Permalink