IMPORT_TABLE_STATS

2023-10-24 09:23:03  Updated

The IMPORT_TABLE_STATS procedure imports table-level statistics.

Syntax

DBMS_STATS.IMPORT_TABLE_STATS (
   ownname            VARCHAR2,
   tabname            VARCHAR2,
   partname           VARCHAR2 DEFAULT NULL,
   stattab            VARCHAR2,
   statid             VARCHAR2 DEFAULT NULL,
   cascade            BOOLEAN DEFAULT TRUE,
   statown            VARCHAR2 DEFAULT NULL,
   no_invalidate      BOOLEAN DEFAULT FALSE,
   force              BOOLEAN DEFAULT FALSE,
   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 imported.
stattab The name of the user statistics table from which the statistics are retrieved.
statid
Note: The current version does not support this parameter.
cascade Specifies whether to export column and index statistics on the table. The value TRUE indicates yes.
statown The username of the user statistics table from which the statistics are retrieved.
no_invalidate
Note: The current version does not support this parameter.
force Specifies whether to perform forced import and ignore the lock status. Default value: FALSE. If you set the value to TRUE, statistics will be imported even if they are locked.
stat_category
Note: The current version does not support this parameter.

Exceptions

Error code Description
ORA-20000 The object does not exist, or you do not have the required privileges.
ORA-20001 The values in the user statistics table are invalid or inconsistent.

Usage notes

  • 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

Import the statistics on the test_stat table of the testUser01 user into the tbl1 table of the testUser02 user.

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

Contact Us