Purpose
The ALTER SYSTEM FLASHBACK STANDBY LOG statement is used to truncate the logs of a standby tenant to a specified point. This statement is typically used after a failover to integrate the original primary tenant's standby tenant into the new primary tenant.
Limitations and considerations
For V4.2.5, the log truncation feature is supported starting from V4.2.5 BP4.
Before executing this statement, ensure that the current standby tenant has stopped log synchronization and its restore source is empty.
The standby tenant to be truncated must not have any valid replicas on the offline machine.
This statement can only be executed on a standby tenant, and the tenant's
STATUSmust beNORMAL, andSWITCHOVER_STATUSmust beNORMALorFLASHBACK_AND_STAY_STANDBY_STATUS.When the standby tenant's
SWITCHOVER_STATUSisFLASHBACK_AND_STAY_STANDBY_STATUS, it cannot continue to synchronize logs or modify its restore source.When specifying the log truncation point, the specified point must be greater than or equal to the standby tenant's synchronization point.
Executing this statement will automatically clear the tenant's service name (
SERVICE_NAME).
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 FLASHBACK STANDBY LOG TO SCN = flashback_log_scn [TENANT = 'tenant_name'];
Parameters
Parameter |
Description |
|---|---|
| flashback_log_scn | Specifies the point to which the standby tenant's logs will be truncated. The specified point must be greater than or equal to the standby tenant's synchronization point. |
| tenant_name | Specifies the standby tenant to be truncated. Only the system tenant needs to specify the tenant when executing this statement. |
Examples
Assume the confirmed log truncation point is 4611686018427387903. Here is an example of truncating the logs of the standby tenant standby_tenant.
The system tenant truncates the logs of the specified tenant
standby_tenantto the specified point.obclient(root@sys)[(none)]> ALTER SYSTEM FLASHBACK STANDBY LOG TO SCN = 4611686018427387903 TENANT = standby_tenant;The standby tenant truncates its own logs to the specified point.
obclient> ALTER SYSTEM FLASHBACK STANDBY LOG TO SCN = 4611686018427387903;
References
For more information on log truncation, see Failover.
