IMPORT_SCHEMA_STATS
The IMPORT_SCHEMA_STATS procedure is used to import statistics for 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 | The name of the user table that stores statistics. |
| statown | The username of the user table that stores statistics. |
| no_invalidate | Specifies whether to invalidate the plan cache when collecting statistics. If set to TRUE, the plan cache will not be invalidated when collecting statistics. |
| force | Specifies whether to forcibly import statistics and ignore lock status. The default value is FALSE. If set to TRUE, statistics will be imported even if they are locked. |
Exceptions
| Error Code | Description |
|---|---|
| HY000 |
|
Usage Notes
-
You must be the owner of the table to call this procedure.
-
Statistics cannot be exported or imported between databases with different character sets.
Examples
Import statistics stored in the test_stat table for the testUser01 user in the hr schema into the dictionary.
CALL DBMS_STATS.IMPORT_SCHEMA_STATS(ownname=>'hr', stattab=>'test_stat', statown=>'testUser01');
Query OK, 0 rows affected