oracle闪回技术
undo数据保留7天 NAME TYPE VALUE 604800/60/60/24 1:闪回查询,利用undo 查询指定时间点的表数据 select * from scott.acct as of timestamp TO_TIMESTAMP(‘2018-05-20 15:30:00‘,‘ yyyy-mm-dd hh24:mi:ss‘)? WHERE user_id = 1; 2:闪回表 闪回表(Flashback table)是利用undo信息来恢复表对象到以前的某一个时间点(一个快照) SQL>flashback table test to timestamp to_timestamp(‘2018-05-20 15:30:00‘,‘ yyyy-mm-dd hh24:mi:ss‘) ; SQL>flashback table test to timestamp scn 115544; SQL>flashback table test to timestamp to_timestamp(‘2018-05-20 15:30:00‘,‘ yyyy-mm-dd hh24:mi:ss‘) enable triggers; 运用闪回表前提? 1)普通用户中需要有Flashback any table的系统权限。命令如:? SQL>grant flashback any table?to?scott;? 2)有该表的select、insert、delete、alter权限。? 3)必须保证该表有row movement(行移动)。 恢复表到过去的某个时间点,恢复test表到刚记录的时间点(或scn),由于表中存在触发器,因此使用了关键字enable triggers; flashback table test to timestamp to_timestamp(‘2018-05-20 15:30:00‘,‘ yyyy-mm-dd hh24:mi:ss‘) enable triggers; ? 3:闪回数据归档 查询过去一段时间的状态 select versions_startscn,versions_endscn,versions_starttime,versions_endtime,versions_xid,versions_operation,ORDER_ID from scott.emp WHERE ORDER_ID in (100827979,100827973,100785947); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |