The IMPORT_INDEX_STATS procedure retrieves the statistics of a specified index from the user statistics table and stores them in the dictionary.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
Syntax
DBMS_STATS.IMPORT_INDEX_STATS (
ownname VARCHAR2,
indname VARCHAR2,
partname VARCHAR2 DEFAULT NULL,
stattab VARCHAR2,
statown VARCHAR2 DEFAULT NULL,
no_invalidate BOOLEAN DEFAULT FALSE,
force BOOLEAN DEFAULT FALSE,
tabname VARCHAR2 DEFAULT NULL);
Parameters
| Parameter | Description |
|---|---|
| ownname | The username. If the username is set to NULL, the current login username is used by default. |
| tabname | The table name. |
| indname | The index name. |
| partname | The partition name. If the table is partitioned and partname is NULL, global and partition column statistics are imported. |
| stattab | The name of the user statistics table to import. |
| statown | The username of the user statistics table to import. |
| no_invalidate | Specifies whether to invalidate the plan cache when collecting statistics. If set to TRUE, the plan cache is not invalidated when collecting statistics. |
| force | Specifies whether to forcibly import statistics and ignore the lock status. The default value is FALSE. If set to TRUE, statistics are imported even if the index statistics are locked. |
Exceptions
| Error Code | Description |
|---|---|
| OBE-20000 | The object does not exist or the user does not have sufficient privileges. |
| OBE-20001 | The values in the user statistics table are invalid or inconsistent. |
| OBE-20005 | The statistics of the object are locked. |
Considerations
You cannot export or import statistics between databases of different character sets.
Examples
Import the statistics of the idx1 index of the tbl1 table for the testUser01 user from the test_stat table and store them in the dictionary.
obclient> CALL DBMS_STATS.IMPORT_INDEX_STATS('testUser01', 'idx1',stattab=>'test_stat', 'tbl1');
Query OK, 0 rows affected
Note
In Oracle mode of OceanBase Database, you do not need to specify tabname because the index is unique for the current user. However, in MySQL mode, you must explicitly specify the table name because the index is not unique for the current user.
