溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

分區(qū)表維護(hù)

發(fā)布時(shí)間:2020-10-15 17:45:35 來(lái)源:網(wǎng)絡(luò) 閱讀:427 作者:zylhsy 欄目:數(shù)據(jù)庫(kù)

背景:

SEND_CONTROL_HIS1分區(qū)表存在大量無(wú)用數(shù)據(jù),雖不影響性能,但可以刪除部分分區(qū)節(jié)省存儲(chǔ)空間。

--查表空間有哪些對(duì)象

select owner,segment_name,segment_type,partition_name,bytes/1024/1024 As "占據(jù)空間M"

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

Order By bytes Desc


實(shí)施步驟:

1、刪除該表上半年分區(qū)

詳見(jiàn)附表2:TRACK_PART19以前的數(shù)據(jù)分區(qū)可刪除

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月份分區(qū)

詳見(jiàn)附表2:TRACK_PART24以前的數(shù)據(jù)分區(qū)可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問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI