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.

  • 相关阅读:
    API接口认证
    接口测试怎么做
    负载均衡(Load Balance)是分布式系统架构设计中必须考虑的因素之一,它通常是指,将请求/数据【均匀】分摊到多个操作单元上执行,负载均衡的关键在于【均匀】。常见互联网分布式架构如上,分为客户端层、反向代理nginx层、站点层、服务层、数据层。
    软件安全测试的几个原则
    9.22
    9.20
    9.19
    9.15
    9.12作业
    9.8作业
  • 原文地址:https://www.cnblogs.com/wwxbi/p/4175421.html
Copyright © 2011-2022 走看看