2
SELECT table_name , (SELECT (sum(bytes)/1024) "SizeinKB" FROM dba_segments) AS KB
FROM user_tables
ORDER BY table_name;

This lists all my user table and the total space taken by database. How do I show each table along with its total size used? Im on sql plus. Thank you.

Jeugasce
  • 197
  • 1
  • 3
  • 11
  • 1
    Possible duplicate of [How do I calculate tables size in Oracle](http://stackoverflow.com/questions/264914/how-do-i-calculate-tables-size-in-oracle) – sstan Nov 08 '16 at 17:45
  • The question is not clear. If what you have does not represent the size of the table, what does? – Dan Bracuk Nov 08 '16 at 17:45

1 Answers1

4

You need to join and group:

SELECT ut.table_name, sum(s.bytes)/1024 as"SizeinKB" 
FROM user_tables ut
  JOIN user_segments s ON ut.table_name = s.segment_name
group by ut.table_name
ORDER BY ut.table_name;

Note that this does not take the size for CLOB or BLOB columns into account as there is a separate segment for each column.