DBA Tips Archive for Oracle

  


How to efficiently drop a table with many extents

by Jeff Hunter, Sr. Database Administrator

Overview

While attempting to drop a table with many extents, the user process (shadow process) can take a considerable amount of CPU. Most of the processing here (for Dictionary Extent Management) involves moving used extents (sys.uet$) to free extents (sys.fet$). This month I will provide a solution to assist the DBA when attempting to drop a table with a considerable amount of extents.

Major Steps Involved

  1. Identifiy, but DO NOT drop the table.
  2. Truncate the table, specifying the REUSE STORAGE clause. This operation should be quick as the actual extents are NOT deallocated. The highwater mark is simply adjusted to the segment header block.
  3. Deallocated unused extents from the table specifying the UNUSED KEEP clause. This is the key step in the process. Here, the DBA can control how many extents are to be deallocated by specifiying how much (in terms of Kb or Mb) of the table is NOT to be deallocated.

Example

Consider a table called BIGTABLE. The size of this table is 2G and consists of 262144 8Kb extents. In this example, we are working with a small CPU and past experience has shown that dropping a table of this size (and this many extents) would take several days. Also in this example, the system has very little usage at night. (Batch / CRON Jobs). In this case, you could drop the table in stages using the procedures below. Assume that it would take 3 days (72 hours) to drop the table. We decide to spread this out over 6 nights. (i.e. drop 1/3 Gb per night).

Notes



Copyright (c) 1998-2017 Jeffrey M. Hunter. All rights reserved.

All articles, scripts and material located at the Internet address of http://www.idevelopment.info is the copyright of Jeffrey M. Hunter and is protected under copyright laws of the United States. This document may not be hosted on any other site without my express, prior, written permission. Application to host any of the material elsewhere can be made by contacting me at jhunter@idevelopment.info.

I have made every effort and taken great care in making sure that the material included on my web site is technically accurate, but I disclaim any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on it. I will in no case be liable for any monetary damages arising from such loss, damage or destruction.

Last modified on
Monday, 07-Jan-2002 00:00:00 EST
Page Count: 20932