EXPORT_TABLE_STATS
The EXPORT_TABLE_STATS procedure is used to export table-level statistics.
Syntax
DBMS_STATS.EXPORT_TABLE_STATS (
ownname VARCHAR2,
tabname VARCHAR2,
partname VARCHAR2 DEFAULT NULL,
stattab VARCHAR2,
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 login username will be used by default. |
| 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 to store the statistics. |
| cascade | Whether to export column-level statistics. The default value is TRUE. |
| statown | The username of the user table to store the statistics. |
| stat_category | Note This parameter is not supported in the current version. |
Exceptions
The error code HY000 indicates that the object does not exist or the user does not have sufficient privileges.
Usage
-
You must be the owner of the table to call this procedure.
-
Statistics cannot be exported or imported between databases with different character sets.
Examples
-
Create a statistics user table
test_statfor the usertestUser02.CALL DBMS_STATS.CREATE_STAT_TABLE('testUser02', 'test_stat');
Query OK, 0 rows affected -
Export the statistics of the
tbl1table for the usertestUser01to thetest_stattable.CALL DBMS_STATS.EXPORT_TABLE_STATS('testUser01', 'tbl1', stattab=>'test_stat',
statown=>'testUser02');
Query OK, 0 rows affected