欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

分区表

程序员文章站 2022-05-05 11:19:56
...

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