snippetModerate
How can I Estimate Table Sizes within Schema (Oracle)
Viewed 0 times
estimatecansizeswithinschemahoworacletable
Problem
I'm trying to estimate the table sizes within my schema (in MB). This is what I have so far:
I'm fairly new to SQL so I have no idea how I would go around doing this.
Thank you.
SELECT table_name, owner, last_analyzed
FROM all_tablesI'm fairly new to SQL so I have no idea how I would go around doing this.
Thank you.
Solution
Look at the "dba_segments" view (or user_segments if you don't have dba rights). The following query should give you what you're looking for:
select
owner as "Schema"
, segment_name as "Object Name"
, segment_type as "Object Type"
, round(bytes/1024/1024,2) as "Object Size (Mb)"
, tablespace_name as "Tablespace"
from dba_segments
order by owner;Code Snippets
select
owner as "Schema"
, segment_name as "Object Name"
, segment_type as "Object Type"
, round(bytes/1024/1024,2) as "Object Size (Mb)"
, tablespace_name as "Tablespace"
from dba_segments
order by owner;Context
StackExchange Database Administrators Q#3457, answer score: 11
Revisions (0)
No revisions yet.