Flashback
Flashback
You can use flashback technology to move entire database or a particular table inside database.
• Flashback Table Before Drop
• Flashback Table
• Flashback Database
• Enable Flashback
• Create Sample User
• Flashback Database to SCN or Timestamp
Note: only for flashback database activity, you must enable flashback database. For all other
flashback activities, you do not need to enable flashback database
You can flashback a dropped table from recyclebin using flashback table command
SHOW RECYCLEBIN;
or
You can even rename table while flashing it back from recyclebin
FLASHBACK TABLE SCOTT.FLASH_EMP TO BEFORE DROP RENAME TO NEW_EMP;
Note: Recyclebin must be enabled to use flashback table before drop
Flashback Table
You can flashback table to a particular SCN or time in the past. Before you can flashback table,
you must enable row movement
ALTER TABLE hr.employees ENABLE ROW MOVEMENT;
Now you are ready to flashback table to SCN or timestamp
FLASHBACK TABLE EMP TO SCN <scn_no>;
Flashback Database
We can move an entire database back in time to a particular SCN or a timestamp. Flashback
Database must be already enabled on the database to user this feature.
Make sure DB_RECOVERY_FILE_DEST parameter is set. This is the location where Oracle
will store flashback logs
Set DB_RECOVERY_FILE_DEST parameter as per requirement
Confirm that the database is in ARCHIVELOG mode, which is required for Flashback Database,
and enable ARCHIVELOG mode if needed.
Set the associated undo retention, required for certain flashback features. Here, we set a 24-hour
undo retention (in seconds), equivalent to half the DB_FLASHBACK_RETENTION_TARGET,
as in above step.
Assume that the user has been created by mistake and you want to flashback database to the SCN
just before the user creation. Shutdown DB and startup mount
SQL> shut immediate;
SQL> startup mount;
Flashback database to SCN before user creation and open database with resetlogs
Reference:
https://logicalread.com/oracle-12-flashback-database-mc07/#.YXpP3Z5BzIV
https://www.support.dbagenesis.com/post/oracle-flashback