Oracle Flashback命令手冊

Flashback sql

Flashback query(undo) 數據庫

select * from table_name as of timestamp  索引

to_timestamp('2008-03-03 12:00:00','yyyy-mm-dd hh24:mi:ss'); select * from table_name as of scn 123456;  事務

Flashback table(undo,恢復表到某時間點,阻塞寫操做) --必須開啓行移動 get

alter table table_name enable row movement;                flashback table table_name to timestamp(JUL-07-2008,02:33:00); flashback table table_name to scn 123456; flash

flashback table table_name to timestamp '2008-03-03 12:05:00' enable triggers;   --只恢復trigger或index狀態,不恢復更改  io

Flashback drop(recyclebin) --管理recyclebin show recyclebin; table

select * from user_recyclebin; select * from dba_recyclebin; purge recyclebin; --閃回drop表 thread

flashback table table_name to before drop [rename to new_name]; test

--recyclebin中有同名,閃回最近刪除的;閃回後有同名表,需rename  

Flashback database(flashback log,redo log,archive log) --開啓flashback database shutdown immediate startup mount 

alter database flashback on             --必須先開啓歸檔 

--閃回數據庫(mount狀態,read only方式檢查,resetlogs方式打開) flashback database to time to_date(xxx); 

flashback database to time to_timestamp(xxx); flashback database to scn xxx; 

flashback database to sequence xxx thread 1; flashback database to timestamp(sysdate-1/24); --管理閃回區 

db_recovery_file_dest            --閃回區路徑 db_recovery_file_dest_size        --閃回區大小 db_flashback_retention_target     --閃回數據保存時間 

select * from v$flash_recovery_area_usage;      --閃回區使用率 

select * from v$flashback_database_log;         --閃回區狀況,如能恢復到的最先的時間點  

Flashback version query(undo) 

--查詢表的多個版本,記錄行的改變 

select versions_starttime,versions_endtime,versions_startscn,versions_endscn,       versions_xid,versions_operation,a,b 

from test versions between timestamp minvalue and maxvalue order by versions_starttime;              

Flashback transaction query(undo)    --查看當前事務號 

select xid from v$transaction; --查看undo_sql 

select undo_sql from flashback_transaction_query 

where xid =hextoraw('xxxxxxx');                 --不使用hextoraw很難利用系統的索引

相關文章
相關標籤/搜索