[Oracle] - 查看数据库中每一个表占用空间大小,及进行表压缩

查询用户建立的表

select * from user_tab_comments; -- 查询本用户的表,视图等。
select * from user_col_comments; -- 查询本用户的表的列名和注释。

 

查询全部表大小html

select Segment_Name, Sum(bytes) / 1024 / 1024 / 1024 "size(DB)"
  From User_Extents
 Group By Segment_Name
 order by "size(DB)" desc, Segment_Name

 

查询用户建立的表大小sql

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

 

范例spa

 

关于Oracle表压缩.net

若是是一个已经存在的表要进行压缩也很简单:code

alter table table1 move compress;

若是是一个分区表的话会更加灵活,只须要压缩你想要压缩的表空间就能够了:htm

alter table tables1 move partition part_1 compress;

 

压缩失败blog

ora-00439:是由于未启用功能partitioningit

参数检查:io

select * from v$option

Partitioning falsetable

解决方式:

Partitioning true

 

参考资料

https://blog.csdn.net/silenceray/article/details/78878948https://blog.csdn.net/hahalzb/article/details/6399856https://www.cnblogs.com/seasonzone/p/7206040.htmlhttps://www.cnblogs.com/zhangmen/p/4731606.html

相关文章
相关标签/搜索