denrepo

OracleMultitenant

Tablespace usage across all PDBs

The tablespace report for every container at once, fullest first, so you don't have to switch into each PDB.

12c+Run on CDB root

Not yet verified. How scripts are tested

ora-pdb-ts.sql
1CLEAR COLUMNS2SET LINESIZE 140 PAGESIZE 200 TRIMOUT ON TAB OFF3COLUMN pdb             FORMAT A204COLUMN tablespace_name HEADING "TABLESPACE" FORMAT A255COLUMN used_gb         HEADING "USED GB"    FORMAT 999,990.996COLUMN max_gb          HEADING "MAX GB"     FORMAT 999,990.997COLUMN used_pct        HEADING "USED %"     FORMAT 990.98 9SELECT c.name AS pdb, m.tablespace_name,10       ROUND(m.used_space * t.block_size / POWER(1024, 3), 2) AS used_gb,11       ROUND(m.tablespace_size * t.block_size / POWER(1024, 3), 2) AS max_gb,12       ROUND(m.used_percent, 1) AS used_pct13FROM cdb_tablespace_usage_metrics m14JOIN cdb_tablespaces t ON t.con_id = m.con_id AND t.tablespace_name = m.tablespace_name15JOIN v$containers c ON c.con_id = m.con_id16ORDER BY m.used_percent DESC;

Save it as ora-pdb-ts.sql and run it with SQL> @ora-pdb-ts.

Open in denrepo

More Oracle scripts: Multitenant