Purpose
The log archiving mode is divided into two types: archive mode (ARCHIVELOG) and non-archive mode (NOARCHIVELOG). You can use the ALTER SYSTEM ARCHIVELOG statement to enable the archive mode for a user tenant. Only tenants in archive mode can perform log archiving tasks.
After enabling the archive mode, you can use the ALTER SYSTEM NOARCHIVELOG statement to disable it. For more information about the ALTER SYSTEM NOARCHIVELOG statement, see NOARCHIVELOG.
Privilege requirements
The operation must be performed by the root user of the sys tenant (root@sys) or the administrator of each tenant. Specifically:
- The default administrator user in MySQL mode is
root. - The default administrator user in Oracle mode is
SYS.
Syntax
ALTER SYSTEM ARCHIVELOG [TENANT = {all | tenant_name[, tenant_name...]}] [DESCRIPTION [=] 'description'];
Parameters
| Parameter | Description |
|---|---|
| all | Enables the archive mode for all user tenants in the cluster.
NoticeHere, all user tenants refer to those that exist in the cluster at the time the statement is executed. The archive mode will not be automatically enabled for new tenants created after the statement is executed. |
| tenant_name[, tenant_name...] | Specifies the name of the tenant to enable the archive mode for. You can specify multiple tenants, separated by commas (,).
NoticeOnly the system tenant needs to specify the |
| description | Optional. Specifies a description for the operation. |
Examples
Assume the current cluster has three tenants: sys, mysql_tenant, and oracle_tenant. Both mysql_tenant and oracle_tenant have completed the configuration of the archive destination. You can use the following statements to enable the archive mode for the tenants.
The system tenant enables the archive mode for the
mysql_tenanttenant.obclient [oceanbase]> ALTER SYSTEM ARCHIVELOG TENANT = mysql_tenant;The system tenant enables the archive mode for the
mysql_tenantandoracle_tenanttenants.obclient [oceanbase]> ALTER SYSTEM ARCHIVELOG TENANT = mysql_tenant,oracle_tenant;The system tenant enables the archive mode for all user tenants.
obclient [oceanbase]> ALTER SYSTEM ARCHIVELOG TENANT = all;The user tenants
mysql_tenantandoracle_tenantenable the archive mode for themselves.obclient [oceanbase]> ALTER SYSTEM ARCHIVELOG;
