项目还在开发阶段,表里有很多实验数据,虽然有用但是不常用。
所以希望能建立一个备份的表,把某天之前的数据都导入备份表后,再删掉原表中的数据,请问该怎么做 ?多谢!

解决方案 »

  1.   

    直接EMP啊,里面加个条件就可以了
      

  2.   

    create table 表名_bak as select * from 表 where 1=1 and 日期条件 
      

  3.   


    表里有没有时间的字段?可以用这个备份表,
    create table table_bk as select * from target_table where ...然后在truncate table table_name.truncate 能把所有数据都删除,且保留目录结构. 但不会放在表空间的recycle中,无法进行flashback 恢复。不过这样能释放表空间,不会出现高水位的问题。
      

  4.   

     表里有时间字段,update_time,默认值是sysdate().
      

  5.   


    那试试:
    create table table_bk as select * from tb where update_time < (sysdate -2);
    或者
    create table table_bk as select * from tb where update_time < to_date('2009-10-24','YYYY-MM-DD');创建备份后在删除就数据..
      

  6.   

    补充一点:
    先看下系统时间日期格式
    Select sysdate from dual;update_time < to_date('2009-10-24','YYYY-MM-DD'); 
    如果格式不一致,可能匹配不到结果. 
      

  7.   

    truncate可以带条件么?  还是需要用delete删?
      

  8.   

    truncate可以带条件么?  还是需要用delete删?
      

  9.   


    truncate 不可以带where 条件,
    要是带where 条件只能用delete..
      

  10.   

    第一步:exp 用户名/密码@数据库名 e:\\11.dmp tables(用户表) where 表时间字段='select sysdate-1 from dual'。第二步:delete 表名 where 表时间字段='select sysdate-1 from dual'。