Purpose
The ALTER SYSTEM FLASHBACK STANDBY LOG statement is used to truncate the logs of a standby tenant to a specified point in time. 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
Before executing this statement, ensure that the current standby tenant has stopped log synchronization and has no valid replicas on the offline machine.
The standby tenant being 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, and theSWITCHOVER_STATUSmust beNORMALorFLASHBACK_AND_STAY_STANDBY_STATUS.When the
SWITCHOVER_STATUSof the standby tenant isFLASHBACK_AND_STAY_STANDBY_STATUS, the tenant cannot continue to synchronize logs, and the restore source of the tenant cannot be modified.When specifying the log truncation point, the specified point must be greater than or equal to the synchronization point of the standby tenant.
Executing this statement will automatically clear the service name (
SERVICE_NAME) of the tenant.
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 in time to which the logs of the standby tenant are truncated. The specified point must be greater than or equal to the synchronization point of the standby tenant. |
| tenant_name | Specifies the standby tenant to be truncated. Only the system tenant needs to specify the tenant when executing this statement. |
Examples
Assume that the confirmed log truncation point is 4611686018427387903. The example of truncating the logs of the standby tenant standby_tenant is as follows.
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 detailed operations and explanations on log truncation, see Failover.
