Flashback transaction 的內容是否須commit

kl911發表於2007-09-20

答案是否定的,不管怎樣只要塊的改變記錄在undo segment裡面,該動作就會作為flashback transaction的候選人:

conn hr/hr;

create table t1 as select employee_id, salary from employees;

delete t1 where employees=197;

commit;

delete t1 where employees=196;

(without commit)

SQL> select operation,undo_sql,table_name from flashback_transaction_query
2 where table_name='T1';

OPERATION
--------------------------------
UNDO_SQL
----------------------------------------------------------------------------
TABLE_NAME
----------------------------------------------------------------------------
DELETE
insert into "HR"."T1"("EMPLOYEE_ID","SALARY") values ('196','3100');
T1

DELETE
insert into "HR"."T1"("EMPLOYEE_ID","SALARY") values ('197','3000');
T1


(現在看到了結果,不管是否提交,只要undo裡面記錄了,就會顯示出來)

rollback;

SQL> select operation,undo_sql,table_name from flashback_transaction_query
2 where table_name='T1';

OPERATION
--------------------------------
UNDO_SQL
---------------------------------------------------------------------------
TABLE_NAME
---------------------------------------------------------------------------
DELETE
insert into "HR"."T1"("EMPLOYEE_ID","SALARY") values ('197','3000');
T1


閃回事務查詢的測試和驗證,結果為是否commit,對查詢結果沒有影響;

[@more@]

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

相關文章