The EXPORT_INDEX_STATS procedure retrieves the statistics of 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 | Username. If ownname is set to NULL, the username of the current logged-in user is used by default. |
| indname | Index name. |
| partname | Name of the index partition. If the index is partitioned and partname is NULL, the statistics of global and partition indexes are exported. |
| stattab | The name of the user table where the statistics are stored. |
| statown | The username of the user table where the statistics are stored. |
| tabname | Table name. |
Errors
The error code ORA-20000 indicates that the object does not exist or the user does not have sufficient privileges.
Considerations
You must own the table to call this procedure. You can also call this procedure for a table owned by the
SYSuser if you have theSYSDBAprivilege.You cannot export statistics from a database with one character set to a database with another character set.
Examples
Export the statistics of 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 the Oracle mode of OceanBase Database, you do not need to specify the tabname parameter, because indexes of the current user are unique. In the MySQL mode, you must explicitly specify the table name, because indexes of the current user can be non-unique.