ホームページ >データベース >mysql チュートリアル >分区表
--删除分区 truncate table partition declare day number; begin day := 20110901; loop execute immediate 'alter table lbidw.TB_DW_MGR_01_DAY truncate partition DATA_' || day; day := day 1; exit when day 20110915; end loop; end; --分区大小 SEL
--删除分区 truncate table partition
declare day number;
begin
day := 20110901;
loop
execute immediate 'alter table lbidw.TB_DW_MGR_01_DAY truncate partition DATA_' || day;
day := day + 1;
exit when day > 20110915;
end loop;
end;
--分区大小
SELECT owner,
DECODE (partition_name,
NULL, segment_name,
segment_name || ':' || partition_name
) NAME,
segment_type, tablespace_name, BYTES/1024/1024 , initial_extent, next_extent,
pct_increase, extents, max_extents
FROM dba_segments t
WHERE 1 = 1 AND extents > 1
and t.segment_name like 'TB_MK%'
ORDER BY 9 DESC,
3
;
--统计分区数
select count(*),owner from dba_tables group by owner;