The EXPORT_SCHEMA_STATS procedure exports statistics for all tables in the specified 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 table where statistics are stored. |
| statown | The name of the user who owns the table where statistics are stored. |
Exceptions
Error code HY000 indicates that the object does not exist or that you do not have sufficient privileges.
Considerations
To call this procedure, you must be the owner of the table. For objects owned by
SYS, you must be the owner or have theSYSDBAprivilege.Statistics cannot be exported or imported between databases with different character sets.
Examples
Export statistics for all tables in the hr schema owned by the testUser01 user to the test_stat table.
obclient> CALL DBMS_STATS.EXPORT_SCHEMA_STATS('hr', stattab=>'test_stat', statown=>'testUser01');
Query OK, 0 rows affected
