FL 507 If the partitioning scheme of a table in a partition-by-range (PBR) table space is no longer suitable for your applications, you can convert it to use a partition-by-growth (PBG) partitions without incurring lengthy application outages.
Before you begin
The application that issues that ALTER TABLE statement to change the table partitioning scheme from PBR to PBG partitions must run at application compatibility level V13R1M507 or higher.
As part of the conversion, existing partitioned indexes are converted to non-partitioned indexes. Existing access paths that involve those indexes will be affected which may result in performance impact.
Procedure
To convert the partitioning scheme of a table with PBR partitions to PBG partitions, complete the following steps:
- Consider the data set size and maximum number of partitions.
The data set size and maximum number of partitions (MAXPARTITIONS) for the converted PBG table can be specified on the ALTER TABLE statement. Consider and specify the value that satisfies the requirements for the converted PBG table. If the table has DATA CAPTURE CHANGES, the maximum number of partitions must not be less than the number of partitions for the original PBR table.
- Plan for any other necessary schema alterations.
Many pending options are allowed to be stacked with the PBR to PBG conversion. Consider issuing necessary schema changes, stacking those with PBR to PBG conversion, and then materializing all the pending changes in a single online REORG.
However, the PBR to PBG conversion is not allowed if pending changes already exist for certain options and certain immediate changes are restricted until the PBR to PBG conversion is materialized. For more information, see Restrictions for pending data definition changes.
- Resolve any restricted, incompatible exception states for the table space and indexes.
The ALTER TABLE statement might return SQLCODE -650 RC54 if there are restricted states: LPL, WEPR, or GRECP.
For example, you can issue a DISPLAY DATABASE command with the RESTRICT keyword:
DISPLAY DATABASE(database-name) SPACENAM(*) RESTRICT(GRECP,LPL,WEPR)
- Issue the ALTER TABLE statement with the ALTER PARITIONING clause to convert the table partitions from PBR to PBG.
For example, the following statement converts existing table TB01 to use growth-based partitions and converts the containing table space to a PBG table space.
ALTER TABLE TB01 ALTER PARTITIONING TO PARTITION BY GROWTH;
- Run the REORG utility with SHRLEVEL REFERENCE or CHANGE clause to materialize the pending change and any other stacked pending changes.
What to do next
If the table in the converted table space is enabled through IBM Integrated Synchronization for replication to products such as IBM® Db2 for z/OS® Data Gate or IBM Db2 Analytics Accelerator, you might need to take action to resume replication and fully reload the table to the accelerator or Data Gate after completing the conversion. Also, if you altered the table definition to DATA CAPTURE NONE to reduce the number of partitions during the conversion, you must alter the table to use DATA CAPTURE CHANGES again after the conversion.