【MOS】EVENT: DROP_SEGMENTS - cleanup of TEMPORARY segments (文档 ID 47400.1)

【MOS】EVENT: DROP_SEGMENTS - Forcing cleanup of TEMPORARY segments (文档 ID 47400.1)




***Checked for relevance on 14-Jun-2012***

 The DROP_SEGMENTS event
~~~~~~~~~~~~~~~~~~~~~~~
 Available from 8.0 onwards.

   DESCRIPTION Finds all the temporary segments in a tablespace which are not
     currently locked and drops them.
     For the purpose of this event a "temp" segment is defined as a
     segment (seg$ entry) with TYPE#=3. Sort space in a TEMPORARY
     tablespace does not qualify under this definition as such
     space is managed independently of SEG$ entries.

   PARAMETERS
     level - tablespace number+1. If the value is 2147483647 then
             temp segments in ALL tablespaces are dropped, otherwise, only
             segments in a tablespace whose number is equal to the LEVEL
             specification are dropped.

   NOTES
     This routine does what SMON does in the background, i.e. drops
     temporary segments. It is provided as a manual intervention tool which
     the user may invoke if SMON misses the post and does not get to
     clean the temp segments for another 2 hours. We do not know whether
     missed post is a real possibility or more theoretical situation, so
     we provide this event as an insurance against SMON misbehaviour.

     Under normal operation there is no need to use this event.

     It may be a good idea to
        alter tablespace <tablespace> coalesce;
     after dropping lots of extents to tidy things up.

 *SQL Session (if you can connect to the database):
    alter session set events 'immediate trace name DROP_SEGMENTS level TS#+1';

     The TS# can be obtained from v$tablespace view:
     select ts# from v$tablespace where name = '<Tablespace name>';

     Or from SYS.TS$:

     select ts# from sys.ts$ where name = '<Tablespace name>' and online$ != 3;

     If ts# is 5, an example of dropping the temporary segments in that tablespace
     would be:

    alter session set events 'immediate trace name DROP_SEGMENTS level 6'; 


Master Note: Database System Monitor Process (SMON) (文档 ID 1495163.1)

Temporary Segment Cleanup



Oracle Database often requires temporary workspace for intermediate stages of SQL statement execution. Typical operations that may require a temporary segment include sorting, hashing, and merging bitmaps. While creating an index, Oracle Database also places index segments into temporary segments and then converts them into permanent segments when the index is complete.

Oracle Database does not create a temporary segment if an operation can be performed in memory. However, if memory use is not possible, then the database automatically allocates a temporary segment on disk.

Temporary segments will also be created for the following operations a well.

  • CREATE TABLE AS SELECT
  • ALTER INDEX REBUILD
  • DROP TABLE
  • CREATE SNAPSHOT
  • CREATE PARTITION TABLE

When does SMON cleanup temporary segments?

During normal operations, user processes that create temporary segments are responsible for cleanup. If the user process dies before cleaning them up, or the user process receives an error causing the statement to fail, SMON is posted to do the cleanup.

  • Sort segments residing in PERMANENT tablespace are cleaned up by SMON after the sort is completed.
  • For performance issues, extents in TEMPORARY tablespaces are not released or deallocated once the operation is complete. Instead, the extent is simply marked as available for the next sort operation. SMON cleans up the segments at startup.

SMON also might get tied up cleaning uncommitted transactions though, and be too busy to process requests to grow an existing sort segment. Starting with Oracle 8i, playing around with fast_start_parallel_rollback might workaround that.In addition, actions like CREATE INDEX create a temporary segment for the index, and only convert it to permanent once the index has been created. Also, DROP <object> converts the segment to temporary and then cleans up the temporary segment.

Temporary Segments in a Permanent Tablespace

The background process System Monitor (SMON) frees the temporary segments when the statement has been completed.If a large number of sort segments has been created, then SMON may take some time to drop them; this process automatically implies a loss of overall database performance.After SMON has freed up the temporary segment, the space is released for use by other objects.

Temporary Segments in a Temporary Tablespace

The background process SMON actually de-allocates the sort segment after the instance has been started and the database has been opened. Thus, after the database has been opened, SMON may be seen to consume large amounts of CPU as it first de-allocates the (extents from the) temporary segment, and after that performs free space coalescing of the free extents created by the temporary segment cleanup. This behavior will be exaggerated if the temporary tablespace, in which the sort segment resides, has inappropriate (small) default NEXT storage parameters.

How to identify whether SMON is cleaning up temporary extents ?

Check whether there are a large number of temporary extents that might be being cleaned up by running the following query a few times

 

  • <>

 

 

 
 

 



    

时间: 2024-10-28 13:29:14

【MOS】EVENT: DROP_SEGMENTS - cleanup of TEMPORARY segments (文档 ID 47400.1)的相关文章

【MOS】Cluster Health Monitor (CHM) FAQ (文档 ID 1328466.1 ID 2062234.1)

11gR2 新特性:Oracle Cluster Health Monitor(CHM)简介 Cluster Health Monitor(以下简称CHM)是一个Oracle提供的工具,用来自动收集操作系统的资源(CPU.内存.SWAP.进程.I/O以及网络等)的使用情况.CHM会每秒收集一次数据.    这些系统资源数据对于诊断集群系统的节点重启.Hang.实例驱逐(Eviction).性能问题等是非常有帮助的.另外,用户可以使用CHM来及早发现一些系统负载高.内存异常等问题,从而避免产生更严

【MOS】12c DataPump EXPORT (EXPDP) Enhancements (文档 ID 2171666.1)

          >   > > >             

【MOS】Parameter FILESIZE - Multiple Export Files (文档 ID 290810.1)

                                                                                        >                     >        >      >                                                                 >                                               

【MOS】Redundant Interconnect ora.cluster_interconnect.haip (文档 ID 1210883.1)

                                    <>                                                                                                                                                                                  >                             

【MOS】Troubleshooting Performance Issues (文档 ID 1377446.1)

[MOS]Troubleshooting Performance Issues (文档 ID 1377446.1) In this Document Purpose   Best Practices   Pro-Active Problem Avoidance and Diagnostic Collection   Performance Service Request Diagnostic Collection (SRDC) documents Troubleshooting Steps  

【MOS】Top Ten Performance Mistakes Found in Oracle Systems. (文档 ID 858539.1)

In this Document Purpose Troubleshooting Steps References APPLIES TO: Oracle Database - Enterprise Edition - Version 9.2.0.8 and laterInformation in this document applies to any platform.RDBMS PURPOSE The purpose of this note is to inform reader abou

【MOS】中文文档列表 - Oracle Database (文档 ID 1533057.1)

中文文档列表 - Oracle Database (文档 ID 1533057.1) 类型: 状态: 上次主更新: 上次更新: ANNOUNCEMENT PUBLISHED 2017-2-23 2017-2-23     文档内容 详细信息 操作   Oracle 数据库技术支持通讯   安装/升级/降级/迁移相关     日常管理相关   性能相关     集群及存储相关   高可用相关   TimesTen 内存数据库 联系人 参考 适用于: Oracle Database - Enterp

【MOS】OCR/Vote disk 维护操作: (添加/删除/替换/移动) (文档 ID 1674859.1)

[MOS]OCR/Vote disk 维护操作: (添加/删除/替换/移动) (文档 ID 1674859.1) 文档内容 目标 解决方案   准备磁盘   1. 磁盘大小   2. 裸设备或者块设备 (pre 11.2)   3. ASM disks (11.2+)   4. 集群文件系统   5. 权限   6. 冗余   添加/删除/替换/移动 OCR device   1. 当只有一个 OCR 设备时,添加一个 OCRMIRROR 设备:   2. 删除一个 OCR 设备   3. 替换

【MOS】Limitations of the Oracle Cost Based Optimizer (文档 ID 212809.1)

[MOS]Limitations of the Oracle Cost Based Optimizer (文档 ID 212809.1) APPLIES TO: Oracle Database - Personal Edition - Version 7.1.4.0 and laterOracle Database - Enterprise Edition - Version 6.0.0.0 and laterOracle Database - Standard Edition - Versio