查詢用戶創建的表
select * from user_tab_comments; -- 查詢本用戶的表,視圖等。 select * from user_col_comments; -- 查詢本用戶的表的列名和注釋。
查詢所有表大小
select Segment_Name, Sum(bytes) / 1024 / 1024 / 1024 "size(DB)" From User_Extents Group By Segment_Name order by "size(DB)" desc, Segment_Name
查詢用戶創建的表大小
select UT.table_name, x.TABLE_SIZE from user_tab_comments ut, (select Segment_Name, Sum(bytes) / 1024 / 1024 / 1024 as "TABLE_SIZE" From User_Extents Group By Segment_Name) x where ut.table_type = 'TABLE' and ut.table_name = x.Segment_Name(+) order by x.TABLE_SIZE desc
范例
關於Oracle表壓縮
如果是一個已經存在的表要進行壓縮也很簡單:
alter table table1 move compress;
如果是一個分區表的話會更加靈活,只需要壓縮你想要壓縮的表空間就可以了:
alter table tables1 move partition part_1 compress;
壓縮失敗
ora-00439:是因為未啟用功能partitioning
參數檢查:
select * from v$option
Partitioning false
解決方式:
Partitioning true
參考資料
https://blog.csdn.net/silenceray/article/details/78878948
https://blog.csdn.net/hahalzb/article/details/6399856
https://www.cnblogs.com/seasonzone/p/7206040.html
https://www.cnblogs.com/zhangmen/p/4731606.html