|
表的閃回操作:
SQL>show parameter bin
SQL>alter system set recyclebin=off;
SQL>alter system set recyclebin=on;
SQL>select * from cat; //查看目前使用者所有的表
SQL>show recyclebin
SQL>purge table 表名;
SQL>purge recyclebin; //清空資源回收筒
SQL>drop table 表名;
SQL>select object_name,ts_name,space from user_recyclebin;
SQL>flashback table 剛刪除的表名 to before drop;
SQL>drop table 表名 purge; //直接刪除表,而不將改變放入會後站
閃回技術只能保護非系統資料表空間中的表,而且這些表還必須存放在本地管理
的資料表空間中。
閃回錯誤的DML操作
SQL>show parameter undo_retention
預設值是900秒(15分鐘),可根據需要延長時間,例如設定成1個小時。
SQL>alter system set undo_retention=3600;
SQL>connect scott/tiger
SQL>update emp_dump set sal=9999;
SQL>select versions_xid,empno,ename,sal from emp_dump
2 versions between scn minvalue and maxvalue
3 where empno=7900;
SQL>commit;
SQL>connect system/manager
SQL>col OPERATION for a10
SQL>col UNDO_SQL for a80
SQL>select operation,undo_sql
2 from flashback_transaction_query
3 where xid=hextoraw('查詢出來的versions_xid值');
SQL>select operation,START_SCN
2 from flashback_transaction_query
3 where xid=hextoraw('查詢出來的versions_xid值');
SQL>alter table scott.emp_dump enable row movement;
SQL>flashback table scott.emp_dump to SCN 查詢出來的START_SCN值
SQL>flashback table scott.emp_dump to timestamp
2 to_timestamp('2010-09-01 17:30:00','YYYY-MM-DD HH24:MI:SS') |