Check the size of table or partition in Oracle

Check the table size in Oracle

select segment_name,sum(bytes)/1024/1024/1024 GB from dba_segments where segment_name='TABLE_NAME' and segment_type = 'TABLE';

Check the size of table from user_tables

Select table_name, round((blocks*8)/1024,2)||'MB' "size" from USER_tables where table_name = 'EMP';

Check the actual size of table according to row data

select table_name, round((num_rows*avg_row_len/1024/1024),2)||'MB' "size" from user_tables  where table_name = 'EMP';

Check the size of Partition for a table

select PARTITION_NAME,sum(bytes)/1024/1024/1024 GB from dba_segments where SEGMENT_NAME=upper('TABLE_NAME') and PARTITION_NAME=upper('Partiton_name') group by PARTITION_NAME;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.