大家好,现在有个棘手的问题就是oracle 要用存储过程来备份数据库中的一个表t1,需要每个月1号备份一次上个月的数据,现在只有个思路就是新建一个表,然后在规定时间来备份t1表,并用时间戳+表名作为备份表的名称,不知道这个思路对不对?还有就是存储过程不熟悉写起来有点困难,希望大家能帮忙提供下详细的思路,如果不对大家还能提供下其他的办法吗?oracle 备份 存储过程 数据结构

解决方案 »

  1.   

    1 用job
    2 加分区。
      

  2.   

    execute immediate 'crete table new_tab select * from old_tab ...'
    另外做分区最好了
      

  3.   


    create or replace procedure prc_bcktable
    as
    begin
         execute immediate 'crete table table_201202 select * from table where datetime >=''201301''';
         --log...
    exception 
    when others then
         dbms_output.put_line(sqlcode||sqlerrm);
         --记录失败日志...
    end;