zoukankan      html  css  js  c++  java
  • oracle数据库数据量如何计算,怎么查看oracle数据库数据量大小?

    查看方法:

    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;

    c743562f369a1e0fcc6e51e7d096bc0a.png

     
    -------- 统计表空间数据量大小
     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的意思就是查询出表名和表所占的存储空间大小。

    为人:谦逊、激情、博学、审问、慎思、明辨、 笃行
    学问:纸上得来终觉浅,绝知此事要躬行
    为事:工欲善其事,必先利其器。
    态度:道阻且长,行则将至;行而不辍,未来可期
    转载请标注出处!
  • 相关阅读:
    ngnix 配置反向代理
    tomcat nio
    spring boot 1
    mongodb 总结
    spring profile 多环境配置管理
    分布式锁实现
    2020真难
    NSRunLoopCommonModes和NSDefaultRunLoopMode区别(Timer)
    数据统计---埋点
    【问题汇总】iOS数据持久化
  • 原文地址:https://www.cnblogs.com/ios9/p/15602541.html
Copyright © 2011-2022 走看看