Hitachi

Hitachi Advanced Database Setup and Operation Guide


11.1.14 Changing the data DB area that stores a base table

To change the data DB area that stores a base table to another data DB area, you must first delete the base table, and then redefine the base table.

Note

For details about how to change the data DB area that stores indexes to another data DB area, see 11.3.8 Changing the data DB area that stores indexes.

By using the procedure shown later, change the data DB area that stores a base table to another data DB area.

You might also want to add a new data DB area. For details, see 11.10.1 Adding data DB areas. After seeing the topic and taking action, change the data DB area that stores a base table.

Procedure

  1. Output all data that is stored in the base table.

    Use the adbexport command to output all data that is stored in the base table to a file.

    If the base table is a multi-chunk table, note the following points when executing the adbexport command:

    • If the status and configuration of the chunks in the multi-chunk table do not need to be retained

      No notes apply. Output all data that is stored in the base table to a file.

    • If the status and configuration of the chunks in the multi-chunk table need to be retained

      You must output all data from the base table to a file in units of chunks. Unless you output data in units of chunks, the status and configuration of the chunks will not be retained in the base table that will store the data. Therefore, you must perform an export for each chunk.

      For details about outputting data for each chunk, see 11.4.5 Exporting data in units of chunks.

  2. Check the definition information of the base table.

    Check the specification content of the CREATE TABLE statement that was used to define the base table. You will use the specification content when you define a base table in another data DB area.

    If you are not sure of the specification content of the CREATE TABLE statement that was used to define the base table, see (28) Finding out base table definition information in B.22 Searching a dictionary table. By searching the dictionary table, you can check the specification content of the CREATE TABLE statement that was used to define the base table.

  3. Check the definition information of the indexes defined for the base table.

    If indexes have been defined for the base table, check the specification content of the CREATE INDEX statement that was used to define the indexes. You will use the specification content when you define indexes for a base table defined in another data DB area.

    If you are not sure of the specification content of the CREATE INDEX statement that was used to define the indexes, see (29) Finding out index definition information in B.22 Searching a dictionary table. By retrieving data from a dictionary table, you can check the specification content of the CREATE INDEX statement that was used to define the indexes.

  4. Delete the base table.

    Use the DROP TABLE statement without specifying drop-behavior to delete the base table.

  5. Redefine a base table.

    Use the CREATE TABLE statement to define a base table in another data DB area. Note the following points when you create a CREATE TABLE statement:

    • Create a CREATE TABLE statement with the specification content of the CREATE TABLE statement that was used to define the base table (the specification content you checked in step 2).

    • Specify the DB area name of another data DB area that will store the base table for IN DB-area-name in the CREATE TABLE statement.

  6. Define indexes for the base table.

    If the base table that you deleted had indexes defined, use the CREATE INDEX statement to define indexes for the redefined base table. Note the following points when you create a CREATE INDEX statement:

    • Create a CREATE INDEX statement with the specification content of the CREATE INDEX statement that was used to define the indexes (the specification content you checked in step 3).

  7. Store data in the base table.

    Use the adbimport command to store all of the data that was output in step 1 to the base table defined in step 5.

    If the base table is a multi-chunk table, note the following points when executing the adbimport command:

    • If the status and configuration of the chunks in the multi-chunk table do not need to be retained

      Do not specify the -d or -b option for the adbimport command.

    • If the status and configuration of the chunks in the multi-chunk table need to be retained

      You must import for each chunk the data that was output in units of chunks in step 1.

      When you perform the first data import, execute the adbimport command without specifying the -d or -b option.

      When you perform the second and following data imports, use the background import method. Execute the adbimport command by specifying the -b option.

      When you perform the last data import, import the data stored in the chunk that was the current chunk in step 1 by using the background import method. Execute the adbimport command by specifying the -b option.

  8. Re-validate viewed tables.

    The viewed tables whose underlying table is the base table that was deleted in step 4 are invalidated. Therefore, after defining a base table, you must re-validate the viewed tables. When you re-validate the viewed tables, see (4) When viewed tables are invalidated due to erroneous deletion of a table in 11.2.8 Releasing a viewed table from invalidation.

The procedure for changing a data DB area that stores a base table to another data DB area is complete.

Note
  • For details about the adbexport and adbimport commands, see the manual HADB Command Reference.

  • For details about the DROP TABLE, CREATE TABLE, and CREATE INDEX statements, see the manual HADB SQL Reference.