Database 11g

Monday, June 6, 2016

How to find Top 10 Fragmented Tables in Oracle


SQL> select * from (select table_name,round((blocks * 8), 2) "size (kb)",round((num_rows *                        avg_row_len / 1024), 2) "actual_data (kb)", (round((blocks * 8), 2) - round((num_rows * avg_row_len / 1024), 2)) "wasted_space (kb)"  from dba_tables where (round((blocks * 8), 2) > round((num_rows * avg_row_len / 1024), 2)) order by 4 desc)WHERE ROWNUM <= 10;


TABLE_NAME                                                   size (kb)     actual_data (kb)      wasted_space (kb)
------------------------------ ---------- ---------------- ---------------------------------------------------------------
SHSHTDTA                                                        2316384       1871077.06         445306.94
TBL_HIJRI_CONTROLS                                  1905392        1552467.5           352924.5
IDL_UB1$                                                          248272           810.97                247461.03
AHTRNHST                                                       1073152        861498.85           211653.15
OTOCURNC                                                       948296         750972.9             197323.1
AHTRNHST_B4_OPENING_FINAL_BILL          595432         469561.71           125870.29
SHDESCPT                                                         124936            44.83                124891.17
OTORDERS                                                        248776         204020.26            44755.74
INVSRVITM                                                        188416         145291.38              43124.62
HISTGRM$                                                         34584           1128.22                  33455.78

10 rows selected.



Happy Learning....

No comments:

Post a Comment