业务介绍:
index_data_test一个有8亿行数据的表,有联合索引,其中有2014年(每天几百万,20150401日期字段)的数据(5亿行)和2015的数据(3亿行),下面是把2014年的数据备份到另外一个表里
以下是开发过程的主要流程:
v_flow:='1002';--备份物理网格数据
select count(1)
into v_flagnum
from index_data_test
where acct_date >= v_day_begin
and acct_date <= v_day_end;
--如果有需要备份的数据,才需要后续处理
if v_flagnum>0 then
begin
execute immediate 'drop table index_data_test_tmp1';
exception when others then
null;
end;
--将需要备份的数据存入临时表
v_flow:='100201';
execute immediate '
create table index_data_test_tmp1 nologging parallel 8 as
SELECT /*+ parallel(c,8) */
acct_date,
province_code,
eparchy_code,<