Chinaunix首页 | 论坛 | 博客
  • 博客访问: 548909
  • 博文数量: 154
  • 博客积分: 4055
  • 博客等级: 上校
  • 技术积分: 1381
  • 用 户 组: 普通用户
  • 注册时间: 2006-04-01 14:26
文章分类

全部博文(154)

文章存档

2014年(2)

2013年(2)

2011年(2)

2010年(11)

2009年(9)

2008年(35)

2007年(22)

2006年(71)

我的朋友

分类: WINDOWS

2007-03-22 09:13:20

好久没有写blog了,好有亲切感,一次闪回的测试,共享一下,呵呵

SQL> alter table emp enable row movement;
Table altered
SQL> insert into emp select * from scott.emp;
14 rows inserted
SQL> commit;
Commit complete
SQL> select sysdate from dual;
SYSDATE
--------------------
2007-3-11 17:59:56
SQL> delete from emp where rownum<10;
9 rows deleted
SQL> commit;
Commit complete
SQL> select * from emp;
EMPNO ENAME      JOB         MGR HIREDATE          SAL      COMM DEPTNO
----- ---------- --------- ----- ----------- --------- --------- ------
 7876 ADAMS      CLERK      7788 1987-5-23     1100.00               20
 7900 JAMES      CLERK      7698 1981-12-3      950.00               30
 7902 FORD       ANALYST    7566 1981-12-3     3000.00               20
 7934 MILLER     CLERK      7782 1982-1-23     1300.00               10
 7369 SMITH      CLERK      7902 1980-12-17     800.00               20
SQL> select sysdate from dual;
SYSDATE
--------------------
2007-3-11 18:00:22
SQL> delete from emp;
5 rows deleted
SQL> commit;
Commit complete
SQL> flashback table emp to timestamp to_timestamp('2007-3-11 18:00:22','yyyy-mm-dd hh24:mi:ss');
Done
SQL> select * from emp;
EMPNO ENAME      JOB         MGR HIREDATE          SAL      COMM DEPTNO
----- ---------- --------- ----- ----------- --------- --------- ------
 7876 ADAMS      CLERK      7788 1987-5-23     1100.00               20
 7900 JAMES      CLERK      7698 1981-12-3      950.00               30
 7902 FORD       ANALYST    7566 1981-12-3     3000.00               20
 7934 MILLER     CLERK      7782 1982-1-23     1300.00               10
 7369 SMITH      CLERK      7902 1980-12-17     800.00               20
SQL>
SQL> flashback table emp to timestamp to_timestamp('2007-3-11 17:59:56','yyyy-mm-dd hh24:mi:ss');
Done
SQL> select * from emp;
EMPNO ENAME      JOB         MGR HIREDATE          SAL      COMM DEPTNO
----- ---------- --------- ----- ----------- --------- --------- ------
 7499 ALLEN      SALESMAN   7698 1981-2-20     1600.00    300.00     30
 7521 WARD       SALESMAN   7698 1981-2-22     1250.00    500.00     30
 7566 JONES      MANAGER    7839 1981-4-2      2975.00               20
 7654 MARTIN     SALESMAN   7698 1981-9-28     1250.00   1400.00     30
 7698 BLAKE      MANAGER    7839 1981-5-1      2850.00               30
 7782 CLARK      MANAGER    7839 1981-6-9      2450.00               10
 7788 SCOTT      ANALYST    7566 1987-4-19     3000.00               20
 7839 KING       PRESIDENT       1981-11-17    5000.00               10
 7844 TURNER     SALESMAN   7698 1981-9-8      1500.00      0.00     30
 7876 ADAMS      CLERK      7788 1987-5-23     1100.00               20
 7900 JAMES      CLERK      7698 1981-12-3      950.00               30
 7902 FORD       ANALYST    7566 1981-12-3     3000.00               20
 7934 MILLER     CLERK      7782 1982-1-23     1300.00               10
 7369 SMITH      CLERK      7902 1980-12-17     800.00               20
14 rows selected
SQL>
SQL>
SQL> flashback table emp to timestamp to_timestamp('2007-3-11 18:00:22','yyyy-mm-dd hh24:mi:ss');
Done
SQL> select * from emp;
EMPNO ENAME      JOB         MGR HIREDATE          SAL      COMM DEPTNO
----- ---------- --------- ----- ----------- --------- --------- ------
 7876 ADAMS      CLERK      7788 1987-5-23     1100.00               20
 7900 JAMES      CLERK      7698 1981-12-3      950.00               30
 7902 FORD       ANALYST    7566 1981-12-3     3000.00               20
 7934 MILLER     CLERK      7782 1982-1-23     1300.00               10
 7369 SMITH      CLERK      7902 1980-12-17     800.00               20
SQL>
SQL> select dbms_flashback.get_system_change_number from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
                  611375
SQL> select * from emp;
EMPNO ENAME      JOB         MGR HIREDATE          SAL      COMM DEPTNO
----- ---------- --------- ----- ----------- --------- --------- ------
 7876 ADAMS      CLERK      7788 1987-5-23     1100.00               20
 7900 JAMES      CLERK      7698 1981-12-3      950.00               30
 7902 FORD       ANALYST    7566 1981-12-3     3000.00               20
 7934 MILLER     CLERK      7782 1982-1-23     1300.00               10
 7369 SMITH      CLERK      7902 1980-12-17     800.00               20
SQL> delete from emp;
5 rows deleted
SQL> select dbms_flashback.get_system_change_number from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
                  611383
SQL>
SQL>
SQL> flashback table emp to scn 611375;
Done
SQL> select * from emp;
EMPNO ENAME      JOB         MGR HIREDATE          SAL      COMM DEPTNO
----- ---------- --------- ----- ----------- --------- --------- ------
 7876 ADAMS      CLERK      7788 1987-5-23     1100.00               20
 7900 JAMES      CLERK      7698 1981-12-3      950.00               30
 7902 FORD       ANALYST    7566 1981-12-3     3000.00               20
 7934 MILLER     CLERK      7782 1982-1-23     1300.00               10
 7369 SMITH      CLERK      7902 1980-12-17     800.00               20
SQL>
阅读(1003) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~