Quantcast
Channel: Oracle
Viewing all articles
Browse latest Browse all 1814

Wiki Page: Database Resource Manager (DBRM) In Real Application Cluster (RAC) and Managing resources between Pluggable Databases (PDBs) in Multitenant Environment

$
0
0
By YV RaviKumar (Oracle ACE and Oracle Certified Master) Introduction We can implement Database Resource Manager (DBRM) to control shared resources among Pluggable databases (PDBs) in Container Database (CDB) in mission critical environments. Database Resource Manager (DBRM) can control the following some of the important shared resources: Sessions CPU Utilization Parallel Execution Servers Default configuration of Database Resource Manager (DBRM) works for Pluggable databases even as added or removed to the container database (CDB). You cannot set the cpu_count at the Pluggable Database (PDB) level. It can only be set at the Container Database (CDB) level if you want to limit the CPU usage of the entire Container Database (CDB). To limit the amount of CPU for a Pluggable Database (PDB), then you can opt to place a hard limit by setting the following formula utilization_limit to desired_max_cpu_count / num_cpus Fig: Managing Resources for Pluggable Databases (PDBs) in Container Database (CDB) In our example, we have container database (cdb) with two pluggable databases (pdb1 and pdb2) created and configured in Real Application Cluster (RAC) instance. Step1: Connect to the Container Database (contdb) in Real Application Clusters (RAC) environment and check the status of Pluggable Databases (PDB1 & PDB2) [oracle@rac1 ~]$ . oraenv ORACLE_SID = [oracle] ? contdb The Oracle base has been set to /u01/app/oracle [oracle@rac1 ~]$ sqlplus /nolog SQL*Plus: Release 12.1.0.2.0 Production on Sat Feb 20 07:38:29 2016 Copyright (c) 1982, 2014, Oracle. All rights reserved. SQL> connect sys/oracle@contdb as sysdba Connected. SQL> select instance_name,instance_number from gv$instance; INSTANCE_NAME INSTANCE_NUMBER ------------------------------------------------------------ contdb2 2 contdb1 1 SQL> select con_id, name, open_mode from v$pdbs; CON_ID NAME OPEN_MODE ------------------------------------------------------------------------ 2 PDB$SEED READ ONLY 3 PDB1 MOUNTED 4 PDB2 MOUNTED SQL> alter pluggable database all open; Pluggable database altered. SQL> select con_id, name, open_mode from v$pdbs; CON_ID NAME OPEN_MODE ------------------------------------------------------------------------ 2 PDB$SEED READ ONLY 3 PDB1 READ WRITE 4 PDB2 READ WRITE Step2: Clearing the area and create pending area in Container Database (CDB) SQL> exec DBMS_RESOURCE_MANAGER.CLEAR_PENDING_AREA(); PL/SQL procedure successfully completed. SQL> exec DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA(); PL/SQL procedure successfully completed. Step3: Creating a CDB Resource Plan with DBMS_RESOURCE_MANAGER package SQL> BEGIN DBMS_RESOURCE_MANAGER.CREATE_CDB_PLAN( plan => 'contdb_plan', comment => 'CDB resource plan for contdb database'); END; / PL/SQL procedure successfully completed. Step4: Creating directives for the Pluggable databases (PDB1 and PDB2) Database Resource Manager (DBRM) maintains an internal queue for this functionality. Pluggable Database (PDB) resources policies will be based on two ideas In Each container database (CDB), number of resource shares allocated to each pluggable database (PDB). In Each container database (CDB), Maximum Utilization Limit applied to each pluggable database (PDB). This advantage of Maximum Utilization Limit option is when you are first ramping up an initially empty Container Database (CDB) in Multitenant Environment and want to make sure that you have certain resources available as you add Pluggable Databases (PDBs) to the Container Database Server. We have used the options like Shares, Utilization Limit and Parallel Server Limit for both the pluggable databases (PDB1 and PDB2). The option Shares specifies how CPU is distributed between pluggable databases. In our example we have specified 2 shares to each pluggable database (PDB1 and PDB2) The option Utilization Limits to limit the CPU usage for pluggable databases (PDB) in Container Database. The Option parallel_server_limit directive specifies the percentage of parallel servers that its Pluggable Database (PDB) can use in that Container Database (CDB). The Method Default Directive allocates default shares and utilization limits for new pluggable databases OR other pluggable databases not configured for Database Resource Manager (DBRM) SQL> BEGIN DBMS_RESOURCE_MANAGER.CREATE_CDB_PLAN_DIRECTIVE( plan => 'contdb_plan', pluggable_database => 'pdb1', shares => 2, utilization_limit => 60, parallel_server_limit => 60); END; / PL/SQL procedure successfully completed. SQL> BEGIN DBMS_RESOURCE_MANAGER.CREATE_CDB_PLAN_DIRECTIVE( plan => 'contdb_plan', pluggable_database => 'pdb2', shares => 2, utilization_limit => 50, parallel_server_limit => 50); END; / PL/SQL procedure successfully completed. Creating Default Directive for other PDBs in Container Database: When a Pluggable Database (PDB) is plugged into a Container Database (CDB) and no directive is defined for it, the Pluggable Database (PDB) uses the default directive for PDBs. When a Pluggable Database (PDB) is unplugged from a Container Database (CDB) , the directive for the PDB is retained. If the same Pluggable Database (PDB) is plugged back into the Container Database (CDB) , then it uses the directive defined for it if the directive was not deleted manually in that Container Database (CDB) . SQL> BEGIN DBMS_RESOURCE_MANAGER.UPDATE_CDB_DEFAULT_DIRECTIVE( plan => 'contdb_plan', new_shares => 1, new_utilization_limit => 40, new_parallel_server_limit => 40); END; / PL/SQL procedure successfully completed. Note: If you are creating new pluggable databases OR other pluggable databases in container database will use default PDB directives. Step5: Validate pending area and Submit pending area SQL> exec DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA(); PL/SQL procedure successfully completed. SQL> exec DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA(); PL/SQL procedure successfully completed. Step6: Set Resource Manager Plan (contdb_plan) in Container Database for both the instances SQL> connect sys/oracle@contdb as sysdba Connected. SQL> show parameter RESOURCE_MANAGER_PLAN NAME TYPE VALUE ------------------------------------------------------------------------------------------------------------------------------- resource_manager_plan string SCHEDULER[0x4448]:DEFAULT_MAIN TENANCE_PLAN SQL> ALTER SYSTEM SET RESOURCE_MANAGER_PLAN = 'FORCE:CONTDB_PLAN' SID = '*' SCOPE = BOTH; System altered. SQL> show parameter RESOURCE_MANAGER_PLAN NAME TYPE VALUE ------------------------------------------------------------------------------------------------------------------------------- resource_manager_plan string FORCE:CONTDB_PLAN Step7: To disable Resource Manager Plan (contdb_plan) in Container Database for both the instances SQL> ALTER SYSTEM SET RESOURCE_MANAGER_PLAN = ' ' SID = '*' SCOPE = BOTH; System altered. Step8: Check the following views for getting information for the Services with DBRM SQL> select * from DBA_RSRC_PLAN_DIRECTIVES where plan='CONTDB_PLAN'; SQL> select * from DBA_RSRC_CAPABILITY; SQL> show parameter resource_manager_plan Creating Services for Pluggable Databases (PDBs) using srvctl command Step1: Creating Services for the Pluggable Databases (PDB1 and PDB2) and checking the status of the services Service-1 : servpdb1 for Pluggable database (PDB1) [oracle@rac1-12c ~]$ srvctl add service -db orcl -s s1orcl1 -r orcl1 -a orcl2 [oracle@rac1-12c ~]$ srvctl add service -db orcl -s s2orcl1 -r orcl1 -a orcl2 [oracle@rac1 ~]$ srvctl status service -db contdb -s servpdb1 Service servpdb1 is running on instance(s) contdb1 Service-2 : servpdb2 for Pluggable database (PDB2) [oracle@rac1 ~]$ srvctl add service -db contdb -s servpdb2 -r contdb2 -a contdb1 -pdb pdb2 [oracle@rac1 ~]$ srvctl start service -db contdb -s servpdb2 [oracle@rac1 ~]$ srvctl status service -db contdb -s servpdb2 Service servpdb2 is running on instance(s) contdb2 Step2: Check the created services in DB views SQL> set lines 100 pages 1000 SQL> select SERVICE_ID,NAME, NAME_HASH from dba_services; Step3: Connect the pluggable databases using services in container database (CDB) SQL> connect sys/oracle@192.168.56.21:1521/servpdb1 as sysdba Connected. SQL> show con_name CON_NAME ----------------- PDB1 SQL> connect sys/oracle@192.168.56.22:1521/servpdb2 as sysdba Connected. SQL> show con_name CON_NAME ----------------- PDB2 Summary To ensure optimal resource allocation for multitenant environment (Container Database with multiple pluggable databases (PDBs) we can implement Database Resource Manager (DBRM). In Oracle Database 12c, Container Database (CDB) level resource plans ensure optimal resource allocations across Pluggable Databases (PDBs).

Viewing all articles
Browse latest Browse all 1814

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>