The EXPORT_COLUMN_STATS procedure exports column-level statistics.
Syntax
DBMS_STATS.EXPORT_COLUMN_STATS (
ownname VARCHAR2,
tabname VARCHAR2,
colname VARCHAR2,
partname VARCHAR2 DEFAULT NULL,
stattab VARCHAR2,
statid VARCHAR2 DEFAULT NULL,
statown VARCHAR2 DEFAULT NULL);
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 to which the column belongs. |
| colname | The column name or the extension name. |
| 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. |
| statown | The username of the user statistics table for storing statistics. |
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. If the object is in the
systenant, you must be the owner of the table or have theSYSDBAprivilege.You cannot export or import statistics across databases that use different character sets.
Examples
Export the statistics on the col1 column in the tbl1 table of the testUser01 user to the test_stat table.
obclient> CALL DBMS_STATS.EXPORT_COLUMN_STATS('testUser01', 'tbl1','col1',null, stattab=>'test_stat',
statown=>'testUser01');
Query OK, 0 rows affected