温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

分区表维护

发布时间:2020-10-15 17:45:35 来源:网络 阅读:427 作者:zylhsy 栏目:数据库

背景:

SEND_CONTROL_HIS1分区表存在大量无用数据,虽不影响性能,但可以删除部分分区节省存储空间。

--查表空间有哪些对象

select owner,segment_name,segment_type,partition_name,bytes/1024/1024 As "占据空间M"

from dba_segments a where a.tablespace_name='PORT_DATA' And segment_name='CONTROL_HIS1'

Order By bytes Desc


实施步骤:

1、删除该表上半年分区

详见附表2:TRACK_PART19以前的数据分区可删除

ALTER TABLE SEND_CONTROL_HIS1 DROP PARTITION TRACK_PART4;

ALTER TABLE SEND_CONTROL_HIS1 DROP PARTITION TRACK_PART5;

ALTER TABLE SEND_CONTROL_HIS1 DROP PARTITION TRACK_PART6;

ALTER TABLE SEND_CONTROL_HIS1 DROP PARTITION TRACK_PART7;

ALTER TABLE SEND_CONTROL_HIS1 DROP PARTITION TRACK_PART8;

ALTER TABLE SEND_CONTROL_HIS1 DROP PARTITION TRACK_PART9;

ALTER TABLE SEND_CONTROL_HIS1 DROP PARTITION TRACK_PART10;

ALTER TABLE SEND_CONTROL_HIS1 DROP PARTITION TRACK_PART11;

ALTER TABLE SEND_CONTROL_HIS1 DROP PARTITION TRACK_PART12;

ALTER TABLE SEND_CONTROL_HIS1 DROP PARTITION TRACK_PART13;

ALTER TABLE SEND_CONTROL_HIS1 DROP PARTITION TRACK_PART14;

ALTER TABLE SEND_CONTROL_HIS1 DROP PARTITION TRACK_PART15;

ALTER TABLE SEND_CONTROL_HIS1 DROP PARTITION TRACK_PART16;

ALTER TABLE SEND_CONTROL_HIS1 DROP PARTITION TRACK_PART17;

ALTER TABLE SEND_CONTROL_HIS1 DROP PARTITION TRACK_PART18;

ALTER TABLE SEND_CONTROL_HIS1 DROP PARTITION TRACK_PART19;


2、清空该表6月份分区

详见附表2:TRACK_PART24以前的数据分区可TRUNCATE

ALTER TABLE SEND_CONTROL_HIS1 TRUNCATE PARTITION TRACK_PART20;

ALTER TABLE SEND_CONTROL_HIS1 TRUNCATE PARTITION TRACK_PART21;

ALTER TABLE SEND_CONTROL_HIS1 TRUNCATE PARTITION TRACK_PART22;

ALTER TABLE SEND_CONTROL_HIS1 TRUNCATE PARTITION TRACK_PART23;

ALTER TABLE SEND_CONTROL_HIS1 TRUNCATE PARTITION TRACK_PART24;


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI