The DELETE_SCHEMA_STATS procedure deletes statistics for all tables in the specified schema.
Syntax
DBMS_STATS.DELETE_SCHEMA_STATS (
ownname VARCHAR2,
no_invalidate BOOLEAN DEFAULT FALSE,
force BOOLEAN DEFAULT FALSE);
Parameters
| Parameter | Description |
|---|---|
| ownname | The name of the schema. |
| 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 deletion and ignore the lock status. Default value: FALSE. If you set the value to TRUE, statistics will be deleted even if they are locked. |
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 sys tenant, you must be the owner of the table or have the SYSDBA privilege.
Examples
Delete the statistics on all tables in the hr schema.
obclient> CALL DBMS_STATS.DELETE_SCHEMA_STATS('hr');
Query OK, 0 rows affected