DBAtlas · Database operations atlas

Set per-PDB CPU, memory, I/O and storage limits

OracleMultitenant

Command

ALTER SESSION SET CONTAINER = <pdb>;
-- CPU (instance caging with Resource Manager; at PDB level in 19c):
ALTER SYSTEM SET cpu_count = 2 SCOPE = BOTH;
-- Memory (sga_min_size guarantee, sga_target upper limit):
ALTER SYSTEM SET sga_target = 512M SCOPE = BOTH;
ALTER SYSTEM SET sga_min_size = 96M SCOPE = BOTH;
ALTER SYSTEM SET pga_aggregate_limit = 2G SCOPE = BOTH;
-- I/O (non-Exadata):
ALTER SYSTEM SET max_iops = 5000 SCOPE = BOTH;
ALTER SYSTEM SET max_mbps = 200 SCOPE = BOTH;
-- Number of sessions (after the PDB is reopened):
ALTER SYSTEM SET sessions = 200 SCOPE = SPFILE;
-- Storage:
ALTER PLUGGABLE DATABASE STORAGE (MAXSIZE 10G MAX_SHARED_TEMP_SIZE 2G);

-- Settings across all PDBs, from the root:
ALTER SESSION SET CONTAINER = CDB$ROOT;
SELECT p.name AS pdb, sp.name, sp.value
FROM   v$system_parameter sp JOIN v$pdbs p ON p.con_id = sp.con_id
WHERE  sp.name IN ('cpu_count','sga_target','sga_min_size','max_iops','max_mbps','pga_aggregate_limit')
ORDER  BY p.name, sp.name;

What it does

Limits how much CPU, SGA/PGA, IOPS/MBPS and total storage a PDB can use from the CDB through PDB-level parameters; prevents "noisy neighbor" PDBs from affecting the others.

When to use it

In consolidated CDBs, when running applications with different SLAs in the same CDB, or when a PDB is seen to exhaust the whole server.

Caution

The PDB sga_target must be smaller than the CDB sga_target; values that are too low cause ORA-04031 and performance problems. The sum of sga_min_size must not reserve the whole CDB SGA. For cpu_count in a PDB to take effect, a resource manager plan must be active in the CDB. When MAXSIZE is reached the PDB gets ORA-65114.

Open in DBAtlas →

Related