自動SPLIT ORACLE PARTITION
create or replace procedure pro_split_subpart(v_tab varchar2) as
cursor c_subp(v_1 varchar2) is
select *
from user_tab_subpartitions
where table_name = upper(v_1)
and subpartition_name like '%1106%';
v_sql varchar2(4000);
v_p_date varchar2(20);
v_p_prex varchar2(200);
v_p_date2 date;
v_p_date3 date;
v_i number;
v_sql2 varchar2(2000);
v_sql3 varchar2(2000);
v_sql4 varchar2(2000);
begin
for a in c_subp(v_tab) loop
v_sql := 'alter table ' || a.table_name || ' split subpartition ' ||
a.subpartition_name || ' at ';
--分割槽字首
v_p_prex := substr(a.subpartition_name,
1,
instr(a.subpartition_name, '_', 1, 2) );
--分割槽日期
v_P_date := substr(a.subpartition_name,
instr(a.subpartition_name, '_', 1, 2) + 1,
4);
--分割槽時間
v_p_date2 := to_date(v_p_date, 'yymm');
v_i := add_months(v_p_date2, 1) - v_p_date2;
v_p_date2 := add_months(v_p_date2, -1);
for b in 1 .. v_i-1 loop
--(TO_DATE('2009-01-05','YYYY-MM-DD') )
v_sql2 := 'to_date(''' ||
to_char(v_p_date2 + b, 'yyyymmdd') || ''',''yyyymmdd'')';
v_sql3 := 'subpartition ' ||v_p_prex || to_char(v_p_date2 + b, 'yymmdd');
v_sql4 := v_sql || ' ( '||v_sql2||' ) ' || ' into ('||v_sql3||',subpartition '||a.subpartition_name||' ) ';
--dbms_output.put_line(v_sql4);
begin
execute immediate v_sql4;
exception when others then
null;
end;
end loop;
-- dbms_output.put_line(v_sql);
-- dbms_output.put_line(v_sql2);
-- dbms_output.put_line(v_sql3);
v_sql2:='';
v_sql3:='';
v_sql:='';
end loop;
end;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/197458/viewspace-1051237/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- split partition
- SPLIT PARTITION 正式指令碼指令碼
- Oracle Interval Partition 自動分割槽表-實驗Oracle
- split partition的一些測試
- oracle partitionOracle
- Oracle OCP 1Z0 053 Q17(Auto Partition 自動分割槽)Oracle
- oracle partition的方法Oracle
- oracle partition by 語法Oracle
- oracle partition by group by,詳解partition by和group by對比Oracle
- oracle分割槽partition及分割槽索引partition index(一)Oracle索引Index
- Oracle索引分裂(Index Block Split)Oracle索引IndexBloC
- oracle composite partition組合分割槽_composite partition rangeOracle
- UNIX自動啟動oracleOracle
- [Oracle] Partition table exchange Heap tableOracle
- Oracle 分割槽(partition)技術Oracle
- Oracle分割槽表(Partition Table)Oracle
- 【Oracle】ORA-14400: inserted partition key does not map to any partitionOracle
- Oracle RAC自啟動Oracle
- ORACLE AS 自動關閉Oracle
- oracle for linux 自動啟動OracleLinux
- 自動啟動ORACLE Script ServiceOracle
- linux oracle 自動啟動LinuxOracle
- oracle reference partition引用分割槽(一)Oracle
- oracle list partition列表分割槽(一)Oracle
- interval partition自動新增分割槽引起的shared pool 4031錯誤
- Oracle索引塊分裂split資訊彙總Oracle索引
- oracle分割槽及分割槽索引partition_partition index_維護(一)Oracle索引Index
- oracle分割槽及分割槽索引partition_partition index_維護(二)Oracle索引Index
- oracle分割槽及分割槽索引partition_partition index_維護(三)Oracle索引Index
- oracle分割槽及分割槽索引partition_partition index_維護(四)Oracle索引Index
- 【實驗】【PARTITION】RANGE分割槽表移動表分割槽(Move Partition)
- windows開機自動啟動oracleWindowsOracle
- oracle instance and listener自動啟動Oracle
- 讓oracle自動啟動方法!(轉)Oracle
- Oracle 記憶體自動管理--關閉自動管理Oracle記憶體
- partition table and partition indexIndex
- PARTITION partition01
- PARTITION partition02