10.07.2015 Views

Expert Oracle Exadata - Parent Directory

Expert Oracle Exadata - Parent Directory

Expert Oracle Exadata - Parent Directory

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 7 RESOURCE MANAGEMENTdbms_resource_manager.submit_pending_area();END;Step 2: Create Consumer Group Mapping RulesOkay, so that takes care of our resource groups. Now we’ll create our session-to-resource groupmappings. The following PL/SQL block creates mappings for three user accounts (KOSBORNE, TPODER, andRJOHNSON), and just for good measure, we’ll create a mapping for our TOAD users out there. This will alsoallow us to see how attribute mapping priorities work.BEGINdbms_resource_manager.clear_pending_area();dbms_resource_manager.create_pending_area();dbms_resource_manager.set_consumer_group_mapping(attribute => dbms_resource_manager.oracle_user,value => 'KOSBORNE',consumer_group => 'APPS');dbms_resource_manager.set_consumer_group_mapping(attribute => dbms_resource_manager.oracle_user,value => 'RJOHNSON',consumer_group => 'REPORTS');dbms_resource_manager.set_consumer_group_mapping(attribute => dbms_resource_manager.oracle_user,value => 'TPODER',consumer_group => 'MAINTENANCE');dbms_resource_manager.set_consumer_group_mapping(attribute => dbms_resource_manager.client_program,value => 'toad.exe',consumer_group => 'REPORTS');dbms_resource_manager.submit_pending_area();END;One more important step is to grant each of these users permission to switch their session to theconsumer group you specified in your mapping rules. If you don’t, they will not be able to switch theirsession to the desired resource group and will instead be assigned to the default consumer group,OTHER_GROUPS. So if you find that user sessions are landing in OTHER_GROUPS instead of the resource groupspecified in your mapping rules, you probably forgot to grant the switch_consumer_group privilege to theuser. Remember that this will also happen if the mapping rule assigns a session to a consumer groupthat is not in the active resource plan. The GRANT_OPITON parameter in the next listing determineswhether or not the user will be allowed to grant others permission to switch to the consumer group.BEGINdbms_resource_manager_privs.grant_switch_consumer_group(GRANTEE_NAME => 'RJOHNSON',CONSUMER_GROUP => 'REPORTS',GRANT_OPTION => FALSE);dbms_resource_manager_privs.grant_switch_consumer_group(GRANTEE_NAME => 'KOSBORNE',CONSUMER_GROUP => 'APPS',GRANT_OPTION => FALSE);dbms_resource_manager_privs.grant_switch_consumer_group(GRANTEE_NAME => 'TPODER',186

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!