Home > Database > Mysql Tutorial > 分区表

分区表

WBOY
Release: 2016-06-07 16:06:31
Original
1197 people have browsed it

--删除分区 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;

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template