memory_limit

2025-11-14 07:33:33  Updated

Note

This parameter was introduced in V1.4.

Description

The memory_limit parameter specifies the total memory available to the OBServer node.

For the memory_limit parameter to take effect, the following conditions must be met:

  • The reserved memory for 500 tenants is not less than the occupied memory.
  • The value of memory_limit is greater than the sum of system_memory and the allocated memory of units.

If the preceding conditions are not met, the memory_limit parameter can be set without errors, but the value will not take effect.

Privilege requirements

  • Query the parameter

    The sys tenant and all user tenants can use the SHOW PARAMETERS statement or the GV$OB_PARAMETERS view to query the parameter.

  • Modify the parameter

    Only the sys tenant can modify the parameter. User tenants cannot modify the parameter.

Attributes

Attribute Description
Type Capacity
Default value 0, in MB.
Valid values [1G, +∞)

Note

  • Starting from V4.1.0, the valid value range of this parameter is changed from [4G, +∞) to [1G, +∞).
  • The minimum value is 1G in arbitration service mode and 4G in non-arbitration service mode.
Modifiable Yes. This parameter can be modified by using the ALTER SYSTEM SET statement.
Requires restart of the OBServer node No. The setting takes effect immediately.

Considerations

  • The default value of memory_limit is 0. If this value is not 0, the system will ignore the value of memory_limit_percentage and use the value of memory_limit instead. For example, if the memory of a physical server is 100 GB, the value of memory_limit_percentage is 80, indicating that 80% of the memory is used, and the value of memory_limit is '90G', the actual memory available for OceanBase Database on the physical server is 90 GB. For more information about memory_limit_percentage, see memory_limit_percentage.

  • The default unit of memory_limit is MB. For example, memory_limit='40G' specifies that the maximum memory that the OceanBase Database process can use is 40 GB. Since the default unit is MB, memory_limit=40960 is equivalent to memory_limit='40G'.

  • The value of memory_limit can be any positive number.

    • If the maximum memory specified by memory_limit exceeds the total physical memory, the values of other parameters that are calculated based on the total memory will be too large.

    • If you want to limit the memory size of an already running OceanBase Database, you can directly modify the value of memory_limit to the expected value. After the value is set, the background parameter reload thread dynamically takes effect without requiring a restart. However, make sure that the value of memory_limit is smaller than the total memory.

      Notice

      The value of memory_limit must be greater than the memory actually used by the OBServer node.

Examples

  • For example, to set the total memory available to the OBServer node to 32 GB, run the following command:

    obclient> ALTER SYSTEM SET memory_limit='32G';
    
  • To query the amount of memory used (in GB), run the following command:

    obclient> SELECT value/1024/1024/1024 used_gb FROM v$sysstat WHERE name LIKE '%observer memory%' AND con_id = 1 AND stat_id=140008 AND name='observer memory used size';
    

References

Contact Us