Skip to main content
Version: V1.0.0

DELETE_SCHEMA_STATS

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

ParameterDescription
ownnameThe name of the schema.
no_invalidateSpecifies whether to invalidate the plan cache when collecting statistics. If set to TRUE, the plan cache will not be invalidated when collecting statistics.
forceSpecifies whether to forcibly delete the statistics, ignoring lock status. The default is FALSE. If set to TRUE, the statistics will be deleted even if they are locked.

Exceptions

Error code HY000 indicates that the object does not exist or that the user does not have sufficient privileges.

Usage

To call this procedure, you must be the owner of the table.

Examples

Delete statistics for all tables in the hr schema.

CALL DBMS_STATS.DELETE_SCHEMA_STATS('hr');
Query OK, 0 rows affected