Purpose
After physical recovery is completed or a physical standby tenant is created, you can use the ALTER SYSTEM RECOVER STANDBY statement to specify the restore endpoint for the standby tenant's logs. This allows the standby tenant to either replay logs in segments or continuously replay logs.
Privilege requirements
This statement must be executed by the root user of the sys tenant (root@sys) or the administrator user of each tenant. Specifically:
- In MySQL mode, the default administrator user is
root. - In Oracle mode, the default administrator user is
SYS.
Syntax
ALTER SYSTEM RECOVER STANDBY
[TENANT [=] tenant_name] UNTIL { TIME='timestamp' | SCN=scn_no | UNLIMITED };
Parameters
| Parameter | Description |
|---|---|
| tenant_name | Specifies the standby tenant whose logs are to be restored. Only one standby tenant can be specified at a time. If multiple tenants need to be specified, the command must be executed multiple times.
NoticeOnly the sys tenant needs to specify the tenant to operate on using the |
| timestamp | Specifies the timestamp up to which the standby tenant's logs can be restored, including this timestamp. When specifying TIME, it must be connected to the specified value using =. |
| scn_no | Specifies the System Change Number (SCN) up to which the standby tenant's logs can be restored, including this SCN. When specifying SCN, it must be connected to the specified value using =. |
| UNLIMITED | Indicates that there is no restore endpoint, allowing the standby tenant to continuously replay archived logs from the source tenant. In the context of a physical standby database, this means the standby tenant is in continuous synchronization mode. |
Examples
For the sys tenant:
In a backup and restore scenario, the sys tenant specifies the standby tenant
restore_oracle_tenantto replay logs up to the specified timestamp'2023-06-01 00:00:00'.obclient [oceanbase]> ALTER SYSTEM RECOVER STANDBY TENANT restore_oracle_tenant UNTIL TIME='2023-06-01 00:00:00';In a physical standby database scenario, the sys tenant specifies the standby tenant
restore_oracle_tenantto enter continuous synchronization mode.obclient [oceanbase]> ALTER SYSTEM RECOVER STANDBY TENANT restore_oracle_tenant UNTIL UNLIMITED;
For a user tenant:
In a backup and restore scenario, the standby tenant
restore_oracle_tenantreplays logs up to the specified timestamp'2023-06-01 00:00:00'for itself.obclient [oceanbase]> ALTER SYSTEM RECOVER STANDBY UNTIL TIME='2023-06-01 00:00:00';In a physical standby database scenario, the standby tenant
restore_oracle_tenantputs itself into continuous synchronization mode.obclient [oceanbase]> ALTER SYSTEM RECOVER STANDBY UNTIL UNLIMITED;
