Description
After physical restore is complete or a physical standby database is successfully created, you can use the ALTER SYSTEM RECOVER STANDBY statement to specify the recovery endpoint for the standby tenant's logs, enabling segmented log replay or continuous log replay.
Privilege requirements
It must be executed by the root user of the sys tenant (root@sys) or the administrator user of a user tenant (root user).
Syntax
ALTER SYSTEM RECOVER STANDBY
[TENANT [=] tenant_name] UNTIL { TIME='timestamp' | SCN=scn_no | UNLIMITED };
Parameters
Parameter |
Description |
|---|---|
| tenant_name | The system tenant 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, you must run the command multiple times.
NoticeOnly the system tenant needs to specify the target tenant using the |
| timestamp | Specifies the earliest timestamp to which the standby tenant's logs can be restored, including that timestamp. The value must be within the allowed range. For TIME, the specified value must be connected with =. |
| scn_no | Specify the System Change Number (SCN) to which the standby tenant's logs can be restored, including this SCN. For SCN, the specified value must be connected with =. |
| UNLIMITED | This indicates that the restore has no end, and the standby tenant can continuously replay archived logs from the source tenant. In a physical standby database scenario, this means the standby tenant is in continuous synchronization mode. |
Examples
System tenant
In a backup and restore scenario, the system tenant specifies the standby tenant
restore_mysql_tenantto replay logs up to the specified timestamp'2023-06-01 00:00:00'.obclient [oceanbase]> ALTER SYSTEM RECOVER STANDBY TENANT restore_mysql_tenant UNTIL TIME='2023-06-01 00:00:00';In the physical standby database scenario, the system tenant specifies the standby tenant
restore_mysql_tenantto enter continuous synchronization mode.obclient [oceanbase]> ALTER SYSTEM RECOVER STANDBY TENANT restore_mysql_tenant UNTIL UNLIMITED;
User tenant
In a backup and restore scenario, the standby tenant
restore_mysql_tenantreplays logs for the primary tenant to the specified timestamp'2023-06-01 00:00:00'.obclient [oceanbase]> ALTER SYSTEM RECOVER STANDBY UNTIL TIME='2023-06-01 00:00:00';In a physical standby scenario, the standby tenant's
restore_mysql_tenantcommand puts the current tenant into continuous synchronization mode.obclient [oceanbase]> ALTER SYSTEM RECOVER STANDBY UNTIL UNLIMITED;