■UNDO保存の保障の確認
保障しないとUNDOデータが上書きされるかも
select tablespace_name,retention
from dba_tablespaces
where tablespace_name = 'UNDOTBS1'
■UNDO保存の保障
alter tablespace 'UNDOTBS1' retention GUARANTEE;
■SCNとタイムスタンプのマッピング
select current_scn,scn_to_timestamp(current_scn) from v$database
select timestamp_to_scn(systimestamp), systimestamp from dual
■フラッシュバック問合せ
SCNにて
select name from test as of scn 344387777 where id = 2
■フラッシュバック・バージョン問合せ
SCNにて
select
versions_xid XID,
versions_startscn START_SCN,
versions_endscn END_SCN,
versions_operation OPERATION,
id,name
from test versions between scn minvalue and maxvalue
■フラッシュバック・トランザクション問合せ
SCNにて
select * from flashbak_transaction_query where table_name='TEST'
■oracle flashbak query
update test set name= (select name from test as of scn 344387777 where id = 2) where id=2
■oracle flushbak table
※flashback table 権限 or flashback any table 権限 が必要
行移行を有効にしないとだめ
alter table test enable row movement
・対照表はロックされる
・システム表、固定表はNG
・表の定義が変更されているとNG
・関連する表は、同時にフラッシュバックする
flashback table test to scn 344494686
■oracle flushbak drop
flashback table test to before drop rename to 'test2'
・マテリアライズドビュー、ビットマップ結合索引、参照性合成制約はNG
・制約や索引などは手動でリネームする
--索引名の取得
select index_name from user_indexes where table_name='TEST';
--リネーム
alter index "BINXXXXXXXXXXXXX" rename to pk_test;