The am_check purpose function
If a user executes the oncheck utility for a virtual index, the database server calls am_check.
Syntax
mi_integer am_check(MI_AM_TABLE_DESC *tableDesc,
mi_integer option)
- tableDesc
- Points to the table descriptor of the index that the current oncheck command specifies.
- option
- Contains an encoded version of the current command-line option string for the oncheck utility.
Usage
A user, generally a system administrator or operator, runs the oncheck utility to verify physical data structures. The options that follow the oncheck command indicate the kind of checking to perform. The additional -y or -n option specifies that the user wants oncheck to repair any damage to an index. For
In response to an oncheck command, the database server calls the am_check purpose function, which checks the internal consistency of the index and returns a success or failure indicator. If appropriate, am_check can call the am_open and am_close purpose functions.
Interpreting options
Macro | Option | oncheck action |
---|---|---|
MI_CHECK_DATA() MI_DISPLAY_DATA() | -cd -pd | Checks and displays data rows, but not simple or smart large objects |
MI_CHECK_DATA_BLOBS() MI_DISPLAY_DATA_BLOBS() | -cD -pD | Checks and displays data rows, simple large objects, and smart-large-object metadata |
MI_CHECK_EXTENTS() MI_DISPLAY_EXTENTS() | -ce -pe | Checks and displays chunks and extents, including sbspaces |
MI_DISPLAY_TPAGES() | -pp | Checks and displays pages by table or fragment |
MI_DISPLAY_CPAGES() | -pP | Checks and displays pages by chunk |
MI_DISPLAY_SPACE() | -pt | Checks and displays space usage |
MI_CHECK_IDXKEYS() MI_DISPLAY_IDXKEYS() | -ci -pk | Check and display index key values |
MI_CHECK_IDXKEYS_ROWIDS() MI_DISPLAY_IDXKEYS_ROWIDS() | -cI -pK | Check and display index keys and rowids |
MI_DISPLAY_IDXKEYLEAVES() | -pl | Check and display leaf key values |
MI_DISPLAY_IDXKEYLEAVES_ROWIDS() | -pL | Check and display leaf key values and row identifiers |
MI_DISPLAY_IDXSPACE() | -pT | Check and display index space usage |
MI_CHECK_NO_TO_ALL | -n | Do not attempt to repair inconsistencies |
MI_CHECK_YES_TO_ALL | -y | Automatically repair an index |
if (MI_CHECK_EXTENTS(option) == MI_TRUE)
{
/* Check rows and smart-large-object metadata
* If problem exists, issue message. */
}
Check and display table state
The access method can call accessor function mi_tab_spacetype() to determine whether the specified index is in an sbspace or extspace. If the data is in an sbspace, the am_check purpose function can duplicate the expected behavior of the oncheck utility.
For an extspace, such as a file that the operating system manages, am_check performs tasks that correspond to the command-line option.
To provide detailed information about the state of the index, am_check can call the mi_tab_check_msg() function.
Handling index problems
Option | Meaning | Macro |
---|---|---|
-y | Automatically repair any problem. | MI_CHECK_YES_TO_ALL |
-n | Do not repair any problem. | MI_CHECK_NO_TO_ALL |
Return values
- MI_OK
- Validates the table structure as error free.
- MI_ERROR
- Indicates the access method could not validate the table structure as error free.