纸上得来终觉浅,绝知此事要躬行
分区表的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: