Updated on 2025-05-29 GMT+08:00

RESOURCE_MANAGER

API Description

The RESOURCE_MANAGER resource plan advanced function package is used to allocate and manage PDB resources in multi-tenancy mode of kernel.

For details about all supported APIs, see Table 1 RESOURCE_MANAGER.

Table 1 RESOURCE_MANAGER

API

Description

RESOURCE_MANAGER.CREATE_PENDING_AREA

Creates a resource plan pending area.

RESOURCE_MANAGER.VALIDATE_PENDING_AREA

Verifies the correctness of the plans to be committed in the resource plan pending area.

RESOURCE_MANAGER.CLEAR_PENDING_AREA

Clears the pending area. After the clearing, all modifications in the pending area become invalid.

RESOURCE_MANAGER.SUBMIT_PENDING_AREA

Commits the pending area. After the committing, resource plans of the pending area take effect.

RESOURCE_MANAGER.CREATE_RESOURCE_PLAN

Creates a resource plan.

RESOURCE_MANAGER.UPDATE_RESOURCE_PLAN

Updates a resource plan.

RESOURCE_MANAGER.DELETE_RESOURCE_PLAN

Deletes a resource plan.

RESOURCE_MANAGER.CREATE_RESOURCE_PLAN_DIRECTIVE

Instruction for creating a resource plan.

RESOURCE_MANAGER.UPDATE_RESOURCE_PLAN_DIRECTIVE

Instruction for updating a resource plan.

RESOURCE_MANAGER.DELETE_RESOURCE_PLAN_DIRECTIVE

Instruction for deleting a resource plan.

The advanced package can be executed only in the CDB of the host. If the advanced package is executed in the PDB or on a standby database, an error is reported.

  • RESOURCE_MANAGER.CREATE_PENDING_AREA

    Creates a resource plan pending area to enter the state where the resource plan can be edited. The pending area stores the to-be-committed data modifications of the resource plan table gs_resource_plans and resource plan instruction table gs_resource_plan_directives. The data whose status column is pending does not affect the actual resource allocation. After the submit_pending_area API is used to commit the pending area, the modification is applied to the actual resource allocation. The value of status changes from pending to active. The entire instance has only one copy of pending-area data, and no concurrent sessions are allowed to edit the data at the same time.

    Prototype of the RESOURCE_MANAGER.CREATE_PENDING_AREA function:

    RESOURCE_MANAGER.CREATE_PENDING_AREA ()
    returns void

    If another session has created and held a pending area, an error is reported indicating that the pending area fails to be created.

  • RESOURCE_MANAGER.VALIDATE_PENDING_AREA

    Verifies the correctness of all resource plans in the pending area at the following points:

    • The sum of min_cpu allocated to any resource plan cannot exceed the maximum number of CPUs in the environment.
    • The sum of max_dynamic_memory cannot exceed 90% of max_dynamic_memory of a CDB. (The memory quota of the CDB can be obtained from the gs_total_memory_detail view.)
    • The sum of max_shared_memory cannot exceed 90% of max_shared_memory in a CDB.
    • The sum of max_connections cannot exceed 90% of max_connections of a CDB and cannot exceed the value of max_connections of the CDB minus the number of connections occupied by the CDB.
    • The used resource plan allocates resources to all PDBs in the OPEN state.

    If the memory or number of connections is allocated to a PDB, the available memory or number of connections of a CDB is insufficient. As a result, the verification fails.

    Prototype of the RESOURCE_MANAGER.VALIDATE_PENDING_AREA function:

    RESOURCE_MANAGER.VALIDATE_PENDING_AREA()
    returns void
  • RESOURCE_MANAGER.CLEAR_PENDING_AREA

    Clears the pending area: Delete all pending data from the gs_resource_plans system catalog and gs_resource_plan_directives table when the pending area is created, and release the pending area. All modifications in the pending area become invalid.

    Prototype of the RESOURCE_MANAGER.CLEAR_PENDING_AREA function:

    RESOURCE_MANAGER.CLEAR_PENDING_AREA()
    returns void
  • RESOURCE_MANAGER.SUBMIT_PENDING_AREA

    Commits the pending area: Enable the pending area plan instructions and release the pending area. If the pending area involves changes to the currently used plan, committing the pending area will cause resources to be allocated according to the new changes. Before the committing, the system verifies the resource quota of the pending area. The verification rule is the same as that of RESOURCE_MANAGER.VALIDATE_PENDING_AREA.

    Prototype of the RESOURCE_MANAGER.SUBMIT_PENDING_AREA function:

    RESOURCE_MANAGER.SUBMIT_PENDING_AREA()
    returns void
  • RESOURCE_MANAGER.CREATE_RESOURCE_PLAN

    Creates a resource plan: Create a pending area resource plan whose state is pending in the gs_resource_plans system catalog.

    Prototype of the RESOURCE_MANAGER.CREATE_RESOURCE_PLAN function:
    RESOURCE_MANAGER.CREATE_RESOURCE_PLAN(
        name                   name,
        comment                text DEFAULT NULL::text
    )
    Table 2 RESOURCE_MANAGER.CREATE_RESOURCE_PLAN API parameters

    Parameter

    Parameter Type

    Input/Output

    Value Range

    Required/Default Value

    Description

    name

    name

    Input

    /

    Yes

    Specifies the plan name.

    comment

    text

    Input

    /

    No/Null

    Describes the plan.

  • RESOURCE_MANAGER.UPDATE_RESOURCE_PLAN

    Updates a resource plan: Update the description of the specified resource plan in the pending area.

    Prototype of the RESOURCE_MANAGER.UPDATE_RESOURCE_PLAN function:

    RESOURCE_MANAGER.UPDATE_RESOURCE_PLAN(
        name                   name,
        comment                text DEFAULT NULL::text
    )
    Table 3 RESOURCE_MANAGER.UPDATE_RESOURCE_PLAN API parameters

    Parameter

    Parameter Type

    Input/Output

    Value Range

    Required/Default Value

    Description

    name

    name

    Input

    /

    Yes

    Specifies the plan name.

    comment

    text

    Input

    /

    No/Null

    Describes the plan.

  • RESOURCE_MANAGER.DELETE_RESOURCE_PLAN

    Deletes a resource plan: Delete a specified resource plan in the pending area and all resource instructions in the plan.

    Prototype of the RESOURCE_MANAGER.DELETE_RESOURCE_PLAN function:
    RESOURCE_MANAGER.DELETE_RESOURCE_PLAN(
        name                   name
    )
    Table 4 RESOURCE_MANAGER.DELETE_RESOURCE_PLAN API parameters

    Parameter

    Parameter Type

    Input/Output

    Value Range

    Required/Default Value

    Description

    name

    name

    Input

    /

    Yes

    Specifies the plan name.

  • RESOURCE_MANAGER.CREATE_RESOURCE_PLAN_DIRECTIVE

    Instruction for creating a plan: In the pending area, create a resource quota instruction that belongs to a specified PDB for a specified plan to allocate resources for the PDB.

    Prototype of the RESOURCE_MANAGER.CREATE_RESOURCE_PLAN_DIRECTIVE function:

    RESOURCE_MANAGER.CREATE_RESOURCE_PLAN_DIRECTIVE (
        plan_name                   name DEFAULT NULL::name,
        pdb_name                    name,
        min_cpu                     integer DEFAULT (-1),
        max_dynamic_memory          name DEFAULT NULL::name,
        max_shared_memory           name DEFAULT NULL::name,
        max_connections             integer DEFAULT (-1),
        io_limits                   integer DEFAULT 0,
        io_priority                 name DEFAULT NULL::name,
        comment                     text DEFAULT NULL::text
    )
    Table 5 RESOURCE_MANAGER.CREATE_RESOURCE_PLAN_DIRECTIVE API parameters

    Parameter

    Parameter Type

    Input/Output

    Value Range

    Required/Default Value

    Description

    plan_name

    name

    Input

    /

    No/default_resource_plan

    Specifies the plan name. The column is case-insensitive.

    pdb_name

    name

    Input

    /

    Yes

    Specifies the PDB name.

    min_cpu

    integer

    Input

    ≥ 1

    Yes

    Ensures that the number of available CPUs of the PDB does not exceed the maximum number of cores of the CDB.

    max_dynamic_memory

    name

    Input

    ≥ 1 GB, (-1)

    No/–1: no upper limit

    Specifies the upper limit of dynamic memory that can be used by the PDB.

    The value cannot exceed 90% of max_dynamic_memory (which can be queried using the pv_total_memory_detail system function in the CDB).

    max_shared_memory

    name

    Input

    ≥ 256 MB, (-1)

    No/–1: no upper limit

    Specifies the upper limit of shared memory that can be used by the PDB.

    The value cannot exceed 90% of max_shared_memory (which can be queried using the pv_total_memory_detail system function in the CDB).

    max_connection

    integer

    Input

    ≥ 10, (-1)

    No/–1: no upper limit

    Specifies the upper limit of connections allowed by the PDB.

    The value cannot exceed 90% of max_connections of the CDB.

    io_limits

    integer

    Input

    ≥ 0

    No/0: no limit

    Specifies the upper limit of IOPS. The unit of row store is specified by io_control_unit (default: 6000 per second). The value 0 indicates there is no limit.

    io_priority

    name

    Input

    None/

    Low/

    Medium/

    High

    No/None: no limit

    This column takes effect when the disk I/O usage reaches 50%. Upper limit of the average I/O speed in the past 3 seconds.

    • High: When this column takes effect, the value is 50% of the average I/O speed in the last 3 seconds. The minimum value is 50.
    • Medium: When this column takes effect, the value is 20% of the average I/O speed in the last 3 seconds. The minimum value is 20.
    • Low: When this column takes effect, the value is 10% of the average I/O speed in the last 3 seconds. The minimum value is 10.

    comment

    text

    Input

    /

    No/Null

    Describes the plan instruction.

  • RESOURCE_MANAGER.UPDATE_RESOURCE_PLAN_DIRECTIVE

    Instruction for updating a plan: In the pending area, update the resource quota of a specified PDB in a specified plan. That is, update a record whose state is pending in the gs_resource_plan_directives system catalog. Only the input parameters are modified.

    Prototype of the RESOURCE_MANAGER.UPDATE_RESOURCE_PLAN_DIRECTIVE function:
    create or replace function RESOURCE_MANAGER.update_resource_plan_directive (
        plan_name                   name DEFAULT NULL::name,
        pdb_name                    name,
        min_cpu                     integer DEFAULT NULL::integer,
        max_dynamic_memory          name DEFAULT NULL::name,
        max_shared_memory           name DEFAULT NULL::name,
        max_connections             integer DEFAULT (-1),
        io_limits                   integer DEFAULT NULL::integer,
        io_priority                 name DEFAULT NULL::name,
        comment                     text DEFAULT NULL::text
    )
    Table 6 RESOURCE_MANAGER.UPDATE_RESOURCE_PLAN_DIRECTIVE API parameters

    Parameter

    Parameter

    Type

    Input/

    Output

    Value

    Range

    Required/

    Default Value

    Description

    plan_name

    name

    Input

    /

    No/default_resource_plan

    Specifies the plan name. The column is case-insensitive.

    pdb_name

    name

    Input

    /

    Yes

    Specifies the PDB name.

    min_cpu

    integer

    Input

    ≥ 1

    No/NULL: no modification

    Ensures that the number of available CPUs of the PDB does not exceed the maximum number of cores of the CDB.

    max_dynamic_memory

    name

    Input

    ≥ 1 GB

    No/NULL: no modification

    Specifies the upper limit of dynamic memory that can be used by the PDB.

    The value cannot exceed 90% of max_dynamic_memory (which can be queried using the pv_total_memory_detail system function in the CDB).

    max_shared_memory

    name

    Input

    ≥ 256 MB

    No/NULL: no modification

    Specifies the upper limit of shared memory that can be used by the PDB. The value cannot exceed 90% of max_shared_memory of the CDB (which can be queried using the pv_total_memory_detail function in the CDB).

    max_connection

    integer

    Input

    ≥ 10

    No/NULL: no modification

    Specifies the maximum number of connections allowed by the PDB. The value cannot exceed 90% of max_connections of the CDB.

    io_limits

    integer

    Input

    ≥ 0

    No/NULL: no modification

    Specifies the upper limit of IOPS. The unit of row store is specified by io_control_unit (default: 6000 per second).

    io_priority

    name

    Input

    None/

    Low/

    Medium/

    High

    No/NULL: no modification

    This column takes effect when the disk I/O usage reaches 50%. Upper limit of the average I/O speed in the past 3 seconds.

    • High: When this column takes effect, the value is 50% of the average I/O speed in the last 3 seconds. The minimum value is 50.
    • Medium: When this column takes effect, the value is 20% of the average I/O speed in the last 3 seconds. The minimum value is 20.
    • Low: When this column takes effect, the value is 10% of the average I/O speed in the last 3 seconds. The minimum value is 10.

    comment

    text

    Input

    /

    No/NULL: no modification

    Describes the plan instruction.

  • RESOURCE_MANAGER.DELETE_RESOURCE_PLAN_DIRECTIVE

    Instruction for deleting a plan: In the pending area, this directive is used to delete a resource quota that belongs to a specified PDB for a specified plan.

    Prototype of the RESOURCE_MANAGER.DELETE_RESOURCE_PLAN_DIRECTIVE function:

    RESOURCE_MANAGER.DELETE_RESOURCE_PLAN_DIRECTIVE (
        plan_name                   name DEFAULT NULL::name,
        pdb_name                    name
    )
    returns void
    Table 7 RESOURCE_MANAGER.DELETE_RESOURCE_PLAN_DIRECTIVE API parameters

    Parameter

    Parameter Type

    Input/Output

    Required/Default Value

    Description

    plan_name

    name

    Input

    No/default_resource_plan

    Specifies the plan name.

    pdb_name

    name

    Input

    Yes

    Specifies the PDB name.

    After multiple resource plans are created and committed, you can use the ALTER SYSTEM SET syntax to change the currently effective resource plan.