The EXPORT_INDEX_STATS procedure retrieves statistics for a specified index and stores them in the statistics table.
Syntax
DBMS_STATS.EXPORT_INDEX_STATS (
ownname VARCHAR2,
indname VARCHAR2,
partname VARCHAR2 DEFAULT NULL,
stattab VARCHAR2,
statown VARCHAR2 DEFAULT NULL),
tabname VARCHAR2 DEFAULT NULL;
Parameters
| Parameter | Description |
|---|---|
| ownname | The username. If the username is set to NULL, the current logged-in username is used by default. |
| indname | The index name. |
| partname | The name of the index partition. If the index is partitioned and partname is NULL, the global and partition index statistics are exported. |
| stattab | The name of the user table where the statistics are stored. |
| statown | The username of the user who owns the statistics user table. |
| tabname | The table name. |
Exceptions
The error code HY000 indicates that the object does not exist or that the user does not have sufficient privileges.
Considerations
To call this procedure, you must be the owner of the table. For objects owned by
SYS, you must be the owner of the table or have theSYSDBAprivilege.Statistics cannot be exported or imported between databases with different character sets.
Examples
Export the statistics for the idx1 index of the tbl1 table owned by 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 OceanBase Database in Oracle mode, you do not need to specify the tabname parameter 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.
