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 that 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.
To do so, perform the following steps:
Log on to the
systenant of the cluster as therootuser.Use the following syntax to initiate a major compaction:
obclient> ALTER SYSTEM MAJOR FREEZE TENANT [=] all_user | all | all_meta | tenant_name [, tenant_name ...];Here,
[=]indicates that the equal sign (=) is optional.Here are some examples:
Initiate a major compaction for the sys tenant
obclient> ALTER SYSTEM MAJOR FREEZE TENANT;Initiate a major compaction for all user tenants from the sys tenant
obclient> ALTER SYSTEM MAJOR FREEZE TENANT = all_user;or
obclient> ALTER SYSTEM MAJOR FREEZE TENANT = all;Note
In OceanBase Database V4.2.1 and later, the
TENANT = all_userandTENANT = allsettings express the same semantics. If you want an operation to take effect on all tenants, we recommend that you useTENANT = all_user.TENANT = allwill be deprecated.Initiate a major compaction for all meta tenants from the sys tenant
obclient> ALTER SYSTEM MAJOR FREEZE TENANT = all_meta;Initiate a major compaction for a specified tenant from the sys tenant
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 the database as an administrator of a user tenant.
Initiate a major compaction for the current tenant.
obclient> ALTER SYSTEM MAJOR FREEZE;