You can manually initiate a major compaction.
Prerequisites
Before a major compaction is triggered, make sure that global major compaction is enabled. Global major compaction is controlled by the cluster-level parameter enable_major_freeze. The default value is True, which specifies to enable global major compaction.
If global major compaction is disabled for the current cluster, perform the following steps to enable this feature.
Log on to the
systenant of the cluster as therootuser.Verify whether global major compaction is enabled.
obclient> SHOW PARAMETERS LIKE 'enable_major_freeze';If global major compaction is not enabled, execute the following statement to enable the feature.
obclient> ALTER SYSTEM SET enable_major_freeze='True';For more information about the
enable_major_freezeparameter, see enable_major_freeze.
Manually initiate a major compaction from the sys tenant
You can initiate a major compaction for the current tenant, all tenants, or specified tenants from the sys tenant.
Procedure:
Log on to the
systenant of the cluster as therootuser.Execute the following statement to initiate a major compaction.
SQL syntax:
obclient> ALTER SYSTEM MAJOR FREEZE TENANT [=] ALL | tenant_name [, tenant_name ...];[=]indicates that the equal sign (=) is optional.Sample code:
Initiate a major compaction for the sys tenant
obclient> ALTER SYSTEM MAJOR FREEZE TENANT;Initiate a major compaction for all tenants
obclient> ALTER SYSTEM MAJOR FREEZE TENANT = ALL;Initiate a major compaction for specified tenants
obclient> ALTER SYSTEM MAJOR FREEZE TENANT = tenant1,tenant2;
Manually initiate a major compaction for a user tenant
A user tenant can initiate a major compaction only for itself.
Log on to OceanBase Database as the administrator of the user tenant.
Initiate a major compaction for the current tenant.
Sample statement:
obclient> ALTER SYSTEM MAJOR FREEZE;