(C) 版权所有 1985-2001 Microsoft Corp.
C:\Documents and Settings\Administrator>sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on 星期一 8月 24 15:00:48 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn test01/test01
已连接。
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
TEST01 TABLE
TEST02 TABLE
SQL> select * from test01;
ID
----------
1
2
3
SQL> select to_char(sysdate,'YYYY-MM-DD HH24:MI:SS') from dual;
TO_CHAR(SYSDATE,'YY
-------------------
2009-08-24 15:01:53
SQL> delete test01;
已删除3行。
SQL> commit;
提交完成。
SQL> select * from test01;
未选定行
SQL> select * from test01 as of timestamp to_timestamp('2009-08-24 15:00:00','YYYY-MM-DD HH24:MI:SS');
ID
----------
1
2
3
SQL> insert into test01 select * from test01 as of timestamp to_timestamp('2009-08-24 15:00:00','YYYY-MM-DD HH24:MI:SS');
已创建3行。
SQL> select * from test01;
ID
----------
1
2
3
SQL> commit;
提交完成。
C:\Documents and Settings\Administrator>sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on 星期一 8月 24 15:11:21 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn test/test
已连接。
SQL> select * from test01;
ID
----------
1
2
3
SQL> select dbms_flashback.get_system_change_number from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
769705
SQL> delete test01;
已删除3行。
SQL> commit;
提交完成。
SQL> select * from test01;
未选定行
SQL> select * from test01 as of scn 769705;
ID
----------
1
2
3
SQL> insert into test01 select * from test01 as of scn 769705;
已创建3行。
SQL> select * from test01;
ID
----------
1
2
3
SQL> commit;
提交完成。
SQL>
***************************************************************
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:\Documents and Settings\Administrator>sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on 星期一 8月 24 15:35:23 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn test01/test01
已连接。
SQL> select to_char(sysdate,'YYYY-MM-DD HH24:MI:SS') from dual;
TO_CHAR(SYSDATE,'YY
-------------------
2009-08-24 15:35:54
SQL> select * from test01;
ID
----------
1
2
3
SQL> select * from test02;
ID NAME
---------- ----------
1 test
2 test
3 test
SQL> delete test01;
已删除3行。
SQL> insert into test02 values(4,'test4');
已创建 1 行。
SQL> insert into test02 values(5,'test5');
已创建 1 行。
SQL> commit;
提交完成。
SQL> select * from test01;
未选定行
SQL> select * from test02;
ID NAME
---------- ----------
4 test4
5 test5
1 test
2 test
3 test
SQL>exec dbms_flashback.enable_at_time(to_timestamp('2009-08-24 15:35:00','YYYY-MM-DD HH24:MI:SS'));
PL/SQL 过程已成功完成。
SQL> select * from test01;
ID
----------
1
2
3
SQL> select * from test02;
ID NAME
---------- ----------
1 test
2 test
3 test
SQL> execute dbms_flashback.disable();
PL/SQL 过程已成功完成。
SQL> select * from test01;
未选定行
SQL> select * from test02;
ID NAME
---------- ----------
4 test4
5 test5
1 test
2 test
3 test
SQL>
***************************************************************
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:\Documents and Settings\Administrator>sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on 星期一 8月 24 15:47:38 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn test01/test01
已连接。
SQL> select dbms_flashback.get_system_change_number from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
771108
SQL> select * from test01;
未选定行
SQL> select * from test02;
ID NAME
---------- ----------
4 test4
5 test5
1 test
2 test
3 test
SQL> insert into test01 values(1);
已创建 1 行。
SQL> insert into test01 values(2);
已创建 1 行。
SQL> insert into test01 values(3);
已创建 1 行。
SQL> insert into test01 values(4);
已创建 1 行。
SQL> insert into test01 values(5);
已创建 1 行。
SQL> delete test02;
已删除5行。
SQL> commit;
提交完成。
SQL> select * from test01;
ID
----------
1
2
3
4
5
SQL> select * from test02;
未选定行
SQL>exec dbms_flashback.enable_at_system_change_number(771108);
PL/SQL 过程已成功完成。
SQL> select * from test01;
未选定行
SQL> select * from test02;
ID NAME
---------- ----------
4 test4
5 test5
1 test
2 test
3 test
SQL> execute dbms_flashback.disable;
PL/SQL 过程已成功完成。
SQL> select * from test01;
ID
----------
1
2
3
4
5
SQL> select * from test02;
未选定行
SQL>
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/728081/viewspace-613094/ ,如需转载,请注明出处,否则将追究法律责任。