Scenario: Adding a storage path and rebalancing automatic storage table spaces
This scenario shows how storage paths are added to a storage group and how a REBALANCE operation creates one or more containers on the new storage paths.
The assumption in this scenario is to add a new storage path to a storage group and have an existing table space be striped across that new path. I/O parallelism is improved by adding a new container into each of the table space's stripe sets.
Use the ALTER STOGROUP statement to add a new storage path to a storage group. Then, use the REBALANCE clause on the ALTER TABLESPACE statement to allocate containers on the new storage path and to rebalance the data from the existing containers into the new containers. The number and size of the containers to be created depend on both the definition of the current stripe sets for the table space and on the amount of free space on the new storage paths.

A similar situation could
occur when an existing table space has multiple stripe sets with differing
numbers of containers in them, which could have happened due to disk
full conditions on one or more of the storage paths during
the life of the table space. In this case, it would be advantageous
for the database manager to add containers to those existing storage
paths to fill in the holes
in the stripe sets (assuming of
course that there is now free space to do so). The REBALANCE operation
can be used to do this as well.
holeexists in the stripe sets of a table space (possibly caused by deleting table rows, for example) being rebalanced, with the
beforeand
afterlayout of the storage paths.

Examples
CREATE STOGROUP sg ON '/path1', '/path2'
After
creating the database, automatic storage table spaces were subsequently
created in this storage group.- The first step is to add the storage path to the storage group:
ALTER STOGROUP sg ADD '/path3'
- The next step is to determine all of the affected permanent table spaces. This can be done by
manually scanning table space snapshot output or via SQL. The following SQL statement will generate
a list of all the regular and large automatic storage table spaces in the storage
group:
SELECT TBSP_NAME FROM table (MON_GET_TABLESPACE('', -2)) WHERE TBSP_USING_AUTO_STORAGE = 1 AND TBSP_CONTENT_TYPE IN ('ANY','LARGE') AND STORAGE_GROUP_NAME = 'sg' ORDER BY TBSP_ID
- Once the table spaces have been identified, the next step is to
perform the following statement for each of the table spaces listed.
Provided that there is sufficient space on the remaining storage paths,
it generally shouldn't matter what order the rebalances are performed
in (and they can be run in parallel).
ALTER TABLESPACE tablespace_name REBALANCE
SELECT TBSP_NAME
FROM table (MON_GET_TABLESPACE('', -2))
WHERE TBSP_USING_AUTO_STORAGE = 1
AND TBSP_CONTENT_TYPE IN ('USRTEMP','SYSTEMP')
AND STORAGE_GROUP_NAME = 'sg'
ORDER BY TBSP_ID