RECOVER STANDBY

2024-03-05 01:54:26  Updated

Purpose

After a physical restore is completed or a physical standby database is created, you can use the ALTER SYSTEM RECOVER STANDBY statement to specify a log restore end point for the standby tenant so that the standby tenant replays partial logs or continuously replays logs.

Required privileges

You must execute this statement as the root user of the sys tenant (namely root@sys) or as the administrator of a user tenant.

  • The default administrator is the root user in MySQL mode.
  • The default administrator is the SYS user in Oracle mode.

Syntax

ALTER SYSTEM RECOVER STANDBY
    [TENANT [=] tenant_name] UNTIL { TIME='timestamp' | SCN=scn_no | UNLIMITED };

Parameters

Parameter Description
tenant_name The standby tenant for which logs are to be restored when you execute this statement in the sys tenant. You can specify only one standby tenant. To restore logs for multiple tenants, execute this statement repeatedly.

Notice

You must use the TENANT = tenant_name clause to specify the target tenant only when you execute this statement in the sys tenant. When you execute this statement in a user tenant, you cannot use the TENANT = tenant_name clause.

timestamp The timestamp to which logs can be restored for the standby tenant. TIME and its value must be joined by using an equal sign (=).
scn_no The system change number (SCN) to which logs can be restored for the standby tenant. SCN and its value must be joined by using an equal sign (=).
UNLIMITED Indicates unlimited restore. In this case, the standby tenant can continuously replay archive logs of the source tenant. In a Physical Standby Database scenario, this parameter indicates that the standby tenant is in continuous synchronization mode.

Examples

  • sys tenant

    • In a backup and restore scenario, execute the following statement in the sys tenant to replay logs to the timestamp '2023-06-01 00:00:00' for the standby tenant restore_oracle_tenant:

      obclient [oceanbase]> ALTER SYSTEM RECOVER STANDBY TENANT restore_oracle_tenant UNTIL TIME='2023-06-01 00:00:00';
      
    • In a Physical Standby Database scenario, execute the following statement in the sys tenant to enable the continuous synchronization mode for the standby tenant restore_oracle_tenant:

      obclient [oceanbase]> ALTER SYSTEM RECOVER STANDBY TENANT restore_oracle_tenant UNTIL UNLIMITED;
      
  • User tenant

    • In a backup and restore scenario, execute the following statement in the standby tenant restore_oracle_tenant to replay logs to the timestamp '2023-06-01 00:00:00' for the current tenant:

      obclient [oceanbase]> ALTER SYSTEM RECOVER STANDBY UNTIL TIME='2023-06-01 00:00:00';
      
    • In a Physical Standby Database scenario, execute the following statement in the standby tenant restore_oracle_tenant to enable the continuous synchronization mode for the current tenant:

      obclient [oceanbase]> ALTER SYSTEM RECOVER STANDBY UNTIL UNLIMITED;
      

References

Contact Us