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 parameter is set to NULL, the current login 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 statistics 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 statistics table for storing statistics. |
| stat_category | Note The current version does not support this parameter. |
Exceptions
The error code OBE-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. To call this procedure on a table object owned by the
SYSuser, you must be the table owner or have theSYSDBAprivilege.You cannot export or import statistics across databases that use different character sets.
Examples
Create a user statistics table named
test_statfor thetestUser02user.obclient> CALL DBMS_STATS.CREATE_STAT_TABLE('testUser02', 'test_stat'); Query OK, 0 rows affectedExport the statistics on 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