11.4.21 Changing an archivable multi-chunk table to a regular multi-chunk table
To change an archivable multi-chunk table to a regular multi-chunk table, execute the ALTER TABLE statement.
- Important
-
If archived chunks exist in an archivable multi-chunk table, you cannot change the archivable multi-chunk table to a regular multi-chunk table. You need to release the chunks from archived state.
If archived deletion-pending chunks exist in the archivable multi-chunk table, you cannot release the chunks from archived state by using the adbunarchivechunk command. You need to execute the PURGE CHUNK statement to delete the relevant chunks.
Procedure:
-
Check whether there are viewed tables that are to be invalidated.
If you change an archivable multi-chunk table to a regular multi-chunk table, the viewed tables that depend on the target table are invalidated. Therefore, before you change an archivable multi-chunk table to a regular multi-chunk table, check whether there are viewed tables that are to be invalidated. To check viewed tables that are to be invalidated (dependent viewed tables), see 11.2.11 Checking dependent viewed tables.
If there are viewed tables that are to be invalidated, after changing an archivable multi-chunk table to a regular multi-chunk table, you need to release the viewed tables from invalidation.
-
Check whether there are archived chunks and archived, deletion-pending chunks.
Execute the adbdbstatus command to output the table summary information of the archivable multi-chunk table. Then, check the following items (starting with the value for Archive_chunks).
-
Archive_chunks (Number of archived chunks)
If the value for Archive_chunks is 0, go to step 3. If the value is 1 or larger, one or more archived chunks exist. Execute the adbunarchivechunk command to release all chunks from archived state.
Then, re-execute the adbdbstatus command, and confirm that the value for Archive_chunks is 0. If the value is not 0, check the following Pending_delete_chunks:
-
Pending_delete_chunks (Number of deletion-pending chunks in the table)
If the value for Pending_delete_chunks is 1 or larger and the value for Archive_chunks is 1 or larger, one or more archived, deletion-pending chunks exist. In this case, execute the PURGE CHUNK statement to delete all archived, deletion-pending chunks.
If an archived chunk or an archived, deletion-pending chunk exists, you cannot change the archivable multi-chunk table to a regular multi-chunk table.
- Note
-
-
For details about the adbdbstatus command, see adbdbstatus (Analyze the Database Status) in the manual HADB Command Reference.
-
For details about the adbunarchivechunk command, see adbunarchivechunk (Unarchive Chunk) in the manual HADB Command Reference.
-
For details about the PURGE CHUNK statement, see PURGE CHUNK (delete all rows in a chunk) in the manual HADB Command Reference.
-
-
-
Change an archivable multi-chunk table to a regular multi-chunk table.
Execute the ALTER TABLE statement to change the archivable multi-chunk table to a regular multi-chunk table.
- Note
-
For details about the ALTER TABLE statement, see ALTER TABLE (alter table definition) in the manual HADB SQL Reference.
-
Release viewed tables from invalidation.
If there are viewed tables that depend on the target table, release the viewed tables from invalidation. For details about how to release a viewed table from invalid status, see (1) When viewed tables are invalidated by using an ALTER TABLE statement to change the table type in 11.2.8 Releasing a viewed table from invalidation.
Now, change of the archivable multi-chunk table to a regular multi-chunk table is completed.
Note that the range index automatically defined for the archive range column of the archivable multi-chunk table cannot be deleted after the table is changed to a regular multi-chunk table. If you do not need the range index, execute the DROP INDEX statement to delete the index. To delete a range index, see 11.3.9 Deleting an index.
- Important
-
Do not execute the ALTER TABLE statement when the adbunarchivechunk command has been interrupted. If you execute the ALTER TABLE statement, you need to change the regular multi-chunk table back to an archivable multi-chunk table. Then, you need to release the state of the adbunarchivechunk command being interrupted. The following shows the procedure.
-
Execute the ALTER TABLE statement to change the regular multi-chunk table back to an archivable multi-chunk table.
-
For the archivable multi-chunk table you changed back in step 1, execute the adbunarchivechunk command with the --force option specified. You can release the state of the adbunarchivechunk command being interrupted. If the KFAA50284-E message is output and the adbunarchivechunk command results in an error, the state of the adbunarchivechunk command being interrupted is released.
-
Execute the ALTER TABLE statement to change the archivable multi-chunk table you changed back in step 1 to a regular multi-chunk table.
-