The DELETE_SCHEMA_STATS procedure is used to delete 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 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 delete statistics, ignoring the lock status. The default is FALSE. If set 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 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 either be the owner or have the SYSDBA privilege to call this procedure.
Examples
Delete statistics for all tables in the hr schema.
obclient> CALL DBMS_STATS.DELETE_SCHEMA_STATS('hr');
Query OK, 0 rows affected
