The EXPORT_SCHEMA_STATS procedure exports statistics for all tables in a schema.
Syntax
DBMS_STATS.EXPORT_SCHEMA_STATS (
ownname VARCHAR2,
stattab VARCHAR2,
statown VARCHAR2 DEFAULT NULL);
Parameters
| Parameter | Description |
|---|---|
| ownname | The name of the schema. |
| stattab | The name of the user statistics table for storing statistics. |
| statown | The username of the user statistics table for storing statistics. |
Exceptions
The error code HY000 indicates that the object does not exist, or that you do not have the required privileges.
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
Export the statistics on all tables of the testUser01 user in the hr schema to the test_stat table.
obclient> CALL DBMS_STATS.EXPORT_SCHEMA_STATS('hr', stattab=>'test_stat', statown=>'testUser01');
Query OK, 0 rows affected