如何估算架构中的表大小(Oracle)


11

我正在尝试估算我的架构中的表大小(以MB为单位)。这是我到目前为止所拥有的:

SELECT table_name, owner, last_analyzed
FROM all_tables

我对SQL还是很陌生,所以我不知道该怎么做。

谢谢。

Answers:


10

查看“ dba_segments”视图(如果没有dba权限,则查看user_segments)。以下查询应为您提供所需的信息:

select
  owner as "Schema"
  , segment_name as "Object Name"
  , segment_type as "Object Type"
  , round(bytes/1024/1024,2) as "Object Size (Mb)"
  , tablespace_name as "Tablespace"
from dba_segments
order by owner;

嗨,贝努瓦特,一切正常,谢谢。我查看了可以使用的表字段,但是找不到“所有者”或上次更新的字段。顺便说一下,我使用了user_segments视图。该信息在dba_segments下可用吗?
Diego R

user_segments中显示的所有细分均归您用于登录的帐户所有,这就是为什么没有所有者列的原因。
Benoit

正确的前缀为1024/1024 Mi而不是M(请参阅二进制前缀
Wernfried Domscheit
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.