The IMPORT_SCHEMA_STATS procedure imports statistics for all tables in 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 | The name of the statistics user table from which the statistics are retrieved. |
| statown | The username of the user statistics table from which the statistics are retrieved. |
| no_invalidate | Specifies whether to refresh the plan cache during statistics collection. If you set the value to TRUE, the plan cache will not be refreshed during statistics collection. |
| 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. |
Exceptions
| Error code | Description |
|---|---|
| HY000 |
|
Considerations
To call this procedure, you must be the owner of the table. If the object is in the
systenant, you must be the owner of the table or have theSYSDBAprivilege.You cannot export or import statistics across databases that use different character sets.
Examples
Import the statistics of the testUser01 user in the hr schema that are stored in the test_stat table to the dictionary.
obclient> CALL DBMS_STATS.IMPORT_SCHEMA_STATS(ownname=>'hr', stattab=>'test_stat', statown=>'testUser01');
Query OK, 0 rows affected