The RESTORE_TABLE_STATS procedure is used to restore table-level historical statistics to a specified point in time.
Syntax
DBMS_STATS.RESTORE_TABLE_STATS (
ownname VARCHAR2,
tabname VARCHAR2,
as_of_timestamp TIMESTAMP WITH TIME ZONE,
force BOOLEAN DEFAULT FALSE,
no_invalidate BOOLEAN DEFAULT FALSE);
Parameters
Parameter |
Description |
|---|---|
| ownname | Username. |
| tabname | Table name. |
| 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
Restore the statistics of table tbl1 under user testUser01 to a specified point in time.
obclient> CALL DBMS_STATS.RESTORE_TABLE_STATS ('testUser01', 'tbl1','2022-12-06 22:00:01.007146');
Query OK, 0 rows affected