Migrating existing partitioned data in a DB2 database

Perhaps the simplest application of multi-tier storage to databases is relocation of partitioned data between different placement classes as usage requirements change. If exact relocation times are unpredictable, or if relocation is infrequent, administrators may wish to relocate table partitions as business requirements surface rather than defining strict periodic relocation schedules.

For example, a large retailer keeps the most recent year of sales information in the fast storage class and the rest of the data in the slow storage class. The database administrator creates one table per quarter, using four tables to represent a year of sales data. Each table resides in a separate tablespace. The database administrator then unions the four tables together, called year_sales, using the UNION ALL construct in DB2. Every quarter, the database administrator rolls out the oldest table to slower storage to make room for the new table in the fast storage class. Assume that the current tables are sales_0304, sales_0404, sales_0105, and sales_0205. The sales_0304 table represents the oldest quarter, and it resides in tablespace tbs_sales_0304.

First, you must set up your system to use Database Dynamic Storage Tiering.

To add the fast_storage and slow_storage storage classes

To convert the database's file system and add volumes for use with Database Dynamic Storage Tiering

To classify volumes into storage classes

Once the volumes are configured, an administrator can roll out the oldest table, sales_0304, and add a new table

To move the oldest sales data into a slower class and add a new tablespace

  1. Use the dbdst_tbs_move command as follows:

    $ /opt/VRTS/bin/dbdst_tbs_move -D PROD -t tbs_sales_0304 \
    -c slow_storage
  2. Drop the year_sales view.

  3. Create a new tablespace, tbs_sales_0305, and create the table sales_0305 in this tablespace.

  4. Recreate the file year_sales by performing a UNION ALL, including sales_0305 and excluding sales_0304.

  5. Move the tablespace to fast storage as follows:

    $ /opt/VRTS/bin/dbdst_tbs_move -D PROD -t tbs_sales_0305 \
    -c fast_storage