After you enable archiving mode, you can disable it in the same way. After you disable archiving mode for a tenant, the system automatically stops the ongoing and suspended archiving tasks of the tenant.
Background information
Assume the current cluster has three tenants: sys, mysql_tenant, and mysql_tenant1, and both tenants mysql_tenant and mysql_tenant1 have archiving mode enabled.
Notice
To prevent the status of archiving tasks from remaining in the STOPPING state and failing to be closed, archiving tasks can be properly closed even when the archive media is unavailable. Accordingly, the log consumption module can also correctly consume logs when archiving is forcibly closed.
Disable archiving mode for tenants from the sys tenant
The sys tenant can disable archiving mode for all tenants or a specified tenant in the cluster.
Log in to the
systenant of the cluster as therootuser.Execute the following statements to disable archiving mode.
Disable archiving mode for all tenants in the cluster
This method disables archiving mode for all tenants in the cluster.
obclient [(none)]> ALTER SYSTEM NOARCHIVELOG [TENANT = ALL];After the statement is executed, archiving mode is disabled for the
mysql_tenantandmysql_tenant1tenants in this example. You can query theoceanbase.DBA_OB_TENANTSview in thesystenant for the archiving modes of all tenants in the cluster.obclient [(none)]> SELECT TENANT_NAME, LOG_MODE FROM oceanbase.DBA_OB_TENANTS WHERE TENANT_TYPE='USER'\G *************************** 1. row *************************** TENANT_NAME: mysql_tenant LOG_MODE: NOARCHIVELOG *************************** 2. row *************************** TENANT_NAME: mysql_tenant1 LOG_MODE: NOARCHIVELOG 2 rows in setDisable archiving mode for a specified tenant in the cluster
This method disables archiving mode only for the specified tenant and does not affect other tenants in the cluster.
obclient [(none)]> ALTER SYSTEM NOARCHIVELOG TENANT = mysql_tenant;Note
When specifying multiple tenants, separate the tenant names with commas (`,`).
After the statement is successfully executed, in this example, archiving mode is disabled for
mysql_tenant. You can query theoceanbase.DBA_OB_TENANTSview in thesystenant for the archiving modes of all tenants in the cluster.obclient [(none)]> SELECT TENANT_NAME, LOG_MODE FROM oceanbase.DBA_OB_TENANTS WHERE TENANT_TYPE = 'USER'\G *************************** 1. row *************************** TENANT_NAME: mysql_tenant LOG_MODE: NOARCHIVELOG *************************** 2. row *************************** TENANT_NAME: mysql_tenant1 LOG_MODE: ARCHIVELOG 2 rows in set
Disable archiving mode for a user tenant from the current tenant
You can disable archiving mode for a user tenant from the current tenant without affecting other tenants.
Log in to the database as a tenant administrator.
In this example, you can log in to the
mysql_tenantormysql_tenant1tenant as therootuser.Execute the following statement to disable archiving.
obclient [xxx]> ALTER SYSTEM NOARCHIVELOG;After the statement is successfully executed, you can directly query the
DBA_OB_TENANTSview in this tenant for its archiving mode.obclient [SYS]> SELECT TENANT_NAME, LOG_MODE FROM DBA_OB_TENANTS\G *************************** 1. row *************************** TENANT_NAME: mysql_tenant1 LOG_MODE: NOARCHIVELOG 1 rows in set