Tuesday, 12 August 2014

Oracle: How to Find the Table Size

There are different ways to find table size in oracle, views associated to check size of tables are:

  • DBA_EXTENTS
  • USER_EXTENTS
  • DBA_SEGMENTS

Method 1:

To find size of tables using view DBA_SEGMENTS:

SQL> SELECT SEGMENT_NAME, SEGMENT_TYPE, BYTES/1024/1024 MB, TABLESPACE_NAME
  2  FROM DBA_SEGMENTS
  3  WHERE SEGMENT_TYPE='TABLE' AND SEGMENT_NAME='CUSTOMERS';

SEGMENT_NAME    SEGMENT_TY         MB TABLESPACE_NAME
--------------- ---------- ---------- ------------------------------
CUSTOMERS       TABLE           .0625 SYSTEM














Method 2:

To find size of tables using view DBA_EXTENTS:


SQL>  SELECT SEGMENT_NAME, SEGMENT_TYPE, BYTES/1024/1024 MB, TABLESPACE_NAME
  2   FROM DBA_EXTENTS
  3   WHERE SEGMENT_TYPE='TABLE' AND SEGMENT_NAME='CUSTOMERS';

SEGMENT_NAME    SEGMENT_TY         MB TABLESPACE_NAME
--------------- ---------- ---------- -------------------
CUSTOMERS       TABLE           .0625 SYSTEM


As a user you can also use user_extents.


No comments:

Post a Comment