如何确定 Oracle 中的表大小

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27012559/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 00:40:43  来源:igfitidea点击:

How to determine tables size in Oracle

oracleoracle11g

提问by Bers

I use Oracle 11 and want to find out the size of my tables (like in megabytes). What should I do? Should I check the file size on server? Or is there any query to run?

我使用 Oracle 11 并想知道我的表的大小(如以兆字节为单位)。我该怎么办?我应该检查服务器上的文件大小吗?或者是否有任何查询要运行?

回答by user2798256

If you don't have DBA rights then you can use user_segments table:

如果您没有 DBA 权限,则可以使用 user_segments 表:

select bytes/1024/1024 MB from user_segments where segment_name='Table_name'

回答by user2798256

Here is a query, you can run it in SQL Developer (or SQL*Plus):

这是一个查询,您可以在 SQL Developer(或 SQL*Plus)中运行它:

SELECT DS.TABLESPACE_NAME, SEGMENT_NAME, ROUND(SUM(DS.BYTES) / (1024 * 1024)) AS MB
  FROM DBA_SEGMENTS DS
  WHERE SEGMENT_NAME IN (SELECT TABLE_NAME FROM DBA_TABLES)
 GROUP BY DS.TABLESPACE_NAME,
       SEGMENT_NAME;