denrepo

OracleStorage

Tablespace usage

Used and free space in GB against the maximum each tablespace can autoextend to, with its type (permanent, temporary or undo), fullest first.

Not yet verified. How scripts are tested

b-ora-ts.sql
1CLEAR COLUMNS2SET LINESIZE 130 PAGESIZE 100 TRIMOUT ON TAB OFF3COLUMN tablespace_name HEADING "TABLESPACE" FORMAT A254COLUMN contents HEADING "TYPE" FORMAT A95COLUMN used_gb  HEADING "USED GB"  FORMAT 999,990.996COLUMN free_gb  HEADING "FREE GB"  FORMAT 999,990.997COLUMN max_gb   HEADING "MAX GB"   FORMAT 999,990.998COLUMN used_pct HEADING "USED %"   FORMAT 990.99 10SELECT m.tablespace_name,11       t.contents,12       ROUND(m.used_space * t.block_size / POWER(1024, 3), 2) AS used_gb,13       ROUND((m.tablespace_size - m.used_space) * t.block_size / POWER(1024, 3), 2) AS free_gb,14       ROUND(m.tablespace_size * t.block_size / POWER(1024, 3), 2) AS max_gb,15       ROUND(m.used_percent, 1) AS used_pct16FROM dba_tablespace_usage_metrics m17JOIN dba_tablespaces t ON t.tablespace_name = m.tablespace_name18ORDER BY m.used_percent DESC;

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

Open in denrepoRelated tool: Tablespace runway and datafiles

Helps with

Part of these runbooks

More Oracle scripts: Storage