https://www.jianshu.com/p/94714444d94c
背景
用達夢 dump命令匯出 一個庫出來,但有一些表資料量或佔空間極大,好幾個G,這些資料都不需要的,所以就想找出究竟是哪些表,資料量最多,佔空間最大
使用
終於找到這麼一個語句,在此記錄:
select t.owner TABLE_SCHEMA,TABLE_NAME, num_rows TABLE_ROWS,
s.BYTES /1024/1024 TABLE_VOLUME -- 以M為單位
from dba_tables t
left join dba_segments s on t.table_name=s.segment_name
where t.owner = 'JCDSJ'
and t.table_name = s.segment_name
and t.owner = s.owner
order by TABLE_VOLUME DESC;
執行結果:
JCDSJ t_box5 1270
JCDSJ t_signal_spm 129
JCDSJ t_dd_box2_fusion_year 117
JCDSJ t_dd_box1_fusion_year 115
JCDSJ t_dd_box1_fusion_weekly 109
JCDSJ t_dd_box2_fusion_weekly 97
JCDSJ t_dd_box4_fusion_day 95
JCDSJ t_dd_box3_fusion_day 94