实例一、
闪回query
1、
修改当前会话的时间格式
SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
Session altered.
2、
查看当前会话的时间
select sysdate from dual;
SYSDATE
-------------------
2013-05-30 11:55:00
3、
查看当前会话的scn
select current_scn from v$database;
CURRENT_SCN
-----------
683444
4、
删除表zsx中的内容
delete from zsx;
1 row deleted.
SQL> commit;
Commit complete.
5、
使用闪回查询的方式,查看以前的zsx表中的数据信息:
用scn的方式查看:
select * from zsx as of 68344;
ID
----------
1
用时间戳来闪回查询:
select * from zsx as of timestamp to_timestamp('2013-05-30 11:55:00','yyyy-mm-dd hh24:mi:ss');
ID
----------
1
注意:
1、
zsx表的结构不能被修改,否则的会报错,不能闪回
ERROR at line 1:
ORA-01466: unable to read data - table definition has changed
2、
如果你使用truncate table 命令删除的数据,那么你也不能闪回
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29107230/viewspace-769173/
,如需转载,请注明出处,否则将追究法律责任。