暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

dba_segments and dba_tables show different numbers for blocks. What has gone wrong ?

2011-01-01
1009

The Oracle (tm) Users' Co-Operative FAQ

dba_segments and dba_tables show different numbers for blocks. What has gone wrong ?


Author's name: Jonathan Lewis

Author's Email: Jonathan@jlcomp.demon.co.uk

Date written: 15th Dec 2002

Oracle version(s): 7 - 9

When I look at the views dba_segments and dba_tables, they show difference values for the number of blocks used for a table. Why ?


This is not a problem.

The dba_segments view tells you about blocks that has been allocated (reserved) in the database for an object. The dba_tables view will be telling you how many blocks from that space had been used the last time you ran the analyze command, or used the dbms_stats package to collect statistics about the table.

Note - the blocks figure recorded in the dba_tables view tells you about the point that the highwater mark for the table had reached. If you delete all the rows from a table, the highwater mark will not move, so the number of blocks used will not (from this perspective) be changed, even when you re-analyze the table. However, if you truncate the table the highwater mark will be reset to zero, and an immediate analyze would show the blocks figures back at zero.

In passing - the dbms_stats package has been the 'advised'' method for collecting CBO-related statistics about object in recent versions of Oracle (probably since 8.1, but perhaps a little earlier).

 


Further reading: FAQ: What's the difference between DELETE ROWS and TRUNCATE TABLE ?



最后修改时间:2020-04-16 15:11:52
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论