Oracle:如何找到表空间中可用空间减少的原因?

Oracle: How to find the cause of decreasing freespace in a tablespace?

我遇到了减少表空间可用空间的问题。可用空间减少了,而且还在继续减少。但是我不知道如何找到这个麻烦的原因。你知道怎么找原因吗?

我会通过以下步骤识别此类问题:

1) 找出您的 table 空间中最大的 table。通常这些 table 会导致您正在搜索的问题。您可以使用以下语句找到这些 table:

select owner,
   segment_name,
   segment_type,
   tablespace_name,
   sum(bytes)/1024/1024 "SIZE (MB)" 
  from dba_segments 
 where tablespace_name = "Your Tablespace"
 group by owner, segment_name, segment_type, tablespace_name
 order by 5 desc;

2) 现在您已经掌握了有关您最大 table 的信息。您现在可以查看它们上次的增长速度。例如,您可以使用优化器历史检查 Table-Growth 并使用以下语句:

    select u.name, o.name, savtime, h.rowcnt
  from sys.user$ u, sys.obj$ o, sys.wri$_optstat_tab_history h
 where h.obj# = o.obj#
   and o.owner# = u.user#
   and u.name = "Your Table/Index Owner"
   and o.name = "Your Table/Index Name"
 order by savtime;

现在轮到你检查这些 table 长那么多是否正常。 如果您无法通过这些步骤找到您的问题,那么您的 Table 空间中也可能存在其他问题。查看 Oracle 文档以了解 Table 碎片化。也许这个 Link 也可以帮助你:https://docs.oracle.com/cd/B28359_01/server.111/b28310/schema003.htm