The EXPORT_INDEX_STATS procedure is used to retrieve the statistics of a specified index and store them in the 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 | Username. If you set ownname to NULL, the username that is currently logged in will be used by default. |
| indname | Index name. |
| partname | Partition name of the index. If the index is partitioned and you set partname to NULL, the statistics of global and partition indexes will be exported. |
| stattab | Name of the table that stores the statistics. |
| statown | Username of the table that stores the statistics. |
| tabname | Table name. |
Errors
The error code ORA-20000 indicates that the object does not exist or you do not have sufficient privileges.
Considerations
You must own the table to call this procedure. You can own the table yourself or have the
SYSDBAprivilege to call this procedure on a table owned by theSYSuser.You cannot export statistics from a database with one character set to a database with another character set.
Example
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 specify the table name explicitly because indexes of the current user can be non-unique.