Oracle database commonly used command three (control the disk and performance profile used by the PDB)

Control the amount of disk I/O used by PDB

MAX_MBPS: The maximum number of megabytes (MB) of
I/O issued per second for each pluggable database (PDB) MAX_IOPS: Set the maximum number of I/Os per second that each pluggable database (PDB) can issue
ALTER SESSION SET CONTAINER=cdb$root;
SHOW PARAMETER max_mbps
ALTER SYSTEM SET max_mbps=400 SCOPE=BOTH;
Insert picture description here

ALTER SESSION SET CONTAINER=cdb$root;
SHOW PARAMETER max_iops
ALTER SYSTEM SET max_iops=100 SCOPE=BOTH;
Insert picture description here
恢复默认设置
SHOW PARAMETER max_iops
SHOW PARAMETER max_mbps
ALTER SYSTEM SET max_iops=0 SCOPE=BOTH;
ALTER SYSTEM SET max_mbps=0 SCOPE=BOTH;
Insert picture description here
修改PDB的IO设置
ALTER SESSION SET CONTAINER=pdb2;
SHOW PARAMETER max_iops
SHOW PARAMETER max_mbps
ALTER SYSTEM SET max_iops=100 SCOPE=BOTH;
ALTER SYSTEM SET max_mbps=400 SCOPE=BOTH;
Insert picture description here
Insert picture description here
恢复PDB的IO设置
SHOW PARAMETER max_iops
SHOW PARAMETER max_mbps
ALTER SYSTEM SET max_iops = 0 SCOPE = BOTH;
ALTER SYSTEM SET max_mbps = 0 SCOPE = BOTH;
Insert picture description here

Monitor I/O usage of PDB
ALTER SESSION SET CONTAINER=cdb$root;
ALTER SESSION SET NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS';
ALTER SESSION SET NLS_TIMESTAMP_FORMAT='DD-MON-YYYY HH24:MI: SS.FF';
Insert picture description here

每个PDB的最后一个样本。
SELECT r.con_id,p.pdb_name,r.begin_time,r.end_time,
r.iops,r.iombps,r.iops_throttle_exempt,r.iombps_throttle_exempt,
r.avg_io_throttle
FROM v$rsrcpdbmetric r,cdb_pdbs p
WHERE r.con_id = p.con_id
ORDER BY p.pdb_name;
Insert picture description here

V$RSRCPDBMETRIC: display information about the resources consumed by the PDB and the waiting time of each user group
con_id: the ID of the container to which the data belongs
BEGIN_TIME: the start
time of the interval END_TIME: the end time of the interval
IOPS: this PDB is one minute before I/O operations per second
IOMBPS: The I/O megabytes per second for this PDB in the previous minute.
IOPS_THROTTLE_EXEMPT: Indicates how many I/Os per second in the current PDB are exempt from throttling.
AVG_IO_THROTTLE: The average throttling time (in milliseconds) of each I/O operation for this PDB in the previous minute

PDB1的最后1个小时的
SELECT r.con_id,p.pdb_name,r.begin_time,r.end_time,
r.iops,r.iombps,r.iops_throttle_exempt,r.iombps_throttle_exempt,
r.avg_io_throttle
FROM v$rsrcpdbmetric_history r,cdb_pdbs p
WHERE r.con_id = p.con_id
AND p.pdb_name = ‘PDB2’
ORDER BY r.begin_time;
Insert picture description here

V RSRCPDBMETRICHISTORY: Display the historical record of the resource manager indicator of the PDB (the last hour), taken from V RSRCPDBMETRIC_HISTORY: Display the historical record of the resource manager indicator of the PDB (the last hour), taken from VRSRCPDBMETRICHThe I S T O R & lt the Y : significant shows P D B of resources source tube management device refers to standard to calendar the History of Ji recording ( most recent a small when ) , taken from V RSRCPDBMETRIC.

All AWR snapshot information of
PDB2 SELECT r.snap_id,r.con_id,p.pdb_name,r.begin_time,
r.end_time,r.iops,r.iombps,r.iops_throttle_exempt,
r.iombps_throttle_exempt,r.avg_rsio_throttle_metric , r.avg_rsio_throttle_metric,
r.
cdb_pdbs p
WHERE r.con_id = p.con_id
AND p.pdb_name ='PDB2'
ORDER BY r.begin_time
Insert picture description here
DBA_HIST_RSRC_PDB_METRIC: Displays information about PDB's historical resource manager metrics for the past hour

Performance profile

Created a new CDB resource plan
DECLARE
l_plan VARCHAR2(30) :='test_cdb';
BEGIN
DBMS_RESOURCE_MANAGER.clear_pending_area;
DBMS_RESOURCE_MANAGER.create_pending_area;

DBMS_RESOURCE_MANAGER.create_cdb_plan(
plan => l_plan,
comment => 'test CDB ');

DBMS_RESOURCE_MANAGER.create_cdb_profile_directive(
plan => l_plan,
profile => ‘gold’,
shares => 3,
utilization_limit => 100,
parallel_server_limit => 100);

DBMS_RESOURCE_MANAGER.create_cdb_profile_directive(
plan => l_plan,
profile => ‘silver’,
shares => 2,
utilization_limit => 50,
parallel_server_limit => 50);

DBMS_RESOURCE_MANAGER.validate_pending_area;
DBMS_RESOURCE_MANAGER.submit_pending_area;
END;
/
Insert picture description here
Resource plan information
SELECT plan_id,plan,comments,status,mandatory
FROM dba_cdb_rsrc_plans
WHERE ='TEST_CDB
Insert picture description here
plan information provided by DBA_CDB_RSRC.
PLAN_ID: CDB resource plan ID
PLAN: CDB resource plan name
COMMENTS: text description
MANDATORY: whether the resource plan is mandatory. Mandatory plans cannot be deleted.

SELECT plan,pluggable_database,profile,shares,
utilization_limit AS util,parallel_server_limit AS parallel
FROM dba_cdb_rsrc_plan_directives
WHERE plan = ‘TEST_CDB’
ORDER BY plan, pluggable_database, profile;
Insert picture description here
修改CDB资源计划
DECLARE
l_plan VARCHAR2(30) := ‘test_cdb’;
BEGIN
DBMS_RESOURCE_MANAGER.clear_pending_area;
DBMS_RESOURCE_MANAGER.create_pending_area;

DBMS_RESOURCE_MANAGER.create_cdb_profile_directive(
plan => l_plan,
profile => ‘bronze’,
shares => 1,
utilization_limit => 25,
parallel_server_limit => 25);

DBMS_RESOURCE_MANAGER.validate_pending_area;
DBMS_RESOURCE_MANAGER.submit_pending_area;
END;
/
Insert picture description here
Insert picture description here
修改现有的配置文件
DECLARE
l_plan VARCHAR2(30) := ‘test_cdb’;
BEGIN
DBMS_RESOURCE_MANAGER.clear_pending_area;
DBMS_RESOURCE_MANAGER.create_pending_area;

DBMS_RESOURCE_MANAGER.update_cdb_profile_directive(
plan => l_plan,
profile => ‘bronze’,
new_shares => 1,
new_utilization_limit => 20,
new_parallel_server_limit => 20);

DBMS_RESOURCE_MANAGER.validate_pending_area;
DBMS_RESOURCE_MANAGER.submit_pending_area;
END;
/
Insert picture description here
Insert picture description here
删除现有的配置文件
DECLARE
l_plan VARCHAR2(30) := ‘test_cdb’;
BEGIN
DBMS_RESOURCE_MANAGER.clear_pending_area;
DBMS_RESOURCE_MANAGER.create_pending_area;

DBMS_RESOURCE_MANAGER.delete_cdb_profile_directive(
plan => l_plan,
profile => ‘bronze’);

DBMS_RESOURCE_MANAGER.validate_pending_area;
DBMS_RESOURCE_MANAGER.submit_pending_area;
END;
/
Insert picture description here
Insert picture description here
ALTER SYSTEM SET RESOURCE_MANAGER_PLAN = ‘test_cdb’;
SHOW PARAMETER RESOURCE_MANAGER_PLAN
Insert picture description here
启用PDB性能配置文件
ALTER SESSION SET CONTAINER=pdb2;
ALTER SYSTEM SET DB_PERFORMANCE_PROFILE=gold SCOPE=SPFILE;
ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE;
ALTER PLUGGABLE DATABASE OPEN;
SHOW PARAMETER DB_PERFORMANCE_PROFILE
Insert picture description here
使用默认设置
ALTER SESSION SET CONTAINER=pdb2;
ALTER SYSTEM SET DB_PERFORMANCE_PROFILE=’’ SCOPE=SPFILE;
ALTER PLUGGABLE DATABASE CLOSE IMMEDIATE;
ALTER PLUGGABLE DATABASE OPEN;
SHOW PARAMETER DB_PERFORMANCE_PROFILE
Insert picture description here
ALTER SESSION SET CONTAINER=cdb$root;
SHOW PARAMETER RESOURCE_MANAGER_PLAN
ALTER SYSTEM SET RESOURCE_MANAGER_PLAN = ‘’;
Insert picture description here

Monitor PDB's CPU and parallel execution server usage
SELECT r.con_id,p.pdb_name,r.begin_time,r.end_time,
r.cpu_consumed_time,r.cpu_wait_time,r.avg_running_sessions,
r.avg_waiting_sessions,r.avg_cpu_sactive_parallel_stmtactive,r.avg_ ,
r.avg_queued_parallel_stmts,r.avg_active_parallel_servers,r.avg_queued_parallel_servers
FROM v$rsrcpdbmetric r,
cdb_pdbs p
WHERE r.con_id = p.con_id
ORDER BY p.pdb_name;
Insert picture description here
CPU_CONSUMED_TIME: Cumulative amount of all sessions in the PDB in milliseconds Unit)
CPU_WAIT_TIME: The cumulative time (in milliseconds) that the session waits for the CPU due to resource management. This does not include waits due to latches or queue contention, I/O waits, etc. When not actively managing CPU resources, this value is set to zero
AVG_RUNNING_SESSIONS: The average number of sessions currently running in the PDB
AVG_WAITING_SESSIONS: Due to resource management, the average number of sessions waiting for the CPU in the PDB. When not actively managing CPU resources, this value is set to zero.
AVG_CPU_UTILIZATION: The average percentage of CPU consumed by PDB (relative to the total number of CPUs in the system)
AVG_ACTIVE_PARALLEL_STMTS: Average number of parallel statements running during the 1-minute metric window
AVG_QUEUED_PARALLEL_STMTS: Average number of parallel statements queued during the 1-minute metric window
AVG_ACTIVE_PARALLEL_SERVERS: Average number of parallel servers running as part of parallel statements during the 1-minute metric window Number
AVG_QUEUED_PARALLEL_SERVERS: The average number of parallel servers queued for parallel statement requests during the 1-minute metric window

SELECT r.con_id,p.pdb_name,r.begin_time,r.end_time,
r.cpu_consumed_time,r.cpu_wait_time,r.avg_running_sessions,
r.avg_waiting_sessions,r.avg_cpu_utilization,r.avg_active_parallel_stmts,
r.avg_queued_parallel_stmts,r.avg_active_parallel_servers,r.avg_queued_parallel_servers
FROM v$rsrcpdbmetric_history r,
cdb_pdbs p
WHERE r.con_id = p.con_id
AND p.pdb_name = ‘PDB2’
ORDER BY r.begin_time;
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_39568073/article/details/114747644