闪回功能开启
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oradata/archlogs
Oldest online log sequence 15
Next log sequence to archive 17
Current log sequence 17
SQL> show parameter flashback ;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_flashback_retention_target integer 1440
SQL> select flashback_on from v$database;
FLASHBACK_ON
------------------
YES
SQL>
关闭闪回
SQL> shutdown immediate;
SQL> startup mount;
SQL> alter database flashback off;
SQL> alter database open;
设置7天闪回保留值空间
alter system set undo_retention=604800 SCOPE=BOTH;
select * from plas.plas_acct as of TIMESTAMP to_timestamp('2017-03-13 10:00:00', 'yyyy-mm-dd hh24:mi:ss');
查询闪回锁
select t.* from dba_hist_sqltext t where sql_id in (
select t.sql_id from DBA_HIST_ACTIVE_SESS_HISTORY t where t.event like '%enq%lock%' and t.sql_opname in('UPDATE','DELETE','INSERT') ) and sql_text like '%plas_acct%'
select * from plas.plas_acct as of TIMESTAMP to_timestamp('2017-03-13 10:00:00', 'yyyy-mm-dd hh24:mi:ss');
添加闪回表记录
create table logminer.plas_acct_0314_10 as select * from plas.plas_acct as of TIMESTAMP to_timestamp('2017-03-13 10:00:00', 'yyyy-mm-dd hh24:mi:ss');
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oradata/archlogs
Oldest online log sequence 15
Next log sequence to archive 17
Current log sequence 17
SQL> show parameter flashback ;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_flashback_retention_target integer 1440
SQL> select flashback_on from v$database;
FLASHBACK_ON
------------------
YES
SQL>
关闭闪回
SQL> shutdown immediate;
SQL> startup mount;
SQL> alter database flashback off;
SQL> alter database open;
设置7天闪回保留值空间
alter system set undo_retention=604800 SCOPE=BOTH;
select * from plas.plas_acct as of TIMESTAMP to_timestamp('2017-03-13 10:00:00', 'yyyy-mm-dd hh24:mi:ss');
查询闪回锁
select t.* from dba_hist_sqltext t where sql_id in (
select t.sql_id from DBA_HIST_ACTIVE_SESS_HISTORY t where t.event like '%enq%lock%' and t.sql_opname in('UPDATE','DELETE','INSERT') ) and sql_text like '%plas_acct%'
select * from plas.plas_acct as of TIMESTAMP to_timestamp('2017-03-13 10:00:00', 'yyyy-mm-dd hh24:mi:ss');
添加闪回表记录
create table logminer.plas_acct_0314_10 as select * from plas.plas_acct as of TIMESTAMP to_timestamp('2017-03-13 10:00:00', 'yyyy-mm-dd hh24:mi:ss');