Hitachi

Hitachi Advanced Database Setup and Operation Guide


15.8.1 Steps to take when a base table becomes non-updatable

If one of the following commands is interrupted, the base table on which processing is being performed might become non-updatable due to inconsistencies between table information and index information. This is called a non-updatable base table.

■ Target commands
  • adbimport command

  • adbidxrebuild command

  • adbunarchivechunk command

An error occurs if you perform the following operations on a non-updatable base table.

■ Operations that will cause an error
  • Executing the ALTER TABLE statement

  • Executing the CREATE INDEX statement

  • Executing the INSERT statement

  • Executing the UPDATE statement

  • Executing the DELETE statement

  • Executing the PURGE CHUNK statement

  • Executing the adbmergechunk command

  • Executing the adbchgchunkstatus command

  • Executing the adbchgchunkcomment command

  • Executing the adbimport command#1

  • Executing the adbidxrebuild command#1

  • Executing the adbarchivechunk command

  • Executing the adbunarchivechunk command#2

#1

If the adbunarchivechunk command is interrupted and the base table becomes non-updatable, an error occurs. If the adbimport or adbidxrebuild command is interrupted and the base table becomes non-updatable, an error does not occur.

#2

If the adbimport or adbidxrebuild command is interrupted and the base table becomes non-updatable, an error occurs. If the adbunarchivechunk command is interrupted and the base table becomes non-updatable, an error does not occur.

Note

The TRUNCATE TABLE statement can be executed. Because this statement deletes all row data from a base table, the base table is released from non-updatable status.

Organization of this subsection

(1) Releasing a base table from non-updatable status

The following describes how to release a base table from non-updatable status.

Procedure:

  1. Check whether the base table in question is non-updatable.

    You can use the adbdbstatus command to check whether the base table is non-updatable. See 10.9.2 Checking the status and usage of a base table.

    If the base table is non-updatable, proceed to step 2.

  2. Release the base table from non-updatable status.

    Execute the interrupted command.

    • If the adbimport command was interrupted

      Re-execute the adbimport command. For details, see Handling abnormal termination of the adbimport command in adbimport (Import Data) in the manual HADB Command Reference.

    • If the adbidxrebuild command was interrupted

      Re-execute the adbidxrebuild command. For details, see Handling abnormal termination of the adbidxrebuild command in adbidxrebuild (Rebuild Indexes) in the manual HADB Command Reference.

    • If the adbunarchivechunk command was interrupted

      Re-execute the adbunarchivechunk command. For details, see Handling abnormal termination of the adbunarchivechunk command in adbunarchivechunk (Unarchive Chunk) in the manual HADB Command Reference.

    When the re-executed command terminates normally, the inconsistencies between the table information and the index information will be resolved and the base table will be released from non-updatable status.

    If an error occurs during re-execution of a command, see (2) Steps to take if an error occurs during re-execution of a command.

(2) Steps to take if an error occurs during re-execution of a command

During re-execution of a command, an error might occur due to any of the following causes. Take the corrective action appropriate to the cause.

■ Causes of errors that can occur during command re-execution

■ Action 1

Check whether either of the following messages has been output to the message log file:

The corrective action you must take varies depending on whether the preceding messages are output. If a message other than the preceding one is output, take corrective action according to the output message. When the corrective action is completed, the base table will be released from non-updatable status.

■ Action 2

The following messages have been output to the message log file:

Expand the data DB area, and then re-execute the command. For details about how to expand a data DB area, see 11.10.3 Expanding a data DB area (adding a data DB area file).

If you cannot expand the data DB area, secure free space in the data DB area, and then re-execute the command. For details about how to secure free space in a data DB area, see 11.10.6 Securing free space in a data DB area.

If you cannot also secure free space in the data DB area, use the following procedure to release the base table from the non-updatable status. Note that in the following procedure, before releasing the base table from the non-updatable status, you temporarily delete indexes to secure the amount of free space in the data DB area. Then, after releasing the base table from the non-updatable status, you redefine and rebuild the indexes. Therefore, free space for re-creating the indexes is required in the data DB area. Because free space is required to rebuild the indexes, check whether you can secure sufficient free space for rebuilding the indexes beforehand. After that, release the base table from the non-updatable status. For details about how to secure free space in a data DB area, see 11.10.6 Securing free space in a data DB area. If you cannot secure the free space necessary to rebuild the indexes, try expanding the data DB area again.

Procedure

  1. Determine the indexes to be deleted.

    Of the indexes stored in the data DB area that has insufficient free space (and which are defined for the base table you want to release from non-updatable status), determine the ones to delete temporarily.

  2. Obtain the definition information of the indexes.

    Because you must be able to rebuild indexes with the same definition information as the indexes you will temporarily delete (indexes determined in step 1), obtain the necessary definition information beforehand.

    For details about how to obtain index definition information, see (29) Finding out index definition information in B.22 Searching a dictionary table.

  3. Delete the indexes.

    Temporarily delete the indexes determined in step 1.

    For details about how to delete indexes, see 11.3.9 Deleting an index.

  4. Re-execute the command that was interrupted previously.

    Re-execute the previously interrupted command for the base table to be released from the non-updatable status. If the command terminates normally, the base table is released from the non-updatable status.

    For details about how to check the interrupted commands, see (1) Checking whether a base table is non-updatable in 10.9.2 Checking the status and usage of a base table.

    If an error occurs during command execution, proceed to step 5. If the command terminates normally, proceed to step 6.

  5. Take measures for the command that failed in step 4.

    • If the cause of the error is insufficient free space in the data DB area

      You need also to delete other indexes to secure free space in the data DB area. Repeat the procedure from step 1 for other indexes.

    • If the cause of the error is not insufficient free space in the data DB area

      Check the error message that has been output, and eliminate the cause of the error. Then, re-execute the command.

      If the command terminates normally, the base table is released from the non-updatable status. If the command terminates normally, proceed to step 6.

  6. Secure free space in the data DB area so that indexes can be rebuilt.

    Before you can rebuild indexes, secure free space in the data DB area that stored the indexes that were deleted in step 3.

    For details about how to secure free space, see 11.10.6 Securing free space in a data DB area.

  7. Redefine indexes.

    Redefine the deleted indexes based on the definition information that was obtained in step 2.

  8. Rebuild indexes.

    Rebuild the indexes that were redefined in step 7. For details about how to rebuild indexes, see one of the following subsections:

(3) When a non-updatable base table is searched

You can use the SELECT statement to search a non-updatable base table. Note, however, that the search result differs depending on the interrupted command.

▪ In the case of the adbimport command

The search result depends on whether the -d option was specified during execution of the adbimport command.

If the -d option is omitted

The same results are returned as when the search is performed on the base table prior to execution of the adbimport command.

If the -d option is specified

The retrieval results are 0 for both a SELECT statement that does not use indexes and a SELECT statement that uses range indexes.

A SELECT statement that uses B-tree indexes or text indexes results in an error.

▪ In the case of the adbidxrebuild command

If you execute a SELECT statement that uses B-tree indexes, text indexes, or range indexes whose rebuild processing has not been completed, an error occurs because the indexes are in unfinished status.

▪ In the case of the adbunarchivechunk command

The same results are returned as when the search is performed on the base table prior to execution of the adbunarchivechunk command.