通过回退段闪回表不成功
想通过dbms_flashback做基于scn的闪回,但是不成功,请各位大佬帮忙解答一下,谢谢。SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL> show user
USER is "SCOTT"
SQL> select * from t1;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
7369 SMITH CLERK 7902 1980-12-17 00:00:00 20 20
7499 ALLEN SALESMAN 7698 1981-02-20 00:00:00 20 300 30
7521 WARD SALESMAN 7698 1981-02-22 00:00:00 20 500 30
7566 JONES MANAGER 7839 1981-04-02 00:00:00 20 20
7654 MARTIN SALESMAN 7698 1981-09-28 00:00:00 20 1400 30
7698 BLAKE MANAGER 7839 1981-05-01 00:00:00 20 30
7782 CLARK MANAGER 7839 1981-06-09 00:00:00 20 10
7788 SCOTT ANALYST 7566 1987-04-19 00:00:00 20 20
7839 KING PRESIDENT 1981-11-17 00:00:00 20 10
7844 TURNER SALESMAN 7698 1981-09-08 00:00:00 20 0 30
7876 ADAMS CLERK 7788 1987-05-23 00:00:00 20 20
7900 JAMES CLERK 7698 1981-12-03 00:00:00 20 30
7902 FORD ANALYST 7566 1981-12-03 00:00:00 20 20
7934 MILLER CLERK 7782 1982-01-23 00:00:00 20 10
14 rows selected.
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
8574623
SQL>
SQL>
SQL>
SQL> update t1 set sal=21;
14 rows updated.
SQL> commit;
Commit complete.
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
8574632
SQL>
SQL>
SQL> select * from t1;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
7369 SMITH CLERK 7902 1980-12-17 00:00:00 21 20
7499 ALLEN SALESMAN 7698 1981-02-20 00:00:00 21 300 30
7521 WARD SALESMAN 7698 1981-02-22 00:00:00 21 500 30
7566 JONES MANAGER 7839 1981-04-02 00:00:00 21 20
7654 MARTIN SALESMAN 7698 1981-09-28 00:00:00 21 1400 30
7698 BLAKE MANAGER 7839 1981-05-01 00:00:00 21 30
7782 CLARK MANAGER 7839 1981-06-09 00:00:00 21 10
7788 SCOTT ANALYST 7566 1987-04-19 00:00:00 21 20
7839 KING PRESIDENT 1981-11-17 00:00:00 21 10
7844 TURNER SALESMAN 7698 1981-09-08 00:00:00 21 0 30
7876 ADAMS CLERK 7788 1987-05-23 00:00:00 21 20
7900 JAMES CLERK 7698 1981-12-03 00:00:00 21 30
7902 FORD ANALYST 7566 1981-12-03 00:00:00 21 20
7934 MILLER CLERK 7782 1982-01-23 00:00:00 21 10
14 rows selected.
SQL>
SQL>
SQL> execute DBMS_FLASHBACK.ENABLE_AT_SYSTEM_CHANGE_number (8574623);
PL/SQL procedure successfully completed.
SQL> execute dbms_flashback.disable();
PL/SQL procedure successfully completed.
SQL>
SQL>
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
8574662
SQL> select * from t1;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
7369 SMITH CLERK 7902 1980-12-17 00:00:00 21 20
7499 ALLEN SALESMAN 7698 1981-02-20 00:00:00 21 300 30
7521 WARD SALESMAN 7698 1981-02-22 00:00:00 21 500 30
7566 JONES MANAGER 7839 1981-04-02 00:00:00 21 20
7654 MARTIN SALESMAN 7698 1981-09-28 00:00:00 21 1400 30
7698 BLAKE MANAGER 7839 1981-05-01 00:00:00 21 30
7782 CLARK MANAGER 7839 1981-06-09 00:00:00 21 10
7788 SCOTT ANALYST 7566 1987-04-19 00:00:00 21 20
7839 KING PRESIDENT 1981-11-17 00:00:00 21 10
7844 TURNER SALESMAN 7698 1981-09-08 00:00:00 21 0 30
7876 ADAMS CLERK 7788 1987-05-23 00:00:00 21 20
7900 JAMES CLERK 7698 1981-12-03 00:00:00 21 30
7902 FORD ANALYST 7566 1981-12-03 00:00:00 21 20
7934 MILLER CLERK 7782 1982-01-23 00:00:00 21 10
14 rows selected.
:funk:已解决。
顺序搞反了,这个包的意思当时也没理解。实际上dbms_flashback这个是临时闪回的意思。 你的测试步骤有问题,execute dbms_flashback.disable();就结束闪回了
$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Fri Feb 27 14:18:21 2015
Copyright (c) 1982, 2013, Oracle.All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> conn chf/xifenfei
Connected.
SQL>
SQL>
SQL>
SQL>
SQL> create table test_xff as select * from dba_users;
Table created.
SQL>
SQL>
SQL>
SQL> select username from test_xff;
USERNAME
------------------------------
MGMT_VIEW
SYS
SYSTEM
DBSNMP
SYSMAN
CHF
POSP_TRANS
POSP_BOSS
POSP_CUSTOMER
POSP_AGENT
POSP
USERNAME
------------------------------
OUTLN
FLOWS_FILES
MDSYS
ORDSYS
EXFSYS
WMSYS
APPQOSSYS
APEX_030200
OWBSYS_AUDIT
ORDDATA
CTXSYS
USERNAME
------------------------------
ANONYMOUS
XDB
ORDPLUGINS
OWBSYS
SI_INFORMTN_SCHEMA
OLAPSYS
SCOTT
ORACLE_OCM
XS$NULL
MDDATA
DIP
USERNAME
------------------------------
APEX_PUBLIC_USER
SPATIAL_CSW_ADMIN_USR
SPATIAL_WFS_ADMIN_USR
36 rows selected.
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
84168917
SQL> update test_xffset username='www.xifenfei.com' ;
36 rows updated.
SQL> commit;
Commit complete.
SQL>select current_scn from v$database;
CURRENT_SCN
-----------
84168957
SQL> select username from test_xff;
USERNAME
------------------------------
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
USERNAME
------------------------------
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
USERNAME
------------------------------
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
USERNAME
------------------------------
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
36 rows selected.
SQL>execute DBMS_FLASHBACK.ENABLE_AT_SYSTEM_CHANGE_number (84168917);
PL/SQL procedure successfully completed.
SQL> select username from test_xff;
USERNAME
------------------------------
MGMT_VIEW
SYS
SYSTEM
DBSNMP
SYSMAN
CHF
POSP_TRANS
POSP_BOSS
POSP_CUSTOMER
POSP_AGENT
POSP
USERNAME
------------------------------
OUTLN
FLOWS_FILES
MDSYS
ORDSYS
EXFSYS
WMSYS
APPQOSSYS
APEX_030200
OWBSYS_AUDIT
ORDDATA
CTXSYS
USERNAME
------------------------------
ANONYMOUS
XDB
ORDPLUGINS
OWBSYS
SI_INFORMTN_SCHEMA
OLAPSYS
SCOTT
ORACLE_OCM
XS$NULL
MDDATA
DIP
USERNAME
------------------------------
APEX_PUBLIC_USER
SPATIAL_CSW_ADMIN_USR
SPATIAL_WFS_ADMIN_USR
36 rows selected.
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
84169051
SQL> execute dbms_flashback.disable();
PL/SQL procedure successfully completed.
SQL> select username from test_xff;
USERNAME
------------------------------
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
USERNAME
------------------------------
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
USERNAME
------------------------------
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
USERNAME
------------------------------
www.xifenfei.com
www.xifenfei.com
www.xifenfei.com
36 rows selected.
感谢飞哥解答。:D
页:
[1]