Purpose
OceanBase Database supports archive (ARCHIVELOG) and non-archive (NOARCHIVELOG) modes for log archiving. You can use this statement to enable the archive mode for a user tenant. You can initiate a log archive job for a tenant only when the tenant is in archive mode.
You can use the ALTER SYSTEM NOARCHIVELOG statement to disable the archive mode. For more information about this statement, see NOARCHIVELOG.
Required privileges
Only the root user of the sys tenant (root@sys) or the administrator user of a user tenant can execute this statement.
- 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 | Specifies to enable the archive mode for all user tenants in a cluster from the sys tenant.
NoticeThis statement takes effect on all existing user tenants in the cluster. For user tenants created after the statement is executed, the system does not automatically enable the archive mode. |
| tenant_name[, tenant_name...] | The names of the tenants for which you want to enable the archive mode from the sys tenant. You can specify multiple tenants at a time. Tenant names must be separated with commas (,).
NoticeWhen you execute this statement in the |
| description | The description of the operation. This parameter is optional. |
Examples
Assume that the current cluster contains three tenants: sys, mysql_tenant, and oracle_tenant, and that archive destinations have been configured for the mysql_tenant and oracle_tenant tenants.
In the
systenant, enable the archive mode for themysql_tenanttenant.obclient [oceanbase]> ALTER SYSTEM ARCHIVELOG TENANT = mysql_tenant;In the
systenant, enable the archive mode for themysql_tenantandoracle_tenanttenants.obclient [oceanbase]> ALTER SYSTEM ARCHIVELOG TENANT = mysql_tenant;In the
systenant, enable the archive mode for all user tenants.obclient [oceanbase]> ALTER SYSTEM ARCHIVELOG TENANT = all;In the
mysql_tenantororacle_tenanttenant, enable the archive mode for the current tenant.obclient [oceanbase]> ALTER SYSTEM ARCHIVELOG;