The EXPORT_INDEX_STATS procedure retrieves statistics for a specified index and stores them in the statistics table.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
Syntax
DBMS_STATS.EXPORT_INDEX_STATS (
ownname VARCHAR2,
indname VARCHAR2,
partname VARCHAR2 DEFAULT NULL,
stattab VARCHAR2,
statid VARCHAR2 DEFAULT NULL,
statown VARCHAR2 DEFAULT NULL),
tabname VARCHAR2 DEFAULT NULL;
Parameters
| Parameter | Description |
|---|---|
| ownname | The username. If the username is set to NULL, the current login username will be used by default. |
| indname | The index name. |
| partname | The name of the index partition. If the index is partitioned and partname is NULL, global and partition statistics are exported. |
| stattab | The name of the user table where statistics are stored. |
| statown | The username of the user who owns the user table where statistics are stored. |
| tabname | The table name. |
Exceptions
The OBE-20000 error indicates that the object does not exist or the user does not have sufficient privileges.
Considerations
To call this procedure, you must be the owner of the table. For
SYS-owned objects, you must be the owner or have theSYSDBAprivilege.Statistics cannot be exported or imported between databases with different character sets.
Examples
Export statistics for the idx1 index of the tbl1 table for the testUser01 user to the test_stat table.
obclient> CALL DBMS_STATS.EXPORT_INDEX_STATS('testUser01', 'idx1',stattab=>'test_stat', tabname=>'tbl1');
Query OK, 0 rows affected
Note
In Oracle mode of OceanBase Database, you do not need to specify the tabname parameter because indexes are unique under the current user. However, in MySQL mode, you must explicitly specify the table name because indexes are not unique under the current user.
