The EXPORT_SCHEMA_STATS procedure is used to export statistics for all tables of a specified user.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
Syntax
DBMS_STATS.EXPORT_SCHEMA_STATS (
ownname VARCHAR2,
stattab VARCHAR2,
statid VARCHAR2 DEFAULT NULL,
statown VARCHAR2 DEFAULT NULL);
Parameters
| Parameter | Description |
|---|---|
| ownname | The username. If the username is set to NULL, the current login username will be used by default. |
| stattab | The name of the table where the statistics are stored. |
| statid | Note This parameter is not supported in the current version. |
| statown | The username of the table where the statistics are stored. |
Exceptions
Error code OBE-20000 indicates that the object does not exist or the user does 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 to call this procedure.Statistics cannot be exported or imported between databases with different character sets.
Examples
Export statistics for all tables in the hr schema to the test_stat table of the testUser01 user.
obclient> CALL DBMS_STATS.EXPORT_SCHEMA_STATS('hr', stattab=>'test_stat', statown=>'testUser01');
Query OK, 0 rows affected
