欢迎投稿

今日深度:

分区表,oracle分区表

分区表,oracle分区表


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


oracle数据库分区表备份

create table par_tab(
data_date varchar2(8),
col_n varchar2(20)
)
partition by range(data_date)(
partition part_201000 values less than ('201001') tablespace tab_201000,
partition part_201001 values less than ('201002') tablespace tab_201003,
partition part_201002 values less than ('201003') tablespace tab_201003,
partition part_201003 values less than ('201004') tablespace tab_201003,
partition part_201004 values less than ('201005') tablespace tab_201006,
partition part_201005 values less than ('201006') tablespace tab_201006,
partition part_201006 values less than ('201007') tablespace tab_201006,
partition part_201007 values less than ('201008') tablespace tab_201009,
partition part_201008 values less than ('201009') tablespace tab_201009,
partition part_201009 values less than ('201010') tablespace tab_201009,
partition part_201010 values less than ('201011') tablespace tab_201012,
partition part_201011 values less than ('201012') tablespace tab_201012,
partition part_201012 values less than ('201013') tablespace tab_201012,
partition part_201099 values less than ('201099') tablespace tab_201099,
partition part_201100 values less than ('201001') tablespace tab_201000,
partition part_201101 values less than ('201002') tablespace tab_201003,
partition part_201102 values less than ('201003') tablespace tab_201003,
partition part_201103 valu......余下全文>>
 

oracle数据库分区表备份

create table par_tab(
data_date varchar2(8),
col_n varchar2(20)
)
partition by range(data_date)(
partition part_201000 values less than ('201001') tablespace tab_201000,
partition part_201001 values less than ('201002') tablespace tab_201003,
partition part_201002 values less than ('201003') tablespace tab_201003,
partition part_201003 values less than ('201004') tablespace tab_201003,
partition part_201004 values less than ('201005') tablespace tab_201006,
partition part_201005 values less than ('201006') tablespace tab_201006,
partition part_201006 values less than ('201007') tablespace tab_201006,
partition part_201007 values less than ('201008') tablespace tab_201009,
partition part_201008 values less than ('201009') tablespace tab_201009,
partition part_201009 values less than ('201010') tablespace tab_201009,
partition part_201010 values less than ('201011') tablespace tab_201012,
partition part_201011 values less than ('201012') tablespace tab_201012,
partition part_201012 values less than ('201013') tablespace tab_201012,
partition part_201099 values less than ('201099') tablespace tab_201099,
partition part_201100 values less than ('201001') tablespace tab_201000,
partition part_201101 values less than ('201002') tablespace tab_201003,
partition part_201102 values less than ('201003') tablespace tab_201003,
partition part_201103 valu......余下全文>>
 

www.htsjk.Com true http://www.htsjk.com/shujukunews/4163.html NewsArticle 分区表,oracle分区表 --删除分区 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...
评论暂时关闭