Flashback Database
Flashback Database is faster than traditional point-in-time
recovery. Traditional recovery uses redo log files and backups. Flashback
Database is implemented using a new type of log file called Flashback Database
logs. The Oracle database server periodically logs before images of data blocks
in the Flashback Database logs. The data block images are used to quickly back
out changes to the database during Flashback Database.
RVWR Background Process
When Flashback Database is enabled, a new RVWR background process is
started. This process is similar to the LGWR (log writer) process. The new
process writes Flashback Database data to the Flashback Database logs. Enabling Flashback Databae:
- Make sure the database is in
archive mode and FLASHBACK_ON Yes
SQL>SELECT flashback_on, log_mode
FROM v$database;
- Configure the recovery area(if
necessary) by setting the two parameters:
-
db_recovery_file_dest -
db_recovery_file_dest_size
- Open the database in MONT mode and turn
on the flashback feture:
SQL> STARTUP MOUNT; SQL>ALTER DATABASE ARCHIVELOG; [If
not in archive mode] SQL> ALTER DATABASE FLASHBACK ON; SQL> ALTER DATABASE OPEN;
- SQL> create table
test_flashback(name varchar(30));
- SQL> insert into
test_flashback values('*******TEST BEFORE*******');
- SQL> commit;
- SQL> select
to_char(sysdate,'dd-mm-yy hh24:mi:ss') from dual;
- SQL> SELECT current_scn FROM
v$database;
- SQL> insert into
test_flashback values('*******TEST AFTER*******');
- SQL> commit;
- SQL> select * from
test_flashback;
- SQL> drop table
test_flashback;
- SQL> shutdown immediate;
- SQL> startup mount;
- SQL> FLASHBACK DATABASE to timestamp
to_timestamp('16-07-2008 13:59:45', 'DD-MM-YYYY HH24:MI:SS');
OR
SQL> FLASHBACK DATABASE TO SCN 3726625;
- SELECT current_scn FROM v$database;
- SQL> ALTER DATABASE OPEN
RESETLOGS;
- SQL> SELECT * FROM
test_flashback;
Another Example:
- SQL> conn
moon/moon#1
- SQL> create table
test_flash(id number);
- SQL> commit;
- SQL> drop table
test_flash;
- SQL> flashback
table test_flash to before drop;
- SQL> select * from
test_flash;
|