Oracle’s Resource Manager is a powerful tool that enables database administrators to allocate and control database resources efficiently based on business priorities. This tool allows the administrator to define various resource plans and associate each plan to individual users, groups, or services.
Below are the steps to use Oracle’s Resource Manager to allocate and manage database resources:
1. Create a Resource Plan: A resource plan is used to specify the allocation of resources between different resource consumer groups. A resource plan consists of a set of resource consumer groups and directives for how database resources are to be allocated to these groups.
For example, the following SQL statement creates a resource plan named "MY_PLAN" with two consumer groups "OLTP_GROUP" and "DSS_GROUP":
CREATE RESOURCE PLAN my_plan;
CREATE CONSUMER GROUP oltp_group;
CREATE CONSUMER GROUP dss_group;
ALTER RESOURCE PLAN my_plan
ADD CONSUMER GROUP oltp_group
EXPLICIT MAPPING CPU_WEIGHT 80;
ALTER RESOURCE PLAN my_plan
ADD CONSUMER GROUP dss_group
EXPLICIT MAPPING CPU_WEIGHT 20;
In the above example, we have created two consumer groups, OLTP_GROUP and DSS_GROUP, and each group has an explicit mapping of
CPU_WEIGHT to represent the proportion of CPU allocated to each group.
2. Create and associate Resource Consumer Groups: A resource consumer group represents a set of users or services that share the same resource allocation. A user or service can be associated with only one consumer group.
For example, the following SQL statement creates a user with ID "USER1" and associates it with the OLTP_GROUP consumer group:
CREATE USER user1 IDENTIFIED BY password;
ALTER USER user1 RESOURCE_CONSUMER_GROUP oltp_group;
3. Define Resource Directives: Resource directives specify how resources are to be allocated to the resource consumer groups. A resource directive comprises a resource allocation method and a resource allocation limit.
For example, the following SQL statement creates a resource directive to limit CPU usage for the OLTP_GROUP to 50
ALTER RESOURCE PLAN my_plan
MODIFY CONSUMER GROUP oltp_group
CPU_P1_LIMIT 50;
In the above example, the CPU_P1_LIMIT directive limits the CPU usage for OLTP_GROUP to 50
4. Activate Resource Plan: Once the resource plan is configured, it needs to be activated to take effect.
For example, the following SQL statement activates resource plan MY_PLAN:
ALTER SYSTEM SET RESOURCE_MANAGER_PLAN = my_plan;
This sets the resource manager plan to "MY_PLAN" which means resource allocation for each resource consumer group is as per their defined resource directives.
In conclusion, Oracle’s Resource Manager is a very powerful tool to manage and allocate resources based on business priorities. By creating resource plans, consumer groups, and defining directives, administrators can efficiently allocate and manage database resources.