The RESTORE_TABLE_STATS procedure is used to restore table-level historical statistics at a specified 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 | The username. |
| tabname | The table name. |
| as_of_timestamp | The timestamp to restore. |
| force | Whether to forcibly restore and ignore locks. Default is FALSE. |
| no_invalidate | Whether to invalidate the plan cache when collecting statistics. Set to TRUE to not invalidate the plan cache when collecting statistics. |
Exceptions
| Error code | Description |
|---|---|
| HY000 |
|
Considerations
To call this procedure, you must be the owner of the table. For objects owned by SYS, you must be the owner or have the SYSDBA privilege to call this procedure.
Examples
Restore the statistics of the tbl1 table for the user testUser01 at a specified time.
obclient> CALL DBMS_STATS.RESTORE_TABLE_STATS ('testUser01', 'tbl1','2022-12-06 22:00:01.007146');
Query OK, 0 rows affected
