Oracle9i Flashback Query 閃回查詢總結 --- (通過SCN恢復)

tolywang發表於2008-01-16
SQL> connect testuser/testuser
已連線。
SQL> select * from testtable2;

DEPTNO DNAME LOC
---------- ---------------------------- --------------------------
11 abc 123
45 sales chicago
46 research dallas
47 bbb 777
1 research dallas
[@more@]

SQL> select dbms_flashback.get_system_change_number fscn from dual;

FSCN
----------
316227956

SQL> update testtable2 set deptno = '55' where dname = 'abc';

已更新 1 行。

SQL> commit;

提交完成。

SQL> select * from testtable2;

DEPTNO DNAME LOC
---------- ---------------------------- --------------------------
55 abc 123
45 sales chicago
46 research dallas
47 bbb 777
1 research dallas

SQL> select * from TESTTABLE2 AS OF SCN('316227956');

DEPTNO DNAME LOC
---------- ---------------------------- --------------------------
11 abc 123
45 sales chicago
46 research dallas
47 bbb 777
1 research dallas

SQL> INSERT INTO TESTTABLE2 SELECT * FROM TESTTABLE2 AS OF SCN('316227956') WHER
E DEPTNO='11';

已建立 1 行。

SQL> select * from testtable2;

DEPTNO DNAME LOC
---------- ---------------------------- --------------------------
55 abc 123
45 sales chicago
46 research dallas
47 bbb 777
1 research dallas
11 abc 123

已選擇6行。

SQL> DELETE FROM testtable2 WHERE DEPTNO ='11';

已刪除 1 行。

SQL> COMMIT;

提交完成。

SQL> select * from testtable2;

DEPTNO DNAME LOC
---------- ---------------------------- --------------------------
55 abc 123
45 sales chicago
46 research dallas
47 bbb 777
1 research dallas

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-997539/,如需轉載,請註明出處,否則將追究法律責任。

相關文章