The EXPORT_COLUMN_STATS procedure is used to export column-level statistics.
Syntax
DBMS_STATS.EXPORT_COLUMN_STATS (
ownname VARCHAR2,
tabname VARCHAR2,
colname VARCHAR2,
partname VARCHAR2 DEFAULT NULL,
stattab VARCHAR2,
statown VARCHAR2 DEFAULT NULL);
Parameters
Parameter |
Explanation |
|---|---|
| ownname | Username. If the username is set to NULL, the current login username will be used by default. |
| tabname | The name of the table to which this column belongs. |
| colname | Column name or extension. |
| partname | The name of the table partition. If the table is partitioned and partname is NULL, global and partition column statistics are exported. |
| stattab | Specifies the table name for storing user statistics. |
| statown | Specifies the username of the user table for storing statistics. |
Exceptions
Error code HY000 indicates that the object does not exist or the user does not have sufficient privileges.
Usage instructions
To call this procedure, you must be the owner of the table. For objects owned by
SYS, you must be the table owner or have theSYSDBAprivilege to call this procedure.Exporting or importing statistics is not supported across databases with different character sets.
Examples
Export the statistics of column col1 in table tbl1 for user testUser01 to test_stat.
obclient> CALL DBMS_STATS.EXPORT_COLUMN_STATS('testUser01', 'tbl1','col1',null, stattab=>'test_stat',
statown=>'testUser01');
Query OK, 0 rows affected