EXPORT_TABLE_STATS

2024-04-19 08:42:50  Updated

The EXPORT_TABLE_STATS procedure exports 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 logon username is used by default.
tabname The name of the table.
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.
cascade Specifies whether to export column-level statistics. Default value: TRUE.
statown The username of the user statistics table for storing statistics.
stat_category
Note: The current version does not support this parameter.

Exceptions

The error code HY000 indicates that the object does not exist, or that 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 sys tenant, you must be the owner of the table or have the SYSDBA privilege.

  • You cannot export or import statistics across databases that use different character sets.

Examples

  1. Create the statistics table test_stat of the testUser02 user.

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

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

Contact Us