How to check table size in Oracle: Easy Guide

table size in Oracle

In this article, I will provide a detailed guide on how to check table size in Oracle. We’ll walk you through each step of the process with proper screenshots. Let’s open VirtualBox and get started!

1. Particular Table size in Oracle:

COLUMN segment_name FORMAT A30
select segment_name,sum(bytes)/(1024*1024) "TABLE_SIZE_MB" from dba_extents where segment_type='TABLE' and owner=upper('&OWNER') and segment_name =upper('&SEGMENT_NAME') group by segment_name;
How to check table size in Oracle: Easy Guide

Please provide the table owner’s name and table name(segment_name) once asked to enter. In our example, we checked the size of the table called EMPLOYEES of the owner HR.

If you want to check the size in GB, then you can run the below query:

COLUMN segment_name FORMAT A30
select segment_name,sum(bytes)/(1024*1024*1024) "TABLE_SIZE_GB" from dba_extents where segment_type='TABLE' and owner=upper('&OWNER') and segment_name =upper('&SEGMENT_NAME') group by segment_name;
How to check table size in Oracle: Easy Guide

2. Each Table Size under a Schema:

COLUMN table_name FORMAT A30
select segment_name table_name,sum(bytes)/(1024*1024) TABLE_SIZE_MB
from dba_extents where segment_type='TABLE' and owner=upper('&OWNER') group by segment_name order by 2 desc;
How to check table size in Oracle: Easy Guide

Just provide the schema/user/owner name and you will get all the table sizes under that schema. In this example, We have provided checked the sizes of all the tables under the schema HR.

If you want to check the table size in GB then run the below query:

COLUMN table_name FORMAT A30
select segment_name table_name,sum(bytes)/(1024*1024*1024) TABLE_SIZE_GB
from dba_extents where segment_type='TABLE' and owner=upper('&OWNER') group by segment_name order by 2 desc;
How to check table size in Oracle: Easy Guide

I hope you found this article helpful. Feel free to reach out if you have any questions. Looking for more? Dive into our comprehensive guide on How to check index size in Oracle.

This Post Has 2 Comments

Leave a Reply