纸上得来终觉浅,绝知此事要躬行

分区表的truncate

上一篇 / 下一篇  2008-04-29 12:59:58 / 个人分类:oracle管理

Truncating Table Partitions Containing Data and Global Indexes

If the partition contains data and global indexes, use one of the following methods to truncate the table partition.

方法1 。先truncate,后rebuild全局索引。

ALTER TABLE sales TRUNCATE PARTITION dec98;
ALTER INDEX sales_area_ix REBUILD;

此法适合于分区表含有大量数据的情况。

方法 2:先delete所有数据,后truncate

DELETE FROM sales WHERE TRANSID < 10000;
ALTER TABLE sales TRUNCATE PARTITION dec98;

此法适合于分区表数据量较小的情况。

方法3:truncate同时带UPDATE GLOBAL INDEXES子句

ALTER TABLE sales TRUNCATE PARTITION dec98
     UPDATE GLOBAL INDEXES

此法在truncate分区的同时将该分区上的索引也truncate


TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

日历

« 2008-05-17  
    123
45678910
11121314151617
18192021222324
25262728293031

数据统计

  • 访问量: 702
  • 日志数: 44
  • 影音数: 1
  • 建立时间: 2008-02-29
  • 更新时间: 2008-05-17

RSS订阅

Open Toolbar