The RESTORE_SCHEMA_STATS procedure restores table-level historical statistics of the specified point in time.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
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 user. If the username is set to NULL, the current logon username is used by default. |
| as_of_timestamp | The restoration time. |
| force | Specifies whether to restore statistics by force and ignore the lock. Default value: FALSE. |
| no_invalidate | Note The current version does not support this parameter. |
Exceptions
| Error code | Description |
|---|---|
| ORA-20000 | The object does not exist, or you do not have the required privileges. |
| ORA-20001 | Values are invalid or inconsistent. |
| ORA-20006 | The historical statistics are unavailable and cannot be restored. |
Considerations
To call this procedure, you must be the owner of the table. For objects in the sys tenant, you must be the owner of the table or have the SYSDBA privilege to call this procedure.
Examples
Restore the statistics of a point in time of the hr user.
obclient [SYS]> CALL DBMS_STATS.RESTORE_SCHEMA_STATS ('hr', TO_TIMESTAMP('2021-09-26 19:02:12.675729', 'YYYY-MM-DD HH24:MI:SS.FF'));
Query OK, 0 rows affected