The EXPORT_TABLE_STATS procedure is used to export table-level statistics.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
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 default username of the current login will be used. |
| tabname | The table name. |
| partname | The name of the table partition. If the table is partitioned and partname is NULL, global and partition column statistics will be exported. |
| stattab | The name of the user table where the statistics are stored. |
| statid | Description This parameter is not supported in the current version. |
| cascade | Whether to export column-level statistics. The default value is TRUE. |
| statown | The username of the user table where the statistics are stored. |
| stat_category | Description This parameter is not supported in the current version. |
Exceptions
Error code OBE-20000 indicates that the object does not exist or the permissions are insufficient.
Considerations
You must be the owner of the table to call this procedure. For objects owned by
SYS, you must be the owner or have theSYSDBAprivilege to call this procedure.Statistics cannot be exported or imported between databases with different character sets.
Examples
Create the statistics user table
test_statfor usertestUser02.obclient> CALL DBMS_STATS.CREATE_STAT_TABLE('testUser02', 'test_stat'); Query OK, 0 rows affectedExport the statistics of the
tbl1table for usertestUser01totest_stat.obclient> CALL DBMS_STATS.EXPORT_TABLE_STATS('testUser01', 'tbl1', stattab=>'test_stat', statown=>'testUser02'); Query OK, 0 rows affected
