查看所有表空间大小
SQL> select tablespace_namesum(bytes)// from dba_data_files
group by tablespace_name;
或者 select tablespace_name from user_tablespaces;
已经使用的表空间大小
SQL> select tablespace_namesum(bytes)// from dba_free_space
group by tablespace_name;
所以使用空间可以这样计算
select atablespace_nametotalfreetotalfree used from
( select tablespace_namesum(bytes)// total from dba_data_files
group by tablespace_name) a
( select tablespace_namesum(bytes)// free from dba_free_space
group by tablespace_name) b
where atablespace_name=btablespace_name;
下面这条语句查看所有segment的大小
Select Segment_NameSum(bytes)// From User_Extents Group By Segment_Name
还有在命令行情况下如何将结果放到一个文件里
SQL> spool outtxt
SQL> select * from v$database;
SQL> spool off