zoukankan      html  css  js  c++  java
  • TRUNCATE TABLE

    TRUNCATE TABLE [schema.] table
      [ {PRESERVE | PURGE} MATERIALIZED VIEW LOG ]
      [ {DROP [ ALL ] | REUSE} STORAGE ] ;

    STORAGE Clauses

    The STORAGE clauses let you determine what happens to the space freed by the truncated rows. The DROP STORAGE clause, DROP ALL STORAGE clause, and REUSE STORAGE clause also apply to the space freed by the data deleted from associated indexes.

    DROP STORAGE Specify DROP STORAGE to deallocate all space from the deleted rows from the table except the space allocated by the MINEXTENTS parameter of the table. This space can subsequently be used by other objects in the tablespace. Oracle Database also sets the NEXT storage parameter to the size of the last extent removed from the segment in the truncation process. This setting, which is the default, is useful for small and medium-sized objects. The extent management in locally managed tablespace is very fast in these cases, so there is no need to reserve space.

    DROP ALL STORAGE Specify DROP ALL STORAGE to deallocate all space from the deleted rows from the table, including the space allocated by the MINEXTENTS parameter. All segments for the table, as well as all segments for its dependent objects, will be deallocated.

    The DROP ALL STORAGE clause is available starting with Oracle Database 11g Release 2 (11.2.0.2).

    REUSE STORAGE Specify REUSE STORAGE to retain the space from the deleted rows allocated to the table. Storage values are not reset to the values when the table was created. This space can subsequently be used only by new data in the table resulting from insert or update operations. This clause leaves storage parameters at their current settings.

    This setting is useful as an alternative to deleting all rows of a very large table—when the number of rows is very large, the table entails many thousands of extents, and when data is to be reinserted in the future. TRUNCATE TABLE with REUSE STORAGE performs several orders of magnitude faster than deleting all rows, but has the following drawbacks:

    • You cannot roll back a TRUNCATE TABLE statement.

    • All cursors are invalidated.

    • You cannot flash back to the state of the table before the truncate operation.

    This clause is not valid for temporary tables. A session becomes unbound from the temporary table when the table is truncated, so the storage is automatically dropped.

    If you have specified more than one free list for the object you are truncating, then the REUSE STORAGE clause also removes any mapping of free lists to instances and resets the high-water mark to the beginning of the first extent.

  • 相关阅读:
    计算机组成原理小结
    selenium基本操作
    selenium实现网易邮箱的登录注册
    如何安装selenium框架
    2020年目标
    个人对软件测试的认识
    java b2b2c电商系统javashop7.2发布
    基于脚本引擎的运费架构分享
    模拟支付宝微信回调
    Javashop电商系统7.2发布
  • 原文地址:https://www.cnblogs.com/wwxbi/p/4175421.html
Copyright © 2011-2022 走看看