Flashback table
22:18:24 scan@LEE>conn scott/tiger
已连接。
22:18:30 scott@LEE>create table test_two
22:19:13 2 (id int)
22:19:19 3 tablespace spring;
表已创建。
已用时间: 00: 00: 00.04
22:19:23 scott@LEE>insert into test_one values(1);
insert into test_one values(1)
*
第 1 行出现错误:
ORA-00942: 表或视图不存在
已用时间: 00: 00: 00.03
22:19:38 scott@LEE>insert into test_two values(1);
已创建 1 行。
已用时间: 00: 00: 00.10
22:19:48 scott@LEE>insert into test_two values(2);
已创建 1 行。
已用时间: 00: 00: 00.00
22:19:51 scott@LEE>commit;
提交完成。
已用时间: 00: 00: 00.00
22:19:54 scott@LEE>alter session set nls_date_format='yyyy-mm-dd:hh24:mi:ss';
会话已更改。
已用时间: 00: 00: 00.01
22:20:08 scott@LEE>insert into test_two values(21);
已创建 1 行。
已用时间: 00: 00: 00.00
22:20:15 scott@LEE>insert into test_two values(22);
已创建 1 行。
已用时间: 00: 00: 00.00
22:20:20 scott@LEE>commit
22:20:28 2 ;
提交完成。
已用时间: 00: 00: 00.00
22:20:29 scott@LEE>select *from test_two;
ID
----------
1
2
21
22
已用时间: 00: 00: 00.00
22:20:42 scott@LEE>flashback table test_two to timestamp
22:21:05 2 to_timestamp('2008-06-12 22:19:38','yyyy-mm-dd hh24:mi:ss');
flashback table test_two to timestamp
*
第 1 行出现错误:
ORA-08189: 因为未启用行移动功能, 不能闪回表
已用时间: 00: 00: 00.04
22:21:39 scott@LEE>alter table test_two enable row movement;
表已更改。
已用时间: 00: 00: 00.03
22:22:09 scott@LEE>flashback table test_two to timestamp
22:22:14 2 to_timestamp('2008-06-12 22:19:38','yyyy-mm-dd hh24:mi:ss');
闪回完成。
已用时间: 00: 00: 00.45
22:22:17 scott@LEE>select * from test_two;
未选定行 //回闪到没插入数据之前,显示空,正确!
已用时间: 00: 00: 00.01
22:22:29 scott@LEE>flashback table test_two to timestamp
22:22:47 2 to_timestamp('2008-06-12 22:19:51','yyyy-mm-dd hh24:mi:ss');
闪回完成。
已用时间: 00: 00: 00.18
22:22:53 scott@LEE>select *from test_two;
未选定行 //回闪到第一次提交,未显示任何数据,说明commit是需要时间的!
已用时间: 00: 00: 00.00
22:23:01 scott@LEE>flashback table test_two to timestamp
22:23:08 2 to_timestamp('2008-06-12 22:20:15','yyyy-mm-dd hh24:mi:ss');
闪回完成。
已用时间: 00: 00: 00.37
22:23:37 scott@LEE>select *from test_two;
ID
----------
1
2
已用时间: 00: 00: 00.00
22:23:44 scott@LEE>flashback table test_two to timestamp
22:23:52 2 to_timestamp('2008-06-12 22:20:40','yyyy-mm-dd hh24:mi:ss');
闪回完成。
已用时间: 00: 00: 00.40
22:24:19 scott@LEE>select *from test_two;
ID
----------
1
2
21
22
已用时间: 00: 00: 00.01
22:24:29 scott@LEE>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/11134734/viewspace-344614/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/11134734/viewspace-344614/