Nonstop Database, HiRDB Version 9 System Operation Guide

[Contents][Index][Back][Next]

13.13.2 Examples (in the case of storage condition specification)

This subsection describes how to change a table's partitioning storage conditions (in the case of storage condition specification).

You should always make a backup before you change a table's partitioning storage conditions.

Organization of this subsection
(1) Example 1 (splitting an RDAREA for which storage conditions with multiple values have been specified)
(2) Example 2 (adding partitioning storage conditions)
(3) Example 3 (splitting an RDAREA without deleting its data and using the pre-split RDAREA after splitting)
(4) Example 4 (changing the partitioning storage conditions and then combining RDAREAs)
(5) Example 5 (deleting partitioning storage conditions)
(6) Example 6 (performing split and combine operations consecutively)

(1) Example 1 (splitting an RDAREA for which storage conditions with multiple values have been specified)

This example changes the partitioning storage conditions and splits RDAREA R02 because it does not have sufficient free space.

[Figure]

Note: The numbers in the figure (1 through 3) correspond to the numbers in the following procedure:
  1. Use the database reorganization utility (pdrorg) to unload the table data from the RDAREA (R02) whose storage conditions are to be changed, and save it in a format that can be used as the input to the database load utility (pdload).
  2. Use ALTER TABLE to split the RDAREA. During this process, data in the split-target RDAREAs (R02 and RI02) is deleted.
  3. Perform data loading into the RDAREA (R02) using the addition mode of the database load utility (pdload). Perform this operation for each RDAREA using the unload data file created in step 1 as the input file.
    Because the unload data file contains data that does not match the split storage conditions, data error information is output. If you do not need the data error information, you can suppress its output by specifying divermsg=off in the option statement.
  4. Check the number of items of data after the data has been loaded. For details, see 13.13.9 Checking the number of items of data following splitting or combining.
  5. Use ALTER ROUTINE to re-create the routines and triggers that were disabled in step 2.

(2) Example 2 (adding partitioning storage conditions)

This example adds a partitioning storage condition for a table that uses the branch code as the partitioning key (the partitioning storage condition will be branch code '5').

Note: The numbers in the figure (1 through 3) correspond to the numbers in the following procedure:
  1. Use the database reorganization utility (pdrorg) to unload the table data from the RDAREA (R03) whose storage conditions are to be changed and save it in a format that can be used as the input to the database load utility (pdload).
  2. Use ALTER TABLE to split the RDAREA. During this process, data in the split-target RDAREAs (R03 and RI03) is deleted.
  3. Perform data loading into the RDAREAs (R03 and R04) using the addition mode of the database load utility (pdload). Perform this operation for each RDAREA using the unload data file created in step 1 as the input file.
    Because the unload data file contains data that does not match the split storage conditions, data error information is output. If you do not need the data error information, you can suppress its output by specifying divermsg=off in the option statement.
  4. Check the number of items of data after the data has been loaded. For details, see 13.13.9 Checking the number of items of data following splitting or combining.
  5. Use ALTER ROUTINE to re-create the routines and triggers that were disabled in step 2.

(3) Example 3 (splitting an RDAREA without deleting its data and using the pre-split RDAREA after splitting)

This example changes the partitioning storage conditions for a table that uses the branch code as the partitioning key. It performs the splitting operation as follows:

This example assumes that RDAREA R03 does not already contain data whose branch code is '5'.

[Figure]

Note: The numbers in the figure (1 and 2) correspond to the numbers in the following procedure:
  1. Make sure that the split-target table does not contain any data that matches the storage condition to be added (storage condition = '5').
    If the table contains data whose storage condition = '5', split it using the method described in 13.13.2(2) Example 2 (adding partitioning storage conditions). If you do not split the table with this method and the data that does not satisfy the storage condition remains after the splitting operation, you must recover the data using the method described in 13.13.10(2) Recovery procedure when data not satisfying the post-splitting storage condition remains.
  2. Use ALTER TABLE to split the RDAREA. In this case, specify WITHOUT PURGE.
  3. Use ALTER ROUTINE to re-create the routines and triggers that were disabled in step 2.

(4) Example 4 (changing the partitioning storage conditions and then combining RDAREAs)

This example combines into R02 the storage conditions that have been split into RDAREAs R02, R03, and R04.

[Figure]

Note: The numbers in the figure (1 through 3) correspond to the numbers in the following procedure:
  1. Use the database reorganization utility (pdrorg) to unload data from the RDAREAs (R03 and R04) in a format that can be used as the input to the database load utility (pdload).
  2. Use ALTER TABLE to combine the RDAREAs. In this case, specify WITHOUT PURGE because R02 will be used as is after the combine operation.
  3. Perform data loading into RDAREA R02 using the addition mode of the database load utility (pdload). Perform this operation for each RDAREA using the unload data file created in step 1 as the input file.
    Note that if data loading is performed in the creation mode, data is deleted from the pre-combination R02. If you have performed data loading in the creation mode by mistake, restore the data from a backup to its status immediately before execution of ALTER TABLE, and then perform the procedure again.
  4. Check the number of items of data after the data has been loaded. For details, see 13.13.9 Checking the number of items of data following splitting or combining.
  5. Use ALTER ROUTINE to re-create the routines and triggers that were disabled in step 2.

(5) Example 5 (deleting partitioning storage conditions)

This example combines into R03 the storage conditions that have been split into RDAREAs R03, R04, and R05, and then deletes the storage conditions for R03 and R04.

[Figure]

Note: The numbers in the figure (1 through 3) correspond to the numbers in the procedure below.
If you do not need the data in RDAREAs R03 and R04 whose storage conditions are to be deleted, you can skip steps 1 and 3 (unloading and data loading).
  1. Use the database reorganization utility (pdrorg) to unload data from RDAREAs R03 and R04 in a format that can be used as the input to the database load utility (pdload).
  2. Use ALTER TABLE to combine the RDAREAs.
  3. Perform data loading into RDAREA R05 using the addition mode of the database load utility (pdload). Perform this operation for each RDAREA using the unload data file created in step 1 as the input file.
  4. Check the number of items of data after the data has been loaded. For details, see 13.13.9 Checking the number of items of data following splitting or combining.
  5. Use ALTER ROUTINE to re-create the routines and triggers that were disabled in step 2.

(6) Example 6 (performing split and combine operations consecutively)

This example splits RDAREA R01 into R01 and R04 and then combines RDAREAs R02 and R04 into R02.

[Figure]

Note: The numbers in the figure (1 through 4) correspond to the numbers in the following procedure:
  1. Use the database reorganization utility (pdrorg) to unload data from RDAREA R01 in a format that can be used as the input to the database load utility (pdload).
  2. Use ALTER TABLE to split the RDAREA.
  3. Use ALTER TABLE to combine the RDAREAs.
  4. Perform data loading into RDAREAs R01 and R02 using the addition mode of the database load utility (pdload). Perform this operation for each RDAREA using the unload data file created in step 1 as the input file.
    Because the unload data file contains data that does not match the split storage conditions, data error information is output. If you do not need the data error information, you can suppress its output by specifying divermsg=off in the option statement.
  5. Check the number of items of data after the data has been loaded. For details, see 13.13.9 Checking the number of items of data following splitting or combining.
  6. Use ALTER ROUTINE to re-create the routines and triggers that were disabled in steps 2 and 3.
    Reference note
    Normally, it would be necessary to unload data from R02 and R04 before performing step 3. However, when two SQL statements are executed consecutively to perform split and combine operations, as in this example, unloading is not needed prior to step 3 because the unload data files created in step 1 can be used as input information for data loading in step 4.