The EXPORT_INDEX_STATS procedure retrieves statistics on the specified index and stores them in a statistics table.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
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 parameter is set to NULL, the current login username is used by default. |
| indname | The name of the index. |
| partname | The name of the index partition. If the index is partitioned and partname is NULL, global statistics and partition index statistics are exported. |
| stattab | The name of the user statistics table for storing statistics. |
| statown | The username of the user statistics table for storing statistics. |
| tabname | The name of the table. |
Exceptions
The error code OBE-20000 indicates that the object does not exist, or you do not have the required privileges.
Considerations
To call this procedure, you must be the owner of the table. To call this procedure on a table object owned by the
SYSuser, you must be the table owner or have theSYSDBAprivilege.You cannot export or import statistics across databases that use different character sets.
Examples
Export the statistics on the idx1 index of the tbl1 table of 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-compatible mode, you do not need to specify the tabname parameter because the index is unique under the current user. In MySQL mode, you must explicitly specify the table name because indexes are not unique under the current user.