Friday, July 26, 2013

Oracle Flashback Technology.

Oracle Flashback Technology is a group of Oracle Database features that let you view past states of database objects or to return database objects to a previous state without using point-in-time media recovery.
Using flashback features, we can do the following:

    1. Perform queries that return past data.
    2. Perform queries that return metadata that shows a detailed history of changes to the database.
    3. Recover tables or rows to a previous point in time.
    4. Automatically track and archive transactional data changes.
    5. Roll back a transaction and its dependent transactions while the database remains online.

Enable Flashback Database:  To enable Flashback Database, set the DB_FLASHBACK_RETENTION_TARGET initialization parameter and issue the ALTER DATABASE FLASHBACK ON statement.

DB_FLASHBACK_RETENTION_TARGET specifies the upper limit (in minutes) on how far back in time the database may be flashed back.

To Enable Flashback Database log in your oracle database as sysdba. And ensure your database in mounting stage.

SQL> SELECT FLASHBACK_ON FROM V$DATABASE;

FLASHBACK_ON
------------------
NO

SQL> SHOW RECYCLEBIN;
SQL> SHUTDOWN IMMEDIATE;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP MOUNT;
ORACLE instance started.

Total System Global Area  717225984 bytes
Fixed Size                  1292684 bytes
Variable Size             293602932 bytes
Database Buffers          415236096 bytes
Redo Buffers                7094272 bytes
Database mounted.
SQL> ALTER SYSTEM SET DB_FLASHBACK_RETENTION_TARGET=1440;   # 24*60=

1440 (For 1 Day)
System altered.

SQL> ALTER DATABASE FLASHBACK ON;
ALTER DATABASE FLASHBACK ON
*
ERROR at line 1:
ORA-38706: Cannot turn on FLASHBACK DATABASE logging.
ORA-38707: Media recovery is not enabled.


SQL> ALTER DATABASE ARCHIVELOG;

Database altered.

SQL> ALTER DATABASE FLASHBACK ON;

Database altered.

SQL>
 

No comments:

Post a Comment