Oracle® Database Administrator's Guide 11g Release 2 (11.2) Part Number E10595-04 |
|
|
View PDF |
This section provides instructions for maintaining consumer groups, resource plans, and resource plan directives for Oracle Database Resource Manager (the Resource Manager). You perform maintenance tasks using the DBMS_RESOURCE_MANAGER
PL/SQL package. The following topics are covered:
See Also:
Oracle Database PL/SQL Packages and Types Reference for details on the DBMS_RESOURCE_MANAGER
PL/SQL package.
You use the UPDATE_CONSUMER_GROUP
procedure to update consumer group information. The pending area must be created first, and then submitted after the consumer group is updated. If you do not specify the arguments for the UPDATE_CONSUMER_GROUP
procedure, they remain unchanged in the data dictionary.
The DELETE_CONSUMER_GROUP
procedure deletes the specified consumer group. The pending area must be created first, and then submitted after the consumer group is deleted. Upon deletion of a consumer group, all users having the deleted group as their initial consumer group are assigned the DEFAULT_CONSUMER_GROUP
as their initial consumer group. All currently running sessions belonging to a deleted consumer group are assigned to a new consumer group, based on the consumer group mapping rules. If no consumer group is found for a session through mapping, the session is switched to the DEFAULT_CONSUMER_GROUP
.
You cannot delete a consumer group if it is referenced by a resource plan directive.
You use the UPDATE_PLAN
procedure to update plan information. The pending area must be created first, and then submitted after the plan is updated. If you do not specify the arguments for the UPDATE_PLAN
procedure, they remain unchanged in the data dictionary. The following PL/SQL block updates the COMMENT
parameter.
BEGIN DBMS_RESOURCE_MANAGER.UPDATE_PLAN( PLAN => 'DAYTIME', NEW_COMMENT => '50% more resources for OLTP applications'); END; /
The DELETE_PLAN
procedure deletes the specified plan as well as all the plan directives associated with it. The pending area must be created first, and then submitted after the plan is deleted.
The following PL/SQL block deletes the great_bread
plan and its directives.
BEGIN DBMS_RESOURCE_MANAGER.DELETE_PLAN(PLAN => 'great_bread'); END; /
The resource consumer groups referenced by the deleted directives are not deleted, but they are no longer associated with the great_bread
plan.
The DELETE_PLAN_CASCADE
procedure deletes the specified plan as well as all its descendants: plan directives and those subplans and resource consumer groups that are not marked by the database as mandatory. If DELETE_PLAN_CASCADE
encounters an error, it rolls back, leaving the plan unchanged.
You cannot delete the currently active plan.
Use the UPDATE_PLAN_DIRECTIVE
procedure to update plan directives. The pending area must be created first, and then submitted after the resource plan directive is updated. If you do not specify an argument for the UPDATE_PLAN_DIRECTIVE
procedure, its corresponding parameter in the directive remains unchanged.
The following example adds a comment to a directive:
BEGIN DBMS_RESOURCE_MANAGER.CLEAR_PENDING_AREA(); DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA(); DBMS_RESOURCE_MANAGER.UPDATE_PLAN_DIRECTIVE( PLAN => 'SIMPLE_PLAN1', GROUP_OR_SUBPLAN => 'MYGROUP1', NEW_COMMENT => 'Higher priority' ); DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA(); END; /
To clear (nullify) a comment, pass a null string (''
). To clear (zero or nullify) any numeric directive parameter, set its new value to -1:
BEGIN DBMS_RESOURCE_MANAGER.CLEAR_PENDING_AREA(); DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA(); DBMS_RESOURCE_MANAGER.UPDATE_PLAN_DIRECTIVE( PLAN => 'SIMPLE_PLAN1', GROUP_OR_SUBPLAN => 'MYGROUP1', NEW_MAX_EST_EXEC_TIME => -1 ); DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA(); END; /