|
第三阶段New Feature/OCM Exam Preparation(31-56)- select ftq.xid, ftq.table_name, ftq.operation, ftq.undo_sql
- from flashback_transaction_query ftq
- where ftq.logon_user='HR'
- order by ftq.start_scn desc;
-
- begin
- dbms_flashback.transaction_backout (
- numtxns => 1,
- xids => xid_array('03001500D3050000'),
- options => dbms_flashback.nocascade);
- end;
-
- alter database add supplemental log data;
-
- select d.SUPPLEMENTAL_LOG_DATA_MIN,
- d.SUPPLEMENTAL_LOG_DATA_PK,
- d.SUPPLEMENTAL_LOG_DATA_FK
- from v_$database d;
-
- ----
- select ftq.xid, ftq.table_name, ftq.operation, ftq.undo_sql
- from flashback_transaction_query ftq
- where ftq.logon_user='HR' and ftq.table_name='T_NOCASCADE2'
- order by ftq.start_scn desc;
-
- ---0100180051050000
- begin
- dbms_flashback.transaction_backout (
- numtxns => 1,
- xids => xid_array('0100180051050000'),
- options => dbms_flashback.nocascade);
- end;
- ---
- select ftq.xid, ftq.table_name, ftq.operation, ftq.undo_sql
- from flashback_transaction_query ftq
- where ftq.logon_user='HR' and ftq.table_name='T_CASCADE'
- order by ftq.start_scn desc;
-
- ---09000700F1050000 ---0A000D00FD040000
- begin
- dbms_flashback.transaction_backout (
- numtxns => 1,
- xids => xid_array('09000700F1050000'),
- options => dbms_flashback.cascade);
- end;
- ---
- select * from dba_flashback_txn_report;
-
- select * from dba_flashback_txn_state;
- commit;
-
- ----
- select ftq.xid, ftq.table_name, ftq.operation, ftq.undo_sql
- from flashback_transaction_query ftq
- where ftq.logon_user='HR' and ftq.table_name='T_NOCASCADE_FORCE'
- order by ftq.start_scn desc;
-
- ---0700130049050000 ---04001A0057050000
- begin
- dbms_flashback.transaction_backout (
- numtxns => 1,
- xids => xid_array('0700130049050000'),
- options => dbms_flashback.nocascade_force);
- end;
- ---
- select * from dba_flashback_txn_report;
-
- select * from dba_flashback_txn_state;
- commit;
-
- ----
- ----
- select ftq.xid, ftq.table_name, ftq.operation, ftq.undo_sql
- from flashback_transaction_query ftq
- where ftq.logon_user='HR' and ftq.table_name='T_NONCONFLICT_ONLY'
- order by ftq.start_scn desc;
-
- ---02001900F1050000 ---04001A0057050000
- begin
- dbms_flashback.transaction_backout (
- numtxns => 1,
- xids => xid_array('02001900F1050000'),
- options => dbms_flashback.nonconflict_only);
- end;
- ---
- select * from dba_flashback_txn_report;
-
- select * from dba_flashback_txn_state;
- commit;
- ---
- select ftq.xid, ftq.table_name, ftq.operation, ftq.undo_sql
- from flashback_transaction_query ftq
- where ftq.logon_user='HR' and ftq.table_name='S_NOCASCADE_FORCE'
- order by ftq.start_scn desc;
-
- ---02001F00F4050000
-
- begin
- dbms_flashback.transaction_backout (
- numtxns => 1,
- xids => xid_array('02001F00F4050000'),
- options => dbms_flashback.nocascade_force
-
- );
- end;
- select * from dba_flashback_txn_report;
- commit;
-
复制代码- SQL> select * from t_nocascade;
- ID
- ----------
- 11
- 22
- 333
- SQL> select * from t_cascade;
- ID
- ----------
- 1
- 2
- 3
- SQL> select * from t_nocascade_force;
- ID
- ----------
- 1
- 2
- 333
- SQL> select * from t_nonconflict_only;
- ID
- ----------
- 1
- 22
- 333
复制代码- SQL> select * from s_nocascade;
- ID
- ----------
- 11
- 222
- 333
- SQL> select * from s_cascade;
- ID
- ----------
- 1
- 2
- 3
- SQL> select * from s_nocascade_force;
- ID
- ----------
- 1
- 222
- 333
- SQL> select * from s_nonconflict_only;
- ID
- ----------
- 1
- 222
- 333
复制代码- SQL> create table t_pk ( a number primary key ) ;
- Table created.
- SQL> insert into t_pk values (1) ;
- 1 row created.
- SQL> commit;
- Commit complete.
- SQL> delete from t_pk where a=1;
- 1 row deleted.
- SQL> commit;
- Commit complete.
- SQL> insert into t_pk values (1) ;
- 1 row created.
- SQL> commit;
- Commit complete.
- SQL> select * from t_pk;
- A
- ----------
- 1
- SQL>
复制代码
- SQL> create table t_pk2 ( a number primary key ) ;
- Table created.
- SQL> insert into t_pk2 values (1) ;
- 1 row created.
- SQL> commit;
- Commit complete.
- SQL>
- SQL> delete from t_pk2 where a=1;
- 1 row deleted.
- SQL> commit;
- Commit complete.
- SQL> insert into t_pk2 values (1) ;
- 1 row created.
- SQL> commit;
- Commit complete.
- SQL> select * from t_pk2;
- A
- ----------
- 1
复制代码
- SQL> create table t_pk3 ( a number primary key ) ;
- Table created.
- SQL> insert into t_pk3 values (1) ;
- 1 row created.
- SQL> commit;
- Commit complete.
- SQL> create table t_pk3_son ( a number refreneces t_pk3 ) ;
- create table t_pk3_son ( a number refreneces t_pk3 )
- *
- ERROR at line 1:
- ORA-00907: missing right parenthesis
- SQL> create table t_pk3_son ( a number references t_pk3 ) ;
- Table created.
- SQL> insert into t_pk3_son values (2) ;
- insert into t_pk3_son values (2)
- *
- ERROR at line 1:
- ORA-02291: integrity constraint (HR.SYS_C0014932) violated - parent key not
- found
- SQL> insert into t_pk3_son values (1) ;
- 1 row created.
- SQL> commit;
- Commit complete.
- SQL>
复制代码- select ftq.xid, ftq.table_name, ftq.operation, ftq.undo_sql
- from flashback_transaction_query ftq
- where ftq.logon_user='HR' and ftq.table_name='T_PK4'
- order by ftq.start_scn desc;
-
- ---04000A005E050000
-
- begin
- dbms_flashback.transaction_backout (
- numtxns => 1,
- xids => xid_array('02000A00F5050000'),
- options => dbms_flashback.cascade
- );
- end;
-
- select * from dba_flashback_txn_report;
- commit;
- ---
- select d.SUPPLEMENTAL_LOG_DATA_MIN,
- d.SUPPLEMENTAL_LOG_DATA_PK,
- d.SUPPLEMENTAL_LOG_DATA_FK
- from v_$database d;
-
- ---
- alter database add supplemental log data ( foreign key ) columns;
-
复制代码
<?xml version="1.0" encoding="ISO-8859-1"?>
<COMP_XID_REPORT XID="02000400D2050000" NAME="_SYS_COMP_TXN_4456479_TIM_1506087917">
<TRANSACTION XID="02000A00F5050000">
<CHARACTERISTICS>
</CHARACTERISTICS>
<UNDO_SQL>
<USQL exec="yes">
delete from "HR"."T_PK4" where "A" = '1'
</USQL>
</UNDO_SQL>
<DEPENDENT_XIDS>
<TRANSACTION XID="0800070067050000">
<CHARACTERISTICS>
</CHARACTERISTICS>
<UNDO_SQL>
<USQL exec="yes">
delete from "HR"."T_PK4_SON" where "A" = '1' and ROWID = 'AAATrpAAEAAAAKcAAA'
</USQL>
</UNDO_SQL>
<DEPENDENT_XIDS>
</DEPENDENT_XIDS>
</TRANSACTION>
</DEPENDENT_XIDS>
</TRANSACTION>
<EXECUTED_UNDO_SQL>
<EXEC_USQL>delete from "HR"."T_PK4_SON" where "A" = '1' and ROWID = 'AAATrpAAEAAAAKcAAA'
</EXEC_USQL>
<EXEC_USQL>delete from "HR"."T_PK4" where "A" = '1'
</EXEC_USQL>
</EXECUTED_UNDO_SQL>
</COMP_XID_REPORT>
- SQL> select * from t_pk4_son;
- no rows selected
- SQL> select * from t_pk4;
- no rows selected
复制代码
|
|