Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

addon to my last question

Status
Not open for further replies.

mokesql

Programmer
Sep 6, 2001
30
0
0
AT
i want to get all tables which size is over as example 5 mb. is there a sql statement which gets me all the table names of the table who have more than this value?
thnx

kemo
 
select segment_name, bytes from user_segments
where segment_type = 'TABLE';

Take into account that this number represent the number of bytes allocated for inserting rows. This space might be 10%, 20% or 90% free. To have a better idea of the space used by your table, you would have to use the ANALYZE command and check the info in USER_TABLES (I don't know them off the top of my head).
 
select segment_name, bytes from user_segments
where segment_type = 'TABLE'
WHERE bytes > 5242880;

To find tables with over 5M of data (rather than allocated space), analyze the tables, then go to DBA_TABLES -

SELECT table_name, num_rows * avg_row_len data_size
FROM dba_tables
WHERE data_size > 5242880;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top