Moving Db2-managed data with REORG, RECOVER, or REBUILD

You can create a storage group (possibly using a new catalog alias) and move the data to that new storage group.

Procedure

To create a new storage group that uses the correct volumes and the new alias:

  1. Execute the CREATE STOGROUP SQL statement to create the new storage group.

    Begin general-use programming interface information.For example:

    CREATE STOGROUP stogroup-name
       VOLUMES (VOL1,VOL2)
       VCAT (newcat);

    End general-use programming interface information.

  2. Issue the STOP DATABASE command on the database that contains the table spaces or index spaces whose data sets you plan to move, to prevent access to those data sets.

    Begin general-use programming interface information.

    -STOP DATABASE(dbname) SPACENAM(*)

    End general-use programming interface information.

  3. Execute ALTER TABLESPACE or ALTER INDEX SQL statements to assign the table spaces or indexes to the new storage group.

    Begin general-use programming interface information.

    ALTER TABLESPACE dbname.tsname
      USING STOGROUP stogroup-name;
    ALTER INDEX creator.index-name
      USING STOGROUP stogroup-name;

    End general-use programming interface information.

  4. Using IDCAMS, rename the data sets for the index spaces and table spaces to use the high-level qualifier for the new storage group. Also, be sure to specify the instance qualifier of your data set, y, which can be either I or J. If you have run REORG with SHRLEVEL CHANGE or SHRLEVEL REFERENCE on any table spaces or index spaces, the fifth-level qualifier might be J0001.
       ALTER oldcat.DSNDBC.dbname.*.y0001.A001  -
          NEWNAME newcat.DSNDBC.dbname.*.y0001.A001
       ALTER oldcat.DSNDBD.dbname.*.y0001.A001  -
          NEWNAME newcat.DSNDBD.dbname.*.y0001.A001
  5. Issue the START DATABASE command to start the database for utility processing only.

    Begin general-use programming interface information.

    -START DATABASE(dbname) SPACENAM(*) ACCESS(UT)

    End general-use programming interface information.

  6. Run the REORG utility or the RECOVER utility on the table space or index space, or run the REBUILD utility on the index space.
  7. Issue the START DATABASE command to start the database for full processing.

    Begin general-use programming interface information.

    -START DATABASE(dbname) SPACENAM(*)

    End general-use programming interface information.