The RESTORE_SCHEMA_STATS procedure is used to restore schema-level historical statistics to a specified point in time.
Syntax
DBMS_STATS.RESTORE_SCHEMA_STATS(
ownname VARCHAR2,
as_of_timestamp TIMESTAMP WITH TIME ZONE,
force BOOLEAN DEFAULT FALSE,
no_invalidate BOOLEAN DEFAULT FALSE);
Parameters
Parameter |
Description |
|---|---|
| ownname | The name of the schema. |
| as_of_timestamp | Specify the restore time. |
| force | Forces recovery and ignores locking. Default is FALSE. |
| no_invalidate | Whether to flush the plan cache when statistics are collected. Valid values: TRUE Indicates that the plan cache is not flushed during statistics collection. |
Exceptions
Error Code |
Description |
|---|---|
| HY000 |
|
Usage instructions
To call this procedure, you must be the owner of the table. For objects owned by SYS, you must be the table owner or have the SYSDBA privilege to call this procedure.
Examples
Specify to restore the statistics of schema hr at a certain point in time.
obclient [hr]> CALL DBMS_STATS.RESTORE_SCHEMA_STATS ('hr', '2021-09-26 19:02:12.675729');
Query OK, 0 rows affected