分區表,oracle分區表

來源:互聯網
上載者:User

分區表,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......餘下全文>>
 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.