Wednesday, January 28, 2009

Setup Oracle Flashback Database

Requirements for Flashback Database
1. Your database must be running in ARCHIVELOG mode.

2. You must have a flash recovery area enabled, because flashback logs can only be stored in the flash recovery area.

3. For Real Application Clusters databases, the flash recovery area must be stored in a clustered file system or in ASM.

4. To enable Flashback Database, set the DB_FLASHBACK_RETENTION_TARGET initialization parameter


Setups for Setup Oracle Flashback Database
1. Check that the db_flashback_retention_target, db_recovery_file_dest and db_recovery_file_dest_size are set

SQL> select name, value from v$parameter where name like '%flash%';
NAME VALUE
-------------------------------- --------------------------------------- db_flashback_retention_target 1440

SQL> select name, value from v$parameter where name like '%recovery%';
NAME VALUE
------------------------ --------------------------------------- db_recovery_file_dest /opt/oracle/flash_recovery_area
db_recovery_file_dest_size 2147483648

2. Make sure the database is in archive log mode.
SQL> select name, log_mode from v$database ;
NAME LOG_MODE
--------- ------------
ORCL NOARCHIVELOG

3. If database not in archive log mode turn on Archive log mode.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount
ORACLE instance started.
Total System Global Area 368263168 bytes
Fixed Size 1299988 bytes
Variable Size 268437996 bytes
Database Buffers 92274688 bytes
Redo Buffers 6250496 bytes
Database mounted.

SQL> alter database archivelog ;
Database altered.

SQL> alter database open ;
Database altered.

4. Turn the flashback on
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount
ORACLE instance started.
Total System Global Area 368263168 bytes
Fixed Size 1299988 bytes
Variable Size 268437996 bytes
Database Buffers 92274688 bytes
Redo Buffers 6250496 bytes
Database mounted.

SQL> ALTER DATABASE FLASHBACK ON;
Database altered.

SQL> alter database open ;
Database altered.

No comments: