数据库

 首页 > 数据库 > Oracle > Oracle表空间利用率及对象大小查询

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

分享到:
【字体:
导读:
         摘要:1.查看所有表空间大小SQL>selecttablespace_name,sum(bytes)/1024/1024Mfromdba_data_filesgroupbytablespace_name;2.已经使用的表空间大小SQL>selecttablespace_name,sum(bytes)/1024/....

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

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  www.2cto.com  
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
 
 
 
摘自 wuweilong的专栏
Oracle表空间利用率及对象大小查询
分享到:
dbms_metadata遇到ORA-31603的解决方案
dbms_metadata遇到ORA-31603的解决方案   环境: OS:Red Hat Linux As 5 DB:10.2.0.1   1.用户A获取用户B下的表的DDL报如下错误 SQL> SELECT dbms_metadata.get_ddl('TABLE','TB_TEST','USER_B') FROM dual; ERROR: ORA-31603: object "TB_TEST" of type TABLE not found in schema "USER_B...
oracle的connect by语句分析
oracle的connect by语句分析 oracle中可以用CONNECT BY子句实现递归查询,其基本语法是:   select ... from   where start with connect by order siblings by ;   :过滤条件,用于对返回的所有记录进行过滤。(关联条件和过滤条件有区别,关联条件最先执行)  www.2cto.com   :根节点条件,只用于第一次过滤...
  •         php迷,一个php技术的分享社区,专属您自己的技术摘抄本、收藏夹。
  • 在这里……