Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 

 

Enabling Flashback Data Archive

Oracle 11g New Features Tips by Donald BurlesonJune 29, 2015

Oracle 11g New Features Tips

The first thing that needs to be done to enable the flashback data archive is to create a flashback archive.

% A user needs the FLASHBACK ARCHIVE ADMINISTER  system            privilege to create and manage flashback archives including:

  • creating

  • modifying; making default, setting retention time, purging manually, adding and removing tablespaces

  • disabling tracking\

  • dropping

% A user needs the FLASHBACK ARCHIVE object privilege for enabling            tracking of history data for a table

LUTZ  @ orcl SQL> CREATE FLASHBACK ARCHIVE my_5_year_archive

  TABLESPACE fba_5_years_01
    QUOTA 10G
      RETENTION 5 YEARS;

This statement creates an object in the data dictionary, which is a logical container for the storage of history data.

SYS AS SYSDBA @ orcl SQL> SELECT * FROM dba_flashback_archive;

FLASHBACK_ARCHIVE_NAME FLASHBACK_ARCHIVE# RETENTION_IN_DAYS CREATE_TIME LAST_PURGE_TIME  STATUS

---------------------- -----------------  -----------------  ----------  ------------- --------------------------------------

MY_5_YEAR_ARCHIVE           1              1825             05-DEC-07    11.11.23.000000000 PM 05-DEC-07       11.11.23.000000000 PM

% There are a number of restrictions for flashback archives:

  • The tablespaces used for a flashback archive must use local extent management and automatic segment space management.

  • The database must use automatic undo management.

With the QUOTA clause, the amount of disk space consumed by data archive in a tablespace is limited.

SYS AS SYSDBA @ orcl SQL> SELECT * FROM DBA_FLASHBACK_ARCHIVE_TS;

FLASHBACK_ARCHIVE_NAME  FLASHBACK_ARCHIVE# TABLESPACE_NAME  QUOTA_IN_MB
------------------ ----------------------- ---------------  ------------
MY_5_YEAR_ARCHIVE             1             FBA_5_YEAR_01        50

% The QUOTA can be adjusted dynamically at any time by:

  • adding more tablespaces to the flashback archive or by

  • modifying the quota on a tablespace which is already part of the flashback archive: 

SYS AS SYSDBA @ orcl SQL> ALTER FLASHBACK ARCHIVE my_5_year_archive
                            ADD TABLESPACE fba_5_year_02 QUOTA 20M; 

SYS AS SYSDBA @ orcl SQL> ALTER FLASHBACK ARCHIVE my_5_year_archive
                            MODIFY TABLESPACE fba_5_year_02 QUOTA 30M;

Here are the quotas in the data dictionary again:

SYS AS SYSDBA @ orcl SQL> SELECT * FROM dba_flashback_archive_ts;

FLASHBACK_ARCHIVE_NAME FLASHBACK_ARCHIVE# TABLESPACE_NAME       QUOTA_IN_MB
---------------------- ------------------ ---------------      ----------------
Y_5_YEAR_ARCHIVE        1                FBA_5_YEAR_01                  50
 
MY_5_YEAR_ARCHIVE        1                FBA_5_YEAR_02                  30

LUTZ  @ orcl SQL> ALTER FLASHBACK DATA ARCHIVE my_5_year_archive

      MODIFY RETENTION 10 YEARS;

SYS AS SYSDBA @ orcl SQL> SELECT * FROM dba_flashback_archive;

FLASHBACK_ARCHIVE_NAME FLASHBACK_ARCHIVE# RETENTION_IN_DAYS CREATE_TIME LAST_PURGE_TIME  STATUS
---------------------- -----------------  -----------------  ----------  -------------
--------------------------------------

MY_5_YEAR_ARCHIVE           1              3650             05-DEC-07    11.11.23.000000000 PM 05-DEC-07       11.11.23.000000000 PM

To remove history data from the flashback archive ad hoc, and before the RETENTION time has exceeded,  the PURGE clause has to be used:

LUTZ  @ orcl SQL> ALTER FLASHBACK ARCHIVE my_5_year_archive
                  
PURGE BEFORE TIMESTAMP (SYSTIMESTAMP - INTERVAL '5' MINUTE); 

% The RETENTION clause defines a purging policy for the historical data of all             tables associated with the flashback archive.

% It is also possible to change the RETENTION policy of a flashback data            archive any time afterwards

% The history data automatically ages out with the RETENTION period and is            purged from the flashback archive.
 

It is possible to define a DEFAULT FLASHBACK ARCHIVE for a database. However, note that there can only be one default flashback archive.

LUTZ  @ orcl SQL> ALTER FLASHBACK DATA ARCHIVE my_5_year_archive
      SET DEFAULT;

SYS AS SYSDBA @ orcl SQL> SELECT flashback_archive_name, status
                                FROM dba_flashback_archive;

FLASHBACK_ARCHIVE_NAME  STATUS
---------------------- --------
MY_5_YEAR_ARCHIVE       DEFAULT

% The DEFAULT key word can be specified in the following statements:

  • CREATE FLASHBACK ARCHIVE

  • ALTER FLASHBACK ARCHIVE
     

The next step after creating the flashback archive is to associate it with a table. In other words, flashback archiving should be enabled for a table, and the flashback archive to be used must be enabled.

SYS AS SYSDBA @ orcl SQL> ALTER TABLE lutz.t_d
                            FLASHBACK ARCHIVE my_5_year_archive;
 

Now the server will track DMLs on the table lutz.t_d.


 

This is an excerpt from the new book Oracle 11g New Features: Expert Guide to the Important New Features by John Garmany, Steve Karam, Lutz Hartmann, V. J. Jain, Brian Carr.

You can buy it direct from the publisher for 30% off.

 

 
��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.