点击上方“IT那活儿”公众号,关注后了解更多内容,不管IT什么活儿,干就完了!!!
资源规划

I/O资源隔离
set linesize 400
col PDB_NAME for a10
col BEGIN_TIME for a30
col END_TIME for a30
SELECT R.SNAP_ID,
R.CON_ID,
P.PDB_NAME,
TO_CHAR(R.BEGIN_TIME, 'YYYY-MM-DHH24:MI') AS BEGIN_TIME,
TO_CHAR(END_TIME, 'YYYY-MM-D HH24:MI') AS END_TIME,
R.IOPS,
R.IOMBPS,
R.IOPS_THROTTLE_EXEMPT,
R.IOMBPS_THROTTLE_EXEMPT,
R.AVG_IO_THROTTLE
FROM DBA_HIST_RSRC_PDB_METRIC R, CDB_PDBS P
WHERE R.CON_ID = P.CON_ID
ORDER BY R.BEGIN_TIME;

将MASTERPDB的max_iops、max_mbps分别设置为:27、1。
SQL> alter session set container=masterpdb;
Session altered.
SQL> alter system set max_iops=27 scope=both;
System altered.
SQL> alter system set max_mbps=1 scope=both;
System altered.
将MASTERPDB2的max_iops、max_mbps分别设置为:25、1。
SQL> alter session set container=masterpdb2;
Session altered.
SQL> alter system set max_iops=25 scope=both;
System altered.
SQL> alter system set max_mbps=1 scope=both;
System altered.
内存隔离
如果需对每个PDB进行内存控制,需要满足:
CDB$ROOT中初始化参数NONCDB_COMPATIBLE保持为默认的FALSE。
CDB$ROOT中初始化参数MEMORY_TARGET设置为0。
CDB$ROOT中的SGA_TARGET不为0。
PDB中的pga_aggregate_target必须小于CDB$ROOT中的pga_aggregate_target。
SQL> alter session set container=masterpdb;
Session altered.
SQL> alter system set sga_target=200M scope=both;
System altered.
SQL> alter system set sga_min_size=100M scope=both;
System altered.
SQL> alter system set pga_aggregate_limit=256M;
System altered.
SQL> alter system set pga_aggregate_target=10M scope=both;
System altered.
SQL> alter session set container=masterpdb2;
Session altered.
SQL> alter system set sga_target=230M scope=both;
System altered.
SQL> alter system set sga_min_size=50M scope=both;
System altered.
SQL> alter system set pga_aggregate_limit=256M;
System altered.
SQL> alter system set pga_aggregate_target=10M scope=both;
System altered.
CPU隔离
4.1 创建CDB资源计划
SQL> exec DBMS_RESOURCE_MANAGER.CREATE_PENDING_AREA();
PL/SQL procedure successfully completed.
BEGIN
DBMS_RESOURCE_MANAGER.CREATE_CDB_PLAN(plan => 'CDB_PLAN_TEST',
comment => 'CDB PLAN');
END;
/
4.2 创建PDB Profile
BEGIN
DBMS_RESOURCE_MANAGER.CREATE_CDB_PROFILE_DIRECTIVE(plan => 'CDB_PLAN_TEST',
profile => 'PDB_1_PROFILE',
shares => 3,
utilization_limit => 40,
parallel_server_limit => 40);
END;
/
BEGIN
DBMS_RESOURCE_MANAGER.CREATE_CDB_PROFILE_DIRECTIVE(plan => 'CDB_PLAN_TEST',
profile => 'PDB_2_PROFILE',
shares => 1,
utilization_limit => 20,
parallel_server_limit => 20);
END;
/
4.3 验证Pending Area
SQL> exec DBMS_RESOURCE_MANAGER.VALIDATE_PENDING_AREA();
PL/SQL procedure successfully completed.
4.4 提交Pending Area
SQL> exec DBMS_RESOURCE_MANAGER.SUBMIT_PENDING_AREA();
PL/SQL procedure successfully completed.
4.5 启用CDB资源管理
ALTER SYSTEM SET RESOURCE_MANAGER_PLAN = 'CDB_PLAN_TEST' scope=both;
4.6 将PDB Profile应用至PDB
SQL> alter session set container=masterpdb;
Session altered.
SQL> alter system set db_performance_profile='PDB_1_PROFILE' scope=spfile;
System altered.
SQL> alter session set container=masterpdb2;
Session altered.
SQL> alter system set db_performance_profile='PDB_2_PROFILE' scope=spfile;
System altered.
4.7 重启PDB
SQL> alter pluggable database all close immediate;
Pluggable database altered.
SQL> alter pluggable database all open;
Pluggable database altered.
4.8 验证
select inst_id, name, con_id, value, ispdb_modifiable
from gv$system_parameter2
where name = 'db_performance_profile'
order by 1, 2, 3, 4;

4.9 在CDB中查看资源设置
SQL> alter session set container=CDB$ROOT;
Session altered.
select p.name, shares, utilization_limit, parallel_server_limit, profile
from v$rsrc_plan r, v$pdbs p
where r.con_id = p.con_id;


本文作者:李传伟(上海新炬王翦团队)
本文来源:“IT那活儿”公众号
文章转载自IT那活儿,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。