Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.
Auszug
hiddentrue

Oracle SQLPlus queries for Nuclos operations: determine tablespace, schema and table sizes and gather schema statistics.

globe with meridians Language: Deutsch · English

open book Oracle SQLPlus tools

Handy SQLPlus queries for Oracle: size of tablespaces, schemas and tables plus statistics.

Status
colourGrey
titleReferenz
Status
colourBlue
titleOperations
Status
colourGreen
titleUpdated: Jul 2026
Status
colourGrey
titleapplies to Nuclos 4.2026.x

Panel
bgColor#F4F5F7

On this page

Inhalt
maxLevel2
minLevel2

Tablespace sizes

Codeblock
languagesql
SELECT df.tablespace_name "Tablespace", totalusedspace "Used MB",
       (df.totalspace - tu.totalusedspace) "Free MB", df.totalspace "Total MB",
       ROUND(100 * ((df.totalspace - tu.totalusedspace) / df.totalspace)) "Pct. Free"
FROM (SELECT tablespace_name, ROUND(SUM(bytes) / 1048576) totalspace
      FROM dba_data_files GROUP BY tablespace_name) df,
     (SELECT ROUND(SUM(bytes) / 1048576) totalusedspace, tablespace_name
      FROM dba_segments GROUP BY tablespace_name) tu
WHERE df.tablespace_name = tu.tablespace_name;

Schema sizes

Codeblock
languagesql
SELECT ROUND(SUM(bytes)/1024/1024) AS size_in_mb, owner
FROM dba_segments GROUP BY owner ORDER BY size_in_mb;

Gather schema statistics

Codeblock
languagesql
BEGIN
  dbms_stats.gather_schema_stats('<schema>');
END;
/

Table sizes (data only)

Codeblock
languagesql
SELECT owner, table_name, ROUND((num_rows * avg_row_len)/(1024*1024)) MB
FROM all_tables WHERE owner = '<schema>' AND num_rows > 0
ORDER BY MB ASC;

Related pages

file cabinet Oracle database (DE)


Oracle setup.

Open →