The EXPORT_TABLE_STATS procedure exports table-level statistics.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
Syntax
DBMS_STATS.EXPORT_TABLE_STATS (
ownname VARCHAR2,
tabname VARCHAR2,
partname VARCHAR2 DEFAULT NULL,
stattab VARCHAR2,
statid VARCHAR2 DEFAULT NULL,
cascade BOOLEAN DEFAULT TRUE,
statown VARCHAR2 DEFAULT NULL,
stat_category VARCHAR2 DEFAULT DEFAULT_STAT_CATEGORY);
Parameters
| Parameter | Description |
|---|---|
| ownname | The username. If the username is set to NULL, the current logon username is used by default. |
| tabname | The name of the table. |
| partname | The name of the table partition. If the table is partitioned and partname is NULL, global statistics and partition column statistics are exported. |
| stattab | The name of the user table for storing statistics. |
| statid | Note The current version does not support this parameter. |
| cascade | Specifies whether to export column-level statistics. Default value: TRUE |
| statown | The username of the user table for storing statistics. |
| stat_category | Note The current version does not support this parameter. |
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. For objects in the
systenant, you must be the owner of the table or have theSYSDBAprivilege to call this procedure.You cannot export or import statistics across databases that use different character sets.
Examples
Create a statistics table named
test_statfor thetestUser02user.obclient> CALL DBMS_STATS.CREATE_STAT_TABLE('testUser02', 'test_stat'); Query OK, 0 rows affectedExport the statistics in the
tbl1table of thetestUser01user to thetest_stattable.obclient> CALL DBMS_STATS.EXPORT_TABLE_STATS('testUser01', 'tbl1', stattab=>'test_stat', statown=>'testUser02'); Query OK, 0 rows affected