close

http://blog.roodo.com/mywork/archives/1684525.html

 

有關scn值就是記錄在這個table裡

SQL> desc flashback_transaction_query;

Name Type Nullable Default Comments

---------------- -------------- -------- ------- -----------------------------------------

XID RAW(8) Y Transaction identifier

START_SCN NUMBER Y Transaction start SCN

START_TIMESTAMP DATE Y Transaction start timestamp

COMMIT_SCN NUMBER Y Transaction commit SCN

COMMIT_TIMESTAMP DATE Y Transaction commit timestamp

LOGON_USER VARCHAR2(30) Y Logon user for transaction

UNDO_CHANGE# NUMBER Y 1-based undo change number

OPERATION VARCHAR2(32) Y forward operation for this undo

TABLE_NAME VARCHAR2(256) Y table name to which this undo applies

TABLE_OWNER VARCHAR2(32) Y owner of table to which this undo applies

ROW_ID VARCHAR2(19) Y rowid to which this undo applies

UNDO_SQL VARCHAR2(4000) Y SQL corresponding to this undo

 

查尋最後的scn值為何

SQL> select start_scn,

to_char(start_timestamp,'yyyy-mm-dd hh24:mi:ss') as s_time,

commit_scn,

to_char(commit_timestamp,'yyyy-mm-dd hh24:mi:ss') as c_time,

table_name,

undo_sql

from flashback_transaction_query

where table_name='TESTDROP7'

order by commit_timestamp;


START_SCN S_TIME COMMIT_SCN C_TIME TABLE_NAME UNDO_SQL

--------------- ------------------------- ------------------ --------------------- ------------- -----------------------------------

680553 2006-05-30 12:32:05 680731 2006-05-30 12:32:08 TESTDROP7 delete from "FLASHTEST"."TESTDROP7" where ROWID = 'AAAM1tAAEAAAAHNAAC';

685412 2006-05-30 14:04:47 685415 2006-05-30 14:04:53 TESTDROP7 delete from "FLASHTEST"."TESTDROP7" where ROWID = 'AAAM1tAAEAAAAHNAAE';

685412 2006-05-30 14:04:47 685415 2006-05-30 14:04:53 TESTDROP7 delete from "FLASHTEST"."TESTDROP7" where ROWID = 'AAAM1tAAEAAAAHNAAD';

686429 2006-05-30 14:20:51 686432 2006-05-30 14:20:57 TESTDROP7 delete from "FLASHTEST"."TESTDROP7" where ROWID = 'AAAM1tAAEAAAAHNAAG';

686429 2006-05-30 14:20:51 686432 2006-05-30 14:20:57 TESTDROP7 delete from "FLASHTEST"."TESTDROP7" where ROWID = 'AAAM1tAAEAAAAHNAAF';

686506 2006-05-30 14:22:25 686507 2006-05-30 14:22:25 TESTDROP7 delete from "FLASHTEST"."TESTDROP7" where ROWID = 'AAAM1tAAEAAAAHNAAH';

686574 2006-05-30 14:24:00 686576 2006-05-30 14:24:00 TESTDROP7 delete from "FLASHTEST"."TESTDROP7" where ROWID = 'AAAM1tAAAAAAAAJGg+';

686574 2006-05-30 14:24:00 686576 2006-05-30 14:24:00 TESTDROP7 insert into "FLASHTEST"."TESTDROP7"("ID") values ('8');

686574 2006-05-30 14:24:00 686576 2006-05-30 14:24:00 TESTDROP7 insert into "FLASHTEST"."TESTDROP7"("ID") values ('7');

686963 2006-05-30 14:31:58 686965 2006-05-30 14:32:01 TESTDROP7 insert into "FLASHTEST"."TESTDROP7"("ID") values ('7');

10 rows selected

輸入最後的scn值,進行還原

SQL> flashback table testdrop7 to scn 686963;

Done


SQL> select * from testdrop7;


ID

----------

1

2

3

4

5

6

7


7 rows selected

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 to52016 的頭像
    to52016

    Eason [資料科學//Python學習/資料庫] & [拍片&剪片]

    to52016 發表在 痞客邦 留言(0) 人氣()