Oracle Flashback is a high availability feature that enables reversing human errors by selectively and efficiently undoing the effects of a mistake.
Here’s a configuration example.
Enable Flashback for myinstance with a 2 days retention period
# su - oracle % export ORACLE_SID=myinstance % sqlplus "/ as sysdba" SQL> Shutdown Immediate; SQL> Startup mount; SQL> Alter Database Archivelog; SQL> Alter System Set db_flashback_retention_target=2880; SQL> Shutdown Immediate; SQL> Startup mount; SQL> Alter Database flashback on; SQL> Alter Database open;
Check some parameters
SQL> Select flashback_on from v$database; SQL> Select Retention_target, Estimated_flashback_size, Flashback_size from v$Flashback_database_log; SQL> Select oldest_flashback_scn, oldest_flashback_time from v$flashback_database_log; SQL> Select end_time, flashback_data, db_data, redo_data from v$flashback_database_stat; SQL> Select * from v$sgastat where name like 'flashback%';
Restore the database to a previous date
% rman target / RMAN> FLASHBACK DATABASE TO TIME "TO_DATE('2012-12-15 18:00:00','YYYY-MM-DD HH24:MI:SS')"; % sqlplus "/ as sysdba" SQL> Alter database open resetlogs; SQL> shutdown immediate; SQL> startup;