Skip to Main Content
  • Questions
  • Remove History from Flash Back Archive

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Arun.

Asked: May 30, 2017 - 11:26 am UTC

Last updated: June 25, 2024 - 4:23 am UTC

Version: Oracle 12C

Viewed 1000+ times

You Asked

Hi Tom,

I have a requirement to update/Delete(permanent) the archived(Data deleted. But present in flashback archive) data.

Can we update/delete(permanently) a record/set of records present in flashback archive?

and Chris said...

You mean you want to remove rows from Flashback Data Archive that appear when you run:

select * from table as of (timestamp|scn) ...


?

If so, the short answer is no, you can't.

The data in the archive is read only, so you can't selectively remove it. That said, there are a couple of options to wipe old info

Purging data

You can remove all the data in FDA before a given point with:

alter flashback archive <arc> purge before (scn|timestamp) ...


Note there's a bug in this (19206785) so it doesn't work up to 12.1 :( It's fixed in 12.2.

Disabling flashback archive

Purging removes the history for all tables. If you only want to remove one you can by toggling flashback archive on and off:

alter table <tab> no flashback archive;
alter table <tab> flashback archive;

Rating

  (5 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Flashback Data Archive with Switchover

Shobhit Bhate, June 14, 2024 - 5:58 am UTC

Hi Tom,
1)
Does flashback data archive works after switchover and switchback activity in Oracle 19c?
2)
Is there any limit maximum retention period for Flashback Data Archive in Oracle 19c?
3)
Please let us know the scenarios when optimized data should not be tried?
Connor McDonald
June 18, 2024 - 4:15 am UTC

Flashback Data Archive with Switchover

A reader, June 18, 2024 - 1:39 pm UTC

Thanks Connor for addressing the query. :-)
Chris Saxon
June 21, 2024 - 10:11 am UTC

You're welcome

Flashback Data Archive Performance

Shobhit Bhate, June 20, 2024 - 4:54 am UTC

Thanks Connor for addressing the query :-)



1) By optimized data I meant - " (Optional) Whether to optimize the storage of data in the history tables maintained in the Flashback Archive, using [NO] OPTIMIZE DATA. The default is NO OPTIMIZE DATA. "


Please let us know the scenario when optimized data option should not be configured?


2) How can we improve the performance of data retrieval from the Flashback archive ? Can we create indexes on the archives or partition the archives?


3) Can we move the data out of the archives using data pump or some other mechanism to retain it for much longer than the retention period specified for the archives and at the same time not impact the performance of the flashback archives?


Chris Saxon
June 21, 2024 - 10:16 am UTC

1 From the CREATE FLASHBACK ARCHIVE docs:

Specify OPTIMIZE DATA to enable optimization for flashback archive history tables. This instructs the database to optimize the storage of data in history tables using any of the following features: Advanced Row Compression, Advanced LOB Compression, Advanced LOB Deduplication, segment-level compression tiering, and row-level compression tiering. To specify this clause, you must have a license for the Advanced Compression option.

(emphasis mine)

2. The database partitions in the history tables automatically.

3. You can't export the data like regular tables. 21c added the package DBMS_FLASHBACK_ARCHIVE_MIGRATE to help you export/import this data. You can also run your own queries get the historic data and save it to another location.

Flashback Data Archive Roles and Privileges

Shobhit Bhate, June 21, 2024 - 4:05 am UTC

Hi Connor / Chris

4) Adding one more question to the list.
Following the security model , generally the schema containing the objects is not used for logon activity, separate users are created for connecting to the database. Please let us know the grants /roles /privileges a user should have to access the flashback data archive of a different schema.

For example, EMP table resides in SCOTT schema and flashback data archive FLA1 is configured for the EMP table.
User named TIGER is created for connecting to the database.

Question :- Please let us know the grants /roles /privileges TIGER user should have to access audit data from flashback data archive FLA1 for EMP table that is to run the following query -


conn Tiger/xxx

select empno, ename, job, sal, comm,
nvl(VERSIONS_STARTTIME,LAST_MOD) TS
,nvl(VERSIONS_OPERATION,'I') op
from EMP
versions between timestamp
TIMESTAMP (SYSTIMESTAMP - 10) AND SYSTIMESTAMP
order by empno;

Chris Saxon
June 21, 2024 - 10:28 am UTC

Other users need query (SELECT/READ) and FLASHBACK privileges.

Shobhit Bhate, June 24, 2024 - 2:21 pm UTC

Thanks a lot Chris for addressing the queries.
Connor McDonald
June 25, 2024 - 4:23 am UTC

glad we could help