查看方法:
1、查看所有表空间及表空间大小:select tablespace_name ,sum(bytes) / 1024 / 1024 as MB from dba_data_files group by tablespace_name;
2、查看所有表空间对应的数据文件:select tablespace_name,file_name from dba_data_files;
3、修改数据文件大小:alter database datafile \'H:\ORACLE\PRODUCT\10.1.0\ORADATA\ORACLE\USERS01.DBF\' RESIZE 10240M;
-------- 统计表空间数据量大小 select tablespace_name ,sum(bytes) / 1024 / 1024/1024 as GB from dba_data_files group by tablespace_name; ----重新表空间下 的表信息 select table_name from all_tables where TABLESPACE_NAME=\'POST_STADY\' ; ------重新表空间下 的表信息 select * from user_tables where TABLESPACE_NAME=\'POST_STADY\'; ----重新数据库用户下的表信息 select * from all_tables where owner=\'POST_STADY\'; ----- 统计数据库用户下的表数据量大小 select aa.* from (select a.segment_name, a.segment_type, a.bytes, a.bytes /1024/1024 byte_m, b.created from dba_segments a inner join all_objects b on b.object_type = \'TABLE\' and a.owner = b.owner and a.segment_name = b.object_name where a.owner = \'POST_STADY\' and a.segment_type = \'TABLE\' /* and a.bytes>50000000*/ ) aa ,all_tables b where aa.segment_name=b.table_name and b.owner=\'POST_STADY\' order by aa.byte_m asc ;
扩展资料
每张表都是作为“段”来存储的,可以通过user_segments视图查看其相应信息。段(segments)的定义:如果创建一个堆组织表,则该表就是一个段。sql:SELECT segment_name AS TABLENAME,BYTES FROM user_segments WHERE segment_name=\'表名\'。
解释:segment_name 就是要查询的表名(大写),BYTES 为表存储所占用的字节数。本sql的意思就是查询出表名和表所占的存储空间大小。