Sunday, February 13, 2011

Size of Table , Tablespace used and free space

Size of the table in Bytes ==>>


To find the size of bytes allocated to a table:==>>>

sql > analyze table emp compute statistics;


sql > select num_rows * avg_row_len "Bytes Used" from dba_tables where table_name = 'TEST';


Bytes Used
-----------
560

sql > select bytes "Bytes Allocated" from dba_segments where segment_name = 'TEST';


Bytes Allocated
----------
524288

The result of the query shows that the emp table is using 560 bytes of the 524,288 bytes allocated to it.



**** you can use user_segments too...if u don't have the dba privileges ******



************** Size of Tablespace used and Free space *****************

Size of all Tablespace in your database in GB:==>>

SYS@MOB1BT> select tablespace_name,sum(bytes)/(1024*1024*1024) "GB" from dba_data_files group by tablespace_name order by 1;


TABLESPACE_NAME GB
------------------------------ ----------
AUDIT1 1.953125
GENUSER .48828125
HUGE_DATA 7.20000458
LARGE_DATA 7.20000458
LARGE_INDX 2.734375
SYSAUX 4.8828125
SYSTEM .48828125
TOOLS .48828125
UNDOTBS .48828125
USERS 3.6000061
USER_INDX 4.1015625

11 rows selected.


Size of all Tablespace in your database free space in GB:==>>


SYS@MOB1BT> select tablespace_name,sum(bytes)/(1024*1024*1024) from dba_free_space group by tablespace_name order by 1;

TABLESPACE_NAME SUM(BYTES)/(1024*1024*1024)
------------------------------ ---------------------------
AUDIT1 1.95269775
GENUSER .488098145
HUGE_DATA 7.19992065
LARGE_DATA 7.19992065
LARGE_INDX 2.73117065
SYSAUX 4.64660645
SYSTEM .116516113
TOOLS .488220215
UNDOTBS .424743652
USERS .228088379
USER_INDX 3.72009277

11 rows selected.

No comments:

Post a Comment