The EXPORT_INDEX_STATS procedure retrieves statistics for the specified index and stores them in a statistics table.
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 logon 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. |
| statid | Note: The current version does not support this parameter. |
| statown | The username of the user statistics table for storing statistics. |
| tabname | The name of the table. |
Exceptions
The error code ORA-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. If the object is in the
systenant, you must be the owner of the table or have theSYSDBAprivilege.You cannot export or import statistics across databases that use different character sets.
Examples
Export the statistics on the idx1 index in 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 mode, you do not need to specify the tabname parameter because the index is unique under the current user. In MySQL mode, you must specify the table name because indexes are not unique under the current user.