场景:在做数据库巡检时,检查大表是必不可少的操作,可以查看各表占用表空间的大小 代码: as sizes,q.num_rows,t.segment_type from dba_segments t left join dba_tables q on t.segment_name=q.table_name and t.owner=q.owner where t.segment_type='TABLE' and t.tablespace_name='TS_AAA' --需要查看的表空间 desc
select * from user_tables;--查询所有用户表 select username,default_tablespace from user_users;--查询当前表空间select tablespace_name from dba_tablespaces;--查询所有表空间select tablespace_name, sum(bytes)/1024/1024 from dba_data_files group by tablespace_name;--查询所有表空间大小