|
Resource management limits can be enforced at the session level (as long as you are logged in to SQL*Plus or whatever interface you are using to interact with the database), at the individual command or query level, or both. Limits can be defined by profiles created with the CREATE PROFILE command, and resource limits are enabled with the RESOURCE_LIMIT initialization parameter or the ALTER SYSTEM command. Resource limits can be set for a profile and are enforced, but only when you enable the resource limitations for the associated database. These limitation enforcements can be enabled or disabled with either of two methods. First, enabling limits before startup can be controlled with the RESOURCE_LIMIT initialization parameter. Valid values are TRUE or FALSE with FALSE being the default. Second, enabling limits when the database is open can be accomplished with the ALTER SYSTEM SET RESOURCE_LIMIT = TRUE|FALSE command. When the RESOURCE_LIMIT is set to true, you can create profiles to manage resource limits. Resource limits managed with a profile include the following:
Call level limits are enforced for each call made while executing a SQL statement. Whenever a call level limit is exceeded, the processing of the statement is halted, the statement is rolled back, all previous statements remain intact, and the user's session remains connected. To create a profile that limits resources, you can issue a command similar to the following: CREATE PROFILE my_resource_profile LIMIT SESSIONS_PER_USER 5 CPU_PER_SESSION 1000 IDLE_TIME = 120 CONNECT_TIME = 360; After you set the RESOURCE COST, as in the following example, and determined the COMPOSITE_LIMIT for a profile, Oracle calculates the total resource cost by multiplying the amount of each resource used by the session by the resource's weight and sums all the products for all resources. The following example shows how you would alter a profile's settings: ALTER RESOURCE COST CPU_PER_SESSION 10 LOGICAL_READS_PER_SESSION 100 CONNECT_TIME = 2; The weighted cost formula, then, for a given session would be COST = (10 * CPU_PER_SESSION) + (100 * LOGICAL_READS_PER_SESSION) + (2 * CONNECT_TIME)
The values multiplied by the weights are gleaned from the profile to which the user is assigned.
We will now look at using the Database Resource Manager to create and control resource plans and consumer groups. |
|