【OCP学习1z0-053记录34】SHRINK SPACE COMPACT

96.Examine the following command:
SQL> ALTER TABLE booking SHRINK SPACE COMPACT;
Which activity is performed when the preceding command is executed?
A. The shrink operation touches every block in the BOOKING table
B. The high-water mark (HWM) for the BOOKING table is shifted from its original position
C. The progress of the shrink operation is saved in the bitmap blocks of the BOOKING table
D. The data manipulation language (DML) triggers on the BOOKING table are executed because the shrink operation is internally handled by the INSERT/DELETE operation
Answer: C

如果有长时间运行的查询,而且这些查询可能跨越收缩操作,并尝试从已回收的块中读取数据,则COMPACT子句会很有用。指定SHRINK SPACE COMPACT子句时,收缩操作的进度将保存在相应段的位图块中。这意味着下次在同一个段上执行收缩操作时,Oracle DB Server 可以记住已经执行过的操作。


官方参考:http://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_3001.htm#SQLRF53315


如果指定COMPACT,则Oracle数据库只对段空间进行碎片整理,并压缩表行以供后续版本使用。数据库不调整高水标和不立即释放空间(B)错了。您必须发出另一个ALTER TABLE…稍后收缩空格语句以完成操作。如果您想用两个较短的步骤而不是一个较长的步骤来完成收缩操作,则此子句非常有用。
对于索引或索引组织的表,指定ALTER[索引|表]…收缩空间紧凑相当于指定ALTER [INDEX | TABLE…合并。可以级联theshrink_子句(请参考下面的CASCADE子句),并比合并操作更密集地压缩段,从而提高性能。但是,如果不希望释放未使用的空间,则可以使用适当的COALESCE子句。

猜你喜欢

转载自blog.csdn.net/viviliving/article/details/89329095