The IMPORT_SCHEMA_STATS procedure is used to import the statistics of all tables under a schema.
Syntax
DBMS_STATS.IMPORT_SCHEMA_STATS (
ownname VARCHAR2,
stattab VARCHAR2,
statown VARCHAR2 DEFAULT NULL,
no_invalidate BOOLEAN DEFAULT FALSE,
force BOOLEAN DEFAULT FALSE
);
Parameters
Parameter |
Description |
|---|---|
| ownname | The name of the schema. |
| stattab | Specifies the table name of the user table for which statistics are to be imported. |
| 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, statistics will still be imported even if they are locked. |
Exceptions
Error Code |
Description |
|---|---|
| HY000 |
|
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
Import the statistics stored by user testUser01 in the hr schema into the test_stat table into a dictionary.
obclient> CALL DBMS_STATS.IMPORT_SCHEMA_STATS(ownname=>'hr', stattab=>'test_stat', statown=>'testUser01');
Query OK, 0 rows affected