Hitachi

Hitachi Advanced Database Command Reference


16.2.1 Explanation of the specification format and options

Organization of this subsection

(1) Specification format

adbidxrebuild
  -u authorization-identifier
  [-p password]
  [-g output-interval-for-index-rebuild-processing-progress-message]
  [-w {temporary-work-file-storage-directory-name
       |name-of-directory-path-file-specifying-temporary-work-file-storage-locations}]
  [-z index-rebuild-option-file-name]
  [-i index-identifier-file-name]
  [{--create-temp-file|--force}]
  table-to-be-processed
Important

You must specify the table to be processed as the last option that is specified.

(2) Explanation of options

-u authorization-identifier

~<character string>((1 to 100 bytes))

Specifies the authorization identifier of the HADB user who executes the adbidxrebuild command. You must have the following two privileges to execute the adbidxrebuild command:

  • CONNECT privilege

  • REBUILD INDEX privilege for the table to be processed

For this option, specify an authorization identifier in the range from 1 to 100 bytes. Note that the byte count (1 to 100 bytes) does not include the double quotation marks used to enclose the authorization identifier.

Important

If the character string used as the authorization identifier includes any lowercase letter or a backslash (\), make sure that you check the rules for specifying authorization identifiers. For the rules for specifying authorization identifiers, see 1.4.2 Rules for specifying authorization identifiers and passwords.

Important

The authorization identifier specified in the -u option must not be changed while you are using the re-execute facility provided by the adbidxrebuild command. Do not delete a user who is executing the adbidxrebuild command or revoke the REBUILD INDEX privilege while indexes are being rebuilt.

If you have made a mistake, take one of the following steps:

  • As the same user, make the adbidxrebuild command executable, and then re-execute this command. For details about the corrective action to take, see the topic Managing HADB users or Managing access privileges in Unscheduled Operations in the HADB Setup and Operation Guide.

  • As a different user who has REBUILD INDEX privileges for the table to be processed, execute the adbidxrebuild command with the --force option specified. Note that the re-execute facility of the adbidxrebuild command is not applied in this case.

-p password

~<character string>((1 to 255 bytes))

Specifies the password for the authorization identifier that is specified in the -u option.

Important

If the password includes a character that has a special meaning in the OS or shell, such as a double quotation mark (") or vertical bar (|), make sure that you check the rules for specifying passwords. For the rules for specifying passwords, see 1.4.2 Rules for specifying authorization identifiers and passwords.

If the adbidxrebuild command is executed with this option omitted, a message prompting the user to enter a password is displayed. In an environment in which a password cannot be entered from the standard input, such as when the command is executed in the background, make sure that you do not omit this option.

-g output-interval-for-index-rebuild-processing-progress-message

~<integer>((0 to 1,000,000,000))<<0>>(in 1,000 rows)

Specifies the interval (in units of 1,000 rows) at which the index rebuild processing progress message is to be output. For example, if 2 is specified in this option, the KFAA80205-I progress message is output each time 2,000 rows of table data have been retrieved.

If this option is omitted or 0 is specified in this option, no progress message is output.

-w {temporary-work-file-storage-directory-name | name-of-directory-path-file-specifying-temporary-work-file-storage-locations}

~<OS path name>((2 to 518 bytes))

Specifies a storage location for the temporary work files that are created during index rebuild processing, expressed as either of the following:

  1. Absolute path name of the directory that stores temporary work files

  2. Absolute path name of a file (directory path file) that specifies directories for storing temporary work files

If frequent input/output operations are performed on the temporary work files stored under a single directory, performance might be adversely affected. We recommend that you use method 2 and store temporary work files in directories on multiple disks to distribute the workload of input/output operations on the disk. The following shows an example specification using method 2 (specifying a directory path file).

Example of directory path file

/mnt/diska/wwwww
/mnt/diskb/xxxxx
/mnt/diskc/yyyyy
/mnt/diskd/zzzzz

The following is a guideline for the number of directories to be specified:

Guideline-for-number-of-directories-to-be-specified = A × B

A: Maximum number of scan processing threads

Use the following formula to determine the value:

↓ (Value of the index rebuild option adb_idxrebuild_rthd_num - 1) ÷ 2↓

B: Number of B-tree and text indexes to be rebuilt

If you do not know the number of B-tree and text indexes, check the number of B-tree and text indexes that are defined for the table in the following SQL statement:

SELECT "N_INDEX"-"N_RANGE_INDEX"
    FROM "MASTER"."SQL_TABLES"
        WHERE "TABLE_SCHEMA"='authorization-identifier'
           AND "TABLE_NAME"='name-of-table-to-be-processed'
  • A maximum of 255 directories can be specified in a directory path file.

  • The directories specified in the directory path file are used as the storage locations of temporary work files in the order specified. When the last directory specified in the directory path file is used (in this example, /mnt/diskd/zzzzz), the first directory (in this example, /mnt/diska/wwwww) is then used again.

The following specification rules apply to this option (for both methods 1 and 2):

  • Do not specify a forward slash (/) at the end of a path name.

For details about how to estimate the sizes of the temporary work files that will be created under the directories specified in the -w option, see Estimating the size of the temporary work file for executing the adbidxrebuild command in the HADB Setup and Operation Guide. If this option is omitted, temporary work files are created under $DBDIR/ADBWORK.

It is advisable to provide a dedicated directory to store temporary work files. If a directory storing other files is used for temporary work files, data in the existing files might be corrupted. Also make sure that symbolic links and relative paths are specified correctly. For details about the files whose names must differ from the temporary work file storage directory name, see 16.6 Notes.

If the disk that stores temporary work files runs out of free space, specify as the storage destination another disk with a larger capacity. For details about the actions to take if the disk that stores temporary work files runs out of free space, see Steps to take in the event of a shortage of disk space for storing temporary work files during command execution in Command-related problems in Troubleshooting in the HADB Setup and Operation Guide.

-z index-rebuild-option-file-name

~<OS path name>((2 to 510 bytes))

Specifies the absolute path name of the index rebuild option file that contains the index rebuild options. If this option is omitted, all index rebuild options are set to their default values because no index rebuild option file is specified.

For details about the index rebuild option, see 16.2.2 Format of index rebuild options.

Make sure that the index rebuild option file name is unique from all other file names. If the index rebuild option file has the same name as another file, data in the file might become corrupted. For details about the files whose names must differ from the index rebuild option file name, see 16.6 Notes.

-i index-identifier-file-name

~<OS path name>((2 to 510 bytes))

Specifies the absolute path name of a file containing the identifiers of the indexes that are to be subject to index rebuild processing. All indexes specified in the index identifier file will be rebuilt regardless of their status.

If this option is omitted, only indexes in unfinished status that are defined for the table to be processed will be rebuilt.

After the cancelation of the adbimport command, if you use the adbidxrebuild command to inherit index creation processing, all indexes that are defined for the table to be processed are rebuilt.

The following shows a specification example of an index identifier file.

Example of the adbidxrebuild command

adbidxrebuild -u ADBUSER01 -i /home/adbmanager/rebuild_file/table01_idx.txt TABLE01

Specification example of an index identifier file (/home/adbmanager/rebuild_file/table01_idx.txt)

INDEX02
INDEX03

This example specifies as a command option an index identifier file containing the identifiers of two indexes that are to be subject to index rebuild processing. When the adbidxrebuild command is executed, INDEX02 and INDEX03 will be rebuilt.

The following are the rules for specifying an index identifier file:

  • An index that is not defined for the table to be processed cannot be specified in the file.

  • The same index identifier cannot be specified more than once.

  • If an index identifier contains a lowercase letter, enclose the entire index identifier in double quotation marks ("). If an index identifier is not enclosed in double quotation marks ("), it is treated as being in all uppercase letters.

  • To rebuild a B-tree index that corresponds to a primary key, specify the index identifier (same as the constraint name) that has been generated automatically. For details about how to check the index identifiers of the B-tree indexes that correspond to primary keys, see Searching a dictionary table in the HADB Setup and Operation Guide.

  • Null rows in an index identifier file are ignored. If the specified index identifier file is empty, the adbidxrebuild command will result in an error.

--create-temp-file

Normally, omit this option.

Specify this option if the message KFAA50247-E is issued when the adbimport or adbidxrebuild command is re-executed. The adbidxrebuild command is executed from the point of data retrieval for the table for which temporary work files will be created. After the adbimport command is canceled, if the adbidxrebuild command is executed with this option specified, it can inherit index creation processing from the adbimport command.

For an overview of the process of inheriting index creation processing from the adbimport command, see (2) Inheriting index creation processing from the adbimport command in 16.1.3 Optional functions of the adbidxrebuild command. In this case, careful consideration is necessary when specifying command options and index rebuild options. For details, see (1) Executing the adbidxrebuild command with the --create-temp-file option specified in 17.10.7 If an error occurs during re-execution of the adbimport command.

Important
  • If the table to be processed is not non-updatable, you cannot specify this option (the KFAA50248-E message is output to the message log file).

  • It is assumed that this option will be specified if the temporary work file necessary for re-execution does not exist (index record file or sort result file). If the adbidxrebuild command is executed when a temporary work file exists, the existing file is re-built. However, if you do not have write or read privileges for the applicable file, an access error might occur during execution of the adbidxrebuild command. (The KFAA30959-E, KFAA40204-E, KFAA40205-E, KFAA40214-E, KFAA41205-E, or KFAA41206-I message is issued. 13 (EACCES) is output for the error number.) In such a case, first delete the applicable file using the OS's rm command or a similar method, and then re-execute the adbidxrebuild command.

If you execute the adbidxrebuild command without specifying this option, index rebuild processing is executed from the point at which the content integrity was guaranteed during the previous index rebuild processing.

By contrast, if you execute the adbidxrebuild command with this option specified, index rebuild processing is executed from the point of data retrieval for the table for which temporary work files will be created. If a range index has been built, it is re-built during table data retrieval.

--force

Normally, omit this option.

In the following cases, execute the adbidxrebuild command with this option specified. Index rebuild processing is forcibly executed from the beginning.

  • If the KFAA50244-E message is issued during re-execution of the adbimport or adbidxrebuild command:

    - The command status files necessary for re-execution (files under the $DBDIR/ADBSYS/ADBUTL directory) do not exist.

    - The HADB server has been upgraded from version 04-00 or earlier without releasing tables from non-updatable status.

  • An index was defined for the table to be processed while the adbimport command was stopped, and the KFAA50209-E message was issued during re-execution of the adbimport command (an index in unfinished status exists).

After the adbimport command is canceled, if you execute the adbidxrebuild command with this option specified, you can inherit index creation processing from the adbimport command.

Before executing the adbidxrebuild command with this option specified, delete the files (temporary work files) under the directories listed below using the OS's rm command or a similar method. If there are any files for which you do not have write or read privileges, you might not be able to execute the adbidxrebuild command.

  • If the -w option was specified during execution of the previous command that was canceled:

    The temporary work file storage directory specified in the -w option

  • If the -w option was omitted during execution of the previous command that was canceled:

    The $DBDIR/ADBWORK directory

For an overview of the process of inheriting index creation processing from the adbimport command, see (2) Inheriting index creation processing from the adbimport command in 16.1.3 Optional functions of the adbidxrebuild command. In this case, careful consideration is necessary when specifying command options and index rebuild options. For details, see (2) Executing the adbidxrebuild command with the --force option specified in 17.10.7 If an error occurs during re-execution of the adbimport command.

If you execute the adbidxrebuild command without specifying this option, index rebuild processing is executed from the point at which the content integrity was guaranteed during the previous index rebuild processing.

When the adbidxrebuild command is executed with this option specified, the command restarts index rebuild processing from the beginning.

table-to-be-processed

Specifies the table for which the index to be rebuilt is defined.

The following rules apply to specifying this option:

  • Specify in the format schema-name.table-identifier.

    If the user owns the table, the schema name can be omitted. If another HADB user owns this table, the schema name must be specified.

  • For details about the specification rules that apply when a schema name or table identifier includes any lowercase letter or backslash (\), see 1.4.3 Table name specification rules.

  • The user can specify only a table for which the user has the REBUILD INDEX privilege.

  • A viewed table cannot be specified.