Purpose
The log archiving mode is divided into two types: archive (ARCHIVELOG) and non-archive (NOARCHIVELOG). You can use the ALTER SYSTEM ARCHIVELOG statement to enable archiving mode for a user tenant. Only tenants in archive mode can perform log archiving tasks.
After enabling archive mode, if you need to disable it, use the ALTER SYSTEM NOARCHIVELOG statement. For more information about the ALTER SYSTEM NOARCHIVELOG statement, see NOARCHIVELOG.
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 ARCHIVELOG [TENANT = {all | tenant_name[, tenant_name...]}] [DESCRIPTION [=] 'description'];
Parameters
Parameter |
Description |
|---|---|
| all | The system tenant enables archiving mode for all user tenants in the cluster.
NoticeAll user tenants here refer to all user tenants that already exist in the cluster at the time the statement is executed. For new tenants created after the statement is executed, the system does not automatically enable archiving mode. |
| tenant_name[, tenant_name...] | The system tenant specifies the tenant name for which archiving mode is to be enabled. Multiple tenants can be specified, separated by commas (,).
NoticeOnly the system tenant needs to specify the target tenant via the |
| description | Optional. Specifies the description of the operation. |
Examples
Assume that the current cluster has three tenants: sys, mysql_tenant, and mysql_tenant1. Both user tenants mysql_tenant and mysql_tenant1 have completed the configuration of the archive destination. You can use the following statement to enable archive mode for a tenant.
The system tenant has archive mode enabled for the
mysql_tenanttenant.obclient [oceanbase]> ALTER SYSTEM ARCHIVELOG TENANT = mysql_tenant;The system tenant enables archiving mode for tenants
mysql_tenantandmysql_tenant1.obclient [oceanbase]> ALTER SYSTEM ARCHIVELOG TENANT = mysql_tenant,mysql_tenant1;The system tenant enables archiving mode for all user tenants.
obclient [oceanbase]> ALTER SYSTEM ARCHIVELOG TENANT = all;The user tenants
mysql_tenantandmysql_tenant1have archiving mode enabled for the current tenant.obclient [oceanbase]> ALTER SYSTEM ARCHIVELOG;
References
Enable archiving mode.