您好,欢迎来到微智科技网。
搜索
您的当前位置:首页Oracle表空间利用率及对象大小查询

Oracle表空间利用率及对象大小查询

来源:微智科技网


1. 查看所有表空间大小 SQLgt; select tablespace_name,sum(bytes)/1024/1024 M from dba_data_files group by tablespace_name

1. 查看所有表空间大小

SQL> select tablespace_name,sum(bytes)/1024/1024 M from dba_data_files group by tablespace_name;

2. 已经使用的表空间大小
SQL> select tablespace_name,sum(bytes)/1024/1024 M from dba_free_space group by tablespace_name;

3. 所以使用空间可以这样计算

select a.tablespace_name,total,free,total-free used from
( select tablespace_name,sum(bytes)/1024/1024 total from dba_data_files
group by tablespace_name) a,
( select tablespace_name,sum(bytes)/1024/1024 free from dba_free_space
group by tablespace_name) b
where a.tablespace_name=b.tablespace_name;


4. 下面这条语句查看所有segment的大小。
Select Segment_Name,Sum(bytes)/1024/1024 From User_Extents Group By Segment_Name

5. 还有在命令行情况下如何将结果放到一个文件里。
SQL> spool out.txt
SQL> select * from v$database;
SQL> spool off

更多Oracle相关信息见Oracle 专题页面 ?tid=12

Copyright © 2019- 7swz.com 版权所有 赣ICP备2024042798号-8

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务