The IMPORT_INDEX_STATS procedure retrieves statistics for a specified index from the user statistics table and stores them in a dictionary.
Syntax
DBMS_STATS.IMPORT_INDEX_STATS (
ownname VARCHAR2,
indname VARCHAR2,
partname VARCHAR2 DEFAULT NULL,
stattab VARCHAR2,
statown VARCHAR2 DEFAULT NULL,
no_invalidate BOOLEAN DEFAULT FALSE,
force BOOLEAN DEFAULT FALSE,
tabname VARCHAR2 DEFAULT NULL);
Parameters
Parameter |
Description |
|---|---|
| ownname | Username. If the username is set to NULL, the current logged-in username will be used by default. |
| tabname | Table name. |
| indname | Index name |
| partname | The name of the partition. If the table is already partitioned and partname is NULL, then import global and partition column statistics. |
| stattab | Specifies the name of the table that imports user statistics. |
| statown | Specifies the username for importing user statistics tables. |
| no_invalidate | Whether to flush the plan cache when statistics are collected. Valid values: TRUE Indicates that the plan cache is not flushed during statistics collection. |
| force | Whether to forcibly import and ignore the lock status. Default is FALSE. If set to TRUE, the index statistics will still be imported even if they are locked. |
Exceptions
Error Code |
Description |
|---|---|
| HY000 |
|
Usage instructions
Cross-character set database exports or imports of statistics are not supported.
Examples
Import the statistics of index idx1 on table tbl1 for user testUser01 from test_stat and store them in a dictionary.
obclient> CALL DBMS_STATS.CREATE_STAT_TABLE('testUser01', 'test_stat');
Query OK, 0 rows affected
obclient> CALL DBMS_STATS.IMPORT_INDEX_STATS('testUser01', 'idx1',stattab=>'test_stat',tabname=>'tbl1',no_invalidate=>FALSE);
Query OK, 0 rows affected
Note
The table name must be explicitly specified for OceanBase AI Database because indexes are not unique under the current user.