Welcome 微信登录

首页 / 数据库 / MySQL / update commit后找回update前数据

t_sys_client 

1.首先创建临时表
[sql]
  1. create table tmp as  select * from t_sys_client  where 1=0;  
2. 将查询的记录插入到 临时表
[sql]
  1. insert into tmp select * from t_sys_client  as of timestamp sysdate-10/1440;    --10分钟之前的数据  
select * from t2 as of timestamp sysdate-1/1440         -->  1 代表 1分钟前,改成5 代表 5分钟前
这时候临时就是你以前的表了,可以用 where 。 但是,如果十分钟之内,我对t_sys_client 的那一条记录update了两次,这时tmp表中的,就只有最近一次update的历史记录了。要知道这个历史记录上一次的记录,那就在建立一张临时表 insert into tmp1 select * from t_sys_client  as of timestamp sysdate-10/1440   
这就需要那大概知道 第二个 update 时间了   指定精准时间
insert into tmp1  select * from t2 as of timestamp to_timestamp("2011-07-12 10:30:00", "YYYY-MM-DD HH24:MI:SS");

 闪回是10g新特性,那么闪回可以关掉吗?闪回分 表闪回和数据库闪回,

数据库闪回默认是关闭的,需要手动开启

表闪回是通过 undo 闪回的,刚才的操作是通过 undo 恢复的Oracle sql%rowcount 返回影响行数Oracle表空间创建删除,omf,分区表创建相关资讯      Oracle基础教程 
  • Oracle块编程返回结果集详解  (11/10/2013 10:45:58)
  • Oracle基础教程之设置系统全局区  (08/22/2013 14:24:00)
  • Oracle基础教程知识点总结  (06/18/2013 07:43:32)
  • Oracle基础教程之tkprof程序详解  (10/22/2013 11:49:50)
  • Oracle基础教程之sqlplus汉字乱码  (07/18/2013 16:30:00)
  • Oracle 管理之 Linux 网络基础  (02/16/2013 18:37:35)
本文评论 查看全部评论 (0)
表情: 姓名: 字数