友情提示:請(qǐng)?jiān)跇I(yè)務(wù)空閑是操作。為什么呢?
在溪湖等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供成都網(wǎng)站制作、成都做網(wǎng)站 網(wǎng)站設(shè)計(jì)制作定制網(wǎng)站制作,公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),成都品牌網(wǎng)站建設(shè),成都全網(wǎng)營(yíng)銷推廣,外貿(mào)網(wǎng)站建設(shè),溪湖網(wǎng)站建設(shè)費(fèi)用合理。
--Oracle 11g 間隔分區(qū)(INTERVAL)重命名,批量生成rename分區(qū)腳本 set linesize 180 set serverout on declare v_table_owner varchar2(100) := 'OP%'; v_table_name_day_p varchar2(100); v_table_name_month_p varchar2(100); v_print number:=1; --1:只打印執(zhí)行腳本,2,DB直接執(zhí)行 v_new_partition_name varchar2(100); v_sql varchar2(2000); vSqlerrm varchar2(256); begin for i in (select t1.table_owner, t2.table_name, t1.partition_name, t2.interval, t1.high_value from dba_tab_partitions t1,dba_part_tables t2 where t2.owner = t1.table_owner and t2.table_name = t1.table_name and t1.interval = 'YES' and t2.partitioning_type='RANGE' and t1.partition_name like 'SYS\_%' escape '\' and table_owner like v_table_owner order by t1.table_owner,t1.partition_name) loop if i.interval='NUMTODSINTERVAL(1,''DAY'')' then v_table_name_day_p := substr(i.table_name, 1, 19); --日分區(qū)取前19位字符; execute immediate 'select to_char(' || i.high_value || ' - NUMTODSINTERVAL(1,''DAY''), ''"' || v_table_name_day_p || '"YYYY"M"MM"D"DD'') from dual' into v_new_partition_name; elsif i.interval='NUMTOYMINTERVAL(1,''MONTH'')' then v_table_name_month_p := substr(i.table_name, 1, 23); --月分區(qū)取前23位字符; execute immediate 'select to_char(' || i.high_value || ' - NUMTOYMINTERVAL(1,''MONTH''), ''"' || v_table_name_month_p || '"YYYY"M"MM'') from dual' into v_new_partition_name; end if; if v_print=1 then dbms_output.put_line('alter table ' || i.table_owner || '.' ||i.table_name || ' rename partition ' ||i.partition_name || ' to ' || v_new_partition_name || ';'); elsif v_print=2 then v_sql := 'alter table ' || i.table_owner || '.' ||i.table_name || ' rename partition ' ||i.partition_name || ' to ' || v_new_partition_name; execute immediate v_sql; end if; end loop; exception when others then vSqlerrm := sqlerrm; dbms_output.put_line(vSqlerrm||'|'||v_sql); end;