Skip to main content

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

ParameterDescription
ownnameThe username. If the username is set to NULL, the current login username will be used by default.
tabnameThe table name.
partnameThe name of the table partition. If the table is partitioned and partname is NULL, global and partition column statistics will be exported.
stattabThe name of the user table to store the statistics.
cascadeWhether to export column-level statistics. The default value is TRUE.
statownThe 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

  1. Create a statistics user table test_stat for the user testUser02.

    CALL DBMS_STATS.CREATE_STAT_TABLE('testUser02', 'test_stat');
    Query OK, 0 rows affected
  2. Export the statistics of the tbl1 table for the user testUser01 to the test_stat table.

    CALL DBMS_STATS.EXPORT_TABLE_STATS('testUser01', 'tbl1', stattab=>'test_stat',
    statown=>'testUser02');
    Query OK, 0 rows affected