SlideShare a Scribd company logo
1 of 7
Download to read offline
♨ Flashback time travel♨
vs
♨ Flash back Data Archive♨
Oracle 19c and newer
Sometimes DBA need to restore/recover important data set in production to avoiding data lost or
deletion by user interference, and human errors or any problems.
As examples consider a user did some wrong delete on a base table, at this situation if you alert
quickly you have a chance to
fl
ashback deleted rows on the table by using undo data, for
example:
SQL>insert into base_table
Select * from table1 AS OF TIMESTAMP TO_TIMESTAMP('224-02-12 13:34:12', 'YYYY-MM-DD
HH24:MI:SS');
Or
SQL>insert into base_table
Select * from table1 AS OF SCN 123456;
But this chance is depending on sizing of undo_retention parameter and undo tablespace.
that the UNDO_RETENTION is not guaranteed by default so the fact that the UNDO_RETENTION
is 900 seconds (=15 minutes) doesn't necessarily mean that you can query data as of 15 minutes
ago. Another thing that you should also take into account is the UNDO_RETENTION behaviour in
autoextend undo tabelspace vs.
fi
xed-size undo tablespace because in
fi
xed-size undo
tablespace the UNDO_RETENTION is being ignored by Oracle so it's basically meaningless
(unless retention guarantee is enabled).
So you can consider a bigger retention for your undo, but if you want to protect a big table in
production same as this way, this solution is not applicable (very large undo for recovering
inadvertent deleted data is not good solution)
Solution:
Use Flashback Data Archive (FDA).
This solution protects your speci
fi
c tables and also can be used for auditing and tracking
changes on the tables in a isolated and separated tablespace without need Undo tablespace!
So if we have big or very big tables also we can used this feature and we can enable or disable on
demand any time.
The FDA is available feom 11g but has some improvements on 19c and higher.
In Oracle 19c, they rebranded the feature called “Flashback Time Travel”. The Flashback Time
travel is a nothing but a combination Flashback Data archive and Flashback Query AS OF and
Versions.
Use Flashback Time Travel to automatically track and archive historical versions of changes to
tables enabled for
fl
ashback archive, ensuring SQL-level access to the versions of database
objects without getting a snapshot-too-old error.
The Historical data is key for business decisions and having reliable data is very important for
organizations. There are frequent implications for both
fi
nancial and legal data for organizations
and having a secure and accurate history of change of data is crucial for business. Oracle
Flashback technology o
ff
ers signi
fi
cant bene
fi
ts for database management and recovery to meet
the organizational needs.
Using Flashback Time Travel in Orcale 19c and higher
Flashback Time Travel provides the ability to track and store transactional changes to a table over
its lifetime. It is useful for compliance with record stage policies and audit reports.
A Flashback Archive consists of one or more tablespaces or parts thereof. You can have multiple
Flashback Archives. If you are logged on as SYSDBA, you can specify a default Flashback
Archive for the system. A Flashback Archive is con
fi
gured with retention time. Data archived in the
Flashback Archive is retained for the retention time speci
fi
ed when the Flashback Archive was
created.
Creating a Flashback Archive
You can create a Flashback Archive with the CREATEFLASHBACK ARCHIVE statement.
Create a Flashback Archive with the CREATEFLASHBACK ARCHIVE statement, specifying:
• Name of the Flashback Archive
• Name of the
fi
rst tablespace of the Flashback Archive
• (Optional) Maximum amount of space that the Flashback Archive can use in the
fi
rst tablespace
The default is unlimited. Unless your space quota on the
fi
rst tablespace is also unlimited, you
must specify this value; otherwise, error ORA-55621 occurs.
• Retention time (number of days that Flashback Archive data for the table is guaranteed to be
stored)
• (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.
If you are logged on as SYSDBA, you can also specify that this is the default Flashback Archive
for the system. If you omit this option, you can still make this Flashback Archive as default at a
later stage.
Oracle recommends that all users who must use Flashback Archive have unlimited quota on the
Flashback Archive tablespace; however, if this is not the case, you must grant su
ffi
cient quota on
that tablespace to those users.
Examples
• Create a default Flashback Archive named
fl
a1 that uses up to 10 G of tablespace tbs1, whose
data are retained for one year:
SQL> CREATE FLASHBACK ARCHIVE DEFAULT
fl
a1 TABLESPACE tbs1 QUOTA 10G
RETENTION 1 YEAR;
• Create a Flashback Archive named fa2 that uses tablespace tbs2, whose data are retained for
two years:
SQL> CREATE FLASHBACK ARCHIVE fa2 TABLESPACE tbs2 RETENTION 2 YEAR;
Examining and Restoring Past Data
By de
fi
ning FDA or FTT, retrieving data in a older time is same as Flashback method such as:
SQL> Select * from table1 AS OF TIMESTAMP TO_TIMESTAMP('2024-02-12 13:30:12', 'YYYY-
MM-DD HH24:MI:SS');
Suppose that you discover at 12:30 PM that the row for employee KAMRANI was deleted from
the employees table, and you know that at 9:30AM the data for KAMRANI was correctly stored in
the database. You can use Oracle Flashback Query to examine the contents of the table at 9:30
AM to
fi
nd out what data was lost. If appropriate, you can restore the lost data.
Example 1:
Retrieves the state of the record for Kamrani at 9:30AM, April 4, 2024:
SELECT * FROM employees
AS OF TIMESTAMP
TO_TIMESTAMP('2024-02-04 09:30:00', 'YYYY-MM-DD HH:MI:SS')
WHERE last_name = 'Kamrani ';
Example 2 Restores Kamrani's information to the employees table:
INSERT INTO employees (
SELECT * FROM employees
AS OF TIMESTAMP
TO_TIMESTAMP('2024-02-04 09:30:00', 'YYYY-MM-DD HH:MI:SS')
WHERE last_name = 'Kamrani'
);
Bene
fi
ts of Flashback data archive:
Uses of Oracle Flashback Query include:
• Recovering lost data or undoing incorrect, committed changes.
For example, if you mistakenly delete or update rows, and then commit them, you can
immediately undo the mistake.
• Comparing current data with the corresponding data at an earlier time.
For example, you can run a daily report that shows the change in data from yesterday. You can
compare individual rows of table data or
fi
nd intersections or unions of sets of rows.
• Checking the state of transactional data at a particular time.
For example, you can verify the account balance of a certain day.
• Selecting data that was valid at a particular time or at any time within a user-de
fi
ned valid time
period.
For example, you can
fi
nd employees with valid employee information as of a particular
timestamp or between a speci
fi
ed start and end time in the speci
fi
ed valid time period.
• Simplifying application design by removing the need to store some kinds of temporal data.
Oracle Flashback Query lets you retrieve past data directly from the database.
• Applying packaged applications, such as report generation tools, to past data.
• Providing self-service error correction for an application, thereby enabling users to undo and
correct their errors.
Guidelines for Oracle Flashback Query
• You can specify or omit the AS OF clause for each table and specify di
ff
erent times for di
ff
erent
tables.
• Note: If a table is a Flashback Time Travel and you specify a time for it that is earlier than its
creation time, the query returns zero rows for that table, rather than causing an error.
• You can use the AS OF clause in queries to perform data de
fi
nition language (DDL) operations
(such as creating and truncating tables) or data manipulation language (DML) statements (such
as INSERT and DELETE) in the same session as Oracle Flashback Query.
• To use the result of Oracle Flashback Query in a DDL or DML statement that a
ff
ects the current
state of the database, use an AS OFclause inside an INSERT or CREATE TABLEAS SELECT
statement.
• If a possible 3-second error (maximum) is important to Oracle Flashback Query in your
application, use an SCN instead of a time stamp.
• You can create a view that refers to past data by using the AS OF clause in the SELECT
statement that de
fi
nes the view.
If you specify a relative time by subtracting from the current time on the database host, the past
time is recalculated for each query. For example:
CREATE VIEW hour_ago AS SELECT * FROM employees AS OF TIMESTAMP
(SYSTIMESTAMP - INTERVAL '60' MINUTE);
SYSTIMESTAMP refers to the time zone of the database host environment.
• You can use the AS OF clause in self-joins, or in set operations such as INTERSECTand MINUS,
to extract or compare data from two di
ff
erent times.
You can store the results by preceding Oracle Flashback Query with a CREATETABLE AS
SELECT or INSERT INTO TABLESELECT statement. For example, this query reinserts into table
employees the rows that existed an hour ago:
INSERT INTO employees (SELECT * FROM employees AS OF TIMESTAMP
(SYSTIMESTAMP - INTERVAL '60' MINUTE) MINUS SELECT * FROM employees;
SYSTIMESTAMP refers to the time zone of the database host environment.
• You can use the AS OF clause in queries to check for data that was valid at a particular time.
Using Oracle Flashback Version Query
Use Oracle Flashback Version Query to retrieve the di
ff
erent versions of speci
fi
c rows that existed
during a given time interval. A row version is created whenever a COMMIT statement is executed.
Note:After executing a CREATE TABLE statement, wait at least 15 seconds to commit any
transactions, to ensure that Oracle Flashback Version Query re
fl
ects those transactions.
Specify Oracle Flashback Version Query using the VERSIONS BETWEEN clause of the SELECT
statement. The syntax is either:
VERSIONS BETWEEN { SCN | TIMESTAMP } start AND end
where start and end are expressions representing the start and end, respectively, of the time
interval to be queried. The time interval includes (start and end).
or:
VERSIONS PERIOD FOR user_valid_time [ BETWEEN TIMESTAMP start AND end ]
where user_valid_time refers to the user-speci
fi
ed valid time period.
Oracle Flashback Version Query returns a table with a row for each version of the row that existed
at any time during the speci
fi
ed time interval. Each row in the table includes pseudocolumns of
metadata about the row version, which can reveal when and how a particular change (perhaps
erroneous) occurred to your database.
For example, this output indicates that the salary was 10243 from September 9, 2023, included,
to November 25, 2024, excluded.
VERSIONS_START_TIME VERSIONS_END_TIME SALARY
----------------- ----------------- ------
09-SEP-2"24 25-NOV-2024 10243
Here is a typical use of Oracle Flashback Version Query:
SELECT versions_startscn, versions_starttime,
versions_endscn, versions_endtime,
versions_xid, versions_operation,
last_name, salary
FROM employees
VERSIONS BETWEEN TIMESTAMP
TO_TIMESTAMP('2024-12-18 14:00:00', 'YYYY-MM-DD HH24:MI:SS')
AND TO_TIMESTAMP('2024-12-18 17:00:00', 'YYYY-MM-DD HH24:MI:SS')
WHERE
fi
rst_name = 'John';
You can use VERSIONS_XID with Oracle Flashback Transaction Query to locate this transaction's
metadata, including the SQL required to undo the row change and the user responsible for the
change.
Flashback Version Query allows index-only access only with IOTs (index-organized tables), but
index fast full scan is not allowed.
Using Flashback Time Travel
Flashback Time Travel provides the ability to track and store transactional changes to a table over
its lifetime. It is useful for compliance with record stage policies and audit reports.
A Flashback Archive consists of one or more tablespaces or parts thereof. You can have multiple
Flashback Archives. If you are logged on as SYSDBA, you can specify a default Flashback
Archive for the system. A Flashback Archive is con
fi
gured with retention time. Data archived in the
Flashback Archive is retained for the retention time speci
fi
ed when the Flashback Archive was
created.
By default, Flashback Archive is not enabled for any tables. You can enable Flashback Archive for
a table if all of these conditions are true:
• You have the FLASHBACK ARCHIVE object privilege on the Flashback Archive to use for that
table.
• The table is not nested, temporary, remote, or external.
• The table contains neither LONG nor nested columns.
• The table does not use any of these Flashback Archive reserved words as column names:
◦ STARTSCN
◦ ENDSCN
◦ RID
◦ XID
◦ OP
◦ OPERATION
You cannot enable Flashback Archive on a nested table, temporary table, external table,
materialized view, Advanced Query (AQ) table, or non-table object.
After Flashback Archive is enabled for a table, you can disable it only if you either have the
FLASHBACKARCHIVE ADMINISTER system privilege or you are logged on as SYSDBA.
When choosing a Flashback Archive for a speci
fi
c table, consider the data retention requirements
for the table and the retention times of the Flashback Archives on which you have the
FLASHBACK ARCHIVEobject privilege.
E
ff
ective with Oracle Database 12c Release 1 (12.1.0.1), Flashback Archive is enhanced to include
the following:
• User context tracking. The metadata information for tracking transactions can include (if the
feature is enabled) the user context, which makes it easier to determine which user made which
changes to a table.
To set the user context level (determining how much user context is to be saved), use the
DBMS_FLASHBACK_ARCHIVE.SET_CONTEXT_LEVEL procedure. To access the context
information, use the DBMS_FLASHBACK_ARCHIVE.GET_SYS_CONTEXT function.
• Database hardening. This feature enables you to associate a set of tables together in an
"application", and then enable Flashback Archive on all those tables with a single command.
Also, database hardening enables you to lock all the tables with a single command, preventing
any DML on those tables until they are subsequently unlocked. Database hardening is designed
to make it easier to use Flashback Time Travel to track and protect the security-sensitive tables
for an application.
DDL Statements on Tables Enabled for Flashback Archive
Flashback Archive supports only these DDL statements:
• ALTER TABLE statement that does any of the following:
◦ Adds, drops, renames, or modi
fi
es a column
◦ Adds, drops, or renames a constraint
◦ Drops or truncates a partition or subpartition operation
• TRUNCATE TABLE statement
• RENAME statement that renames a table
Flashback Archive does not support DDL statements that move, split, merge, or coalesce
partitions or subpartitions, move tables, or convert LONG columns to LOB columns.
For example, the following DDL statements cause error ORA-55610 when used on a table
enabled for Flashback Archive:
• ALTER TABLE statement that includes an UPGRADE TABLE clause, with or without an
INCLUDING DATA clause
• ALTER TABLE statement that moves or exchanges a partition or subpartition operation
• DROP TABLE statement
If you must use unsupported DDL statements on a table enabled for Flashback Archive, use the
DBMS_FLASHBACK_ARCHIVE.DISASSOCIATE_FBAprocedure to disassociate the base table
from its Flashback Archive. To reassociate the Flashback Archive with the base table afterward,
use the DBMS_FLASHBACK_ARCHIVE.REASSOCIATE_FBAprocedure. Also, to drop a table
enabled for Flashback Archive, you must
fi
rst disable Flashback Archive on the table by using the
ALTER TABLE ... NO FLASHBACK ARCHIVE clause.
Consideration:
Before con
fi
guration of FDA you should consider following:
Allocate su
ffi
cient storage to handle retention period
•For Faster access create indexes on the History tables
•Ideal approach is to create FDA on tables with primary key
•Enable FDA on tables which are important for business not on all tables in a schema
Limitations:
You can enable
fl
ashback data archive, but you must meet below conditions:
You cannot enable Flashback Archive on a nested table, temporary table, external table,
materialized view, Advanced Query (AQ) table, or non-table object.
•The table is not nested, remote, external, or temporary
•The table has neither nested column or LONG column
•The table does not any reserved words as column names such as START SCN, END SCN, OP,
OPERATION, XID, RID
•The user should have FLASHBACK ARCHIVE object privilege.
Conclusion:
The historical data is key for business decisions and having reliable data is very important for
organizations. Flashback Data Archive and Time Travel provides centralized historical data store
by tracking changes in a secure and e
ffi
cient way, which helps organization with compliance,
audit, historical reporting, selective data recovery and restore lost data cause of human
interference
and many other capabilities, but this feature have some limitations aslo.
For more information see:
https://docs.oracle.com/en/database/oracle/oracle-database/19/adfns/
fl
ashback.html
Sincerely,
Alireza Kamrani.

More Related Content

Similar to Flashback time travel vs Flash back Data Archive.pdf

OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowOTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
Less17 flashback tb3
Less17 flashback tb3Less17 flashback tb3
Less17 flashback tb3Imran Ali
 
2009 Collaborate IOUG Presentation
2009 Collaborate IOUG Presentation2009 Collaborate IOUG Presentation
2009 Collaborate IOUG PresentationBiju Thomas
 
1783696 huge space consumption of sm optstat in sysaux tablespace
1783696 huge space consumption of sm optstat in sysaux tablespace1783696 huge space consumption of sm optstat in sysaux tablespace
1783696 huge space consumption of sm optstat in sysaux tablespaceVictor Hugo
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...Alex Zaballa
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...Alex Zaballa
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowAlex Zaballa
 
Trivadis TechEvent 2017 SQL Server 2016 Temporal Tables by Willfried Färber
Trivadis TechEvent 2017 SQL Server 2016 Temporal Tables by Willfried FärberTrivadis TechEvent 2017 SQL Server 2016 Temporal Tables by Willfried Färber
Trivadis TechEvent 2017 SQL Server 2016 Temporal Tables by Willfried FärberTrivadis
 
My SYSAUX tablespace is full - please help
My SYSAUX tablespace is full - please helpMy SYSAUX tablespace is full - please help
My SYSAUX tablespace is full - please helpMarkus Flechtner
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slidesmetsarin
 
2020 New Updated 1Z0-060 Questions and Answers
2020 New Updated 1Z0-060 Questions and Answers2020 New Updated 1Z0-060 Questions and Answers
2020 New Updated 1Z0-060 Questions and Answersdouglascarnicelli
 
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaaPerfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaaCuneyt Goksu
 
Improving the Performance of PL/SQL function calls from SQL
Improving the Performance of PL/SQL function calls from SQLImproving the Performance of PL/SQL function calls from SQL
Improving the Performance of PL/SQL function calls from SQLGuatemala User Group
 
B35 all you wanna know about rman by francisco alvarez
B35 all you wanna know about rman by francisco alvarezB35 all you wanna know about rman by francisco alvarez
B35 all you wanna know about rman by francisco alvarezInsight Technology, Inc.
 
Data base testing
Data base testingData base testing
Data base testingBugRaptors
 
Optimizing Data Accessin Sq Lserver2005
Optimizing Data Accessin Sq Lserver2005Optimizing Data Accessin Sq Lserver2005
Optimizing Data Accessin Sq Lserver2005rainynovember12
 

Similar to Flashback time travel vs Flash back Data Archive.pdf (20)

OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should KnowOTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
OTN TOUR 2016 - DBA Commands and Concepts That Every Developer Should Know
 
Les 11 fl2
Les 11 fl2Les 11 fl2
Les 11 fl2
 
Less17 flashback tb3
Less17 flashback tb3Less17 flashback tb3
Less17 flashback tb3
 
2009 Collaborate IOUG Presentation
2009 Collaborate IOUG Presentation2009 Collaborate IOUG Presentation
2009 Collaborate IOUG Presentation
 
1783696 huge space consumption of sm optstat in sysaux tablespace
1783696 huge space consumption of sm optstat in sysaux tablespace1783696 huge space consumption of sm optstat in sysaux tablespace
1783696 huge space consumption of sm optstat in sysaux tablespace
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
 
Trivadis TechEvent 2017 SQL Server 2016 Temporal Tables by Willfried Färber
Trivadis TechEvent 2017 SQL Server 2016 Temporal Tables by Willfried FärberTrivadis TechEvent 2017 SQL Server 2016 Temporal Tables by Willfried Färber
Trivadis TechEvent 2017 SQL Server 2016 Temporal Tables by Willfried Färber
 
My SYSAUX tablespace is full - please help
My SYSAUX tablespace is full - please helpMy SYSAUX tablespace is full - please help
My SYSAUX tablespace is full - please help
 
Oracle SQL Tuning
Oracle SQL TuningOracle SQL Tuning
Oracle SQL Tuning
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slides
 
2020 New Updated 1Z0-060 Questions and Answers
2020 New Updated 1Z0-060 Questions and Answers2020 New Updated 1Z0-060 Questions and Answers
2020 New Updated 1Z0-060 Questions and Answers
 
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaaPerfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
 
Improving the Performance of PL/SQL function calls from SQL
Improving the Performance of PL/SQL function calls from SQLImproving the Performance of PL/SQL function calls from SQL
Improving the Performance of PL/SQL function calls from SQL
 
B35 all you wanna know about rman by francisco alvarez
B35 all you wanna know about rman by francisco alvarezB35 all you wanna know about rman by francisco alvarez
B35 all you wanna know about rman by francisco alvarez
 
Data base testing
Data base testingData base testing
Data base testing
 
Optimizing Data Accessin Sq Lserver2005
Optimizing Data Accessin Sq Lserver2005Optimizing Data Accessin Sq Lserver2005
Optimizing Data Accessin Sq Lserver2005
 

More from Alireza Kamrani

Oracle Application Continuity with Oracle RAC for java
Oracle Application Continuity with Oracle RAC for javaOracle Application Continuity with Oracle RAC for java
Oracle Application Continuity with Oracle RAC for javaAlireza Kamrani
 
Oracle database maximum performance on Exadata
Oracle database maximum performance on ExadataOracle database maximum performance on Exadata
Oracle database maximum performance on ExadataAlireza Kamrani
 
Clone_a_remote_PDB_in_Data_Guard_Environments_19c_1698741799.pdf
Clone_a_remote_PDB_in_Data_Guard_Environments_19c_1698741799.pdfClone_a_remote_PDB_in_Data_Guard_Environments_19c_1698741799.pdf
Clone_a_remote_PDB_in_Data_Guard_Environments_19c_1698741799.pdfAlireza Kamrani
 
Import option in Oracle Database : tip & trick🧶.pdf
Import option in Oracle Database : tip & trick🧶.pdfImport option in Oracle Database : tip & trick🧶.pdf
Import option in Oracle Database : tip & trick🧶.pdfAlireza Kamrani
 
🔴Oracle ASM Filter Driver & ASMLIB & UDEV🔴.pdf
🔴Oracle ASM Filter Driver & ASMLIB & UDEV🔴.pdf🔴Oracle ASM Filter Driver & ASMLIB & UDEV🔴.pdf
🔴Oracle ASM Filter Driver & ASMLIB & UDEV🔴.pdfAlireza Kamrani
 
Recovering a Oracle datafile without backup.pdf
Recovering a Oracle datafile without backup.pdfRecovering a Oracle datafile without backup.pdf
Recovering a Oracle datafile without backup.pdfAlireza Kamrani
 
♨️How To Use DataPump (EXPDP) To Export From Physical Standby….pdf
♨️How To Use DataPump (EXPDP) To Export From Physical Standby….pdf♨️How To Use DataPump (EXPDP) To Export From Physical Standby….pdf
♨️How To Use DataPump (EXPDP) To Export From Physical Standby….pdfAlireza Kamrani
 
♨️CPU limitation per Oracle database instance
♨️CPU limitation per Oracle database instance♨️CPU limitation per Oracle database instance
♨️CPU limitation per Oracle database instanceAlireza Kamrani
 
Out-of-Place Oracle Database Patching and Provisioning Golden Images
Out-of-Place Oracle Database Patching and Provisioning Golden ImagesOut-of-Place Oracle Database Patching and Provisioning Golden Images
Out-of-Place Oracle Database Patching and Provisioning Golden ImagesAlireza Kamrani
 
IO Schedulers (Elevater) concept and its affection on database performance
IO Schedulers (Elevater) concept and its affection on database performanceIO Schedulers (Elevater) concept and its affection on database performance
IO Schedulers (Elevater) concept and its affection on database performanceAlireza Kamrani
 
The Fundamental Characteristics of Storage concepts for DBAs
The Fundamental Characteristics of Storage concepts for DBAsThe Fundamental Characteristics of Storage concepts for DBAs
The Fundamental Characteristics of Storage concepts for DBAsAlireza Kamrani
 
What is Scalability and How can affect on overall system performance of database
What is Scalability and How can affect on overall system performance of databaseWhat is Scalability and How can affect on overall system performance of database
What is Scalability and How can affect on overall system performance of databaseAlireza Kamrani
 
🏗️Improve database performance with connection pooling and load balancing tec...
🏗️Improve database performance with connection pooling and load balancing tec...🏗️Improve database performance with connection pooling and load balancing tec...
🏗️Improve database performance with connection pooling and load balancing tec...Alireza Kamrani
 
Oracle Database 23c–Fine Grained locking features
Oracle Database 23c–Fine Grained locking featuresOracle Database 23c–Fine Grained locking features
Oracle Database 23c–Fine Grained locking featuresAlireza Kamrani
 
Store non-structured data in JSON column types and enhancements of JSON
Store non-structured data in JSON column types and enhancements of JSONStore non-structured data in JSON column types and enhancements of JSON
Store non-structured data in JSON column types and enhancements of JSONAlireza Kamrani
 
Enhancements in Oracle 23c Introducing the NewOld Returning Clause
Enhancements in Oracle 23c Introducing the NewOld Returning ClauseEnhancements in Oracle 23c Introducing the NewOld Returning Clause
Enhancements in Oracle 23c Introducing the NewOld Returning ClauseAlireza Kamrani
 
PostgreSQL vs Oracle a brief comparison
PostgreSQL vs Oracle a brief  comparisonPostgreSQL vs Oracle a brief  comparison
PostgreSQL vs Oracle a brief comparisonAlireza Kamrani
 
How to take a dump from a Wal file PostgreSQL
How to take a dump from a Wal file PostgreSQLHow to take a dump from a Wal file PostgreSQL
How to take a dump from a Wal file PostgreSQLAlireza Kamrani
 

More from Alireza Kamrani (18)

Oracle Application Continuity with Oracle RAC for java
Oracle Application Continuity with Oracle RAC for javaOracle Application Continuity with Oracle RAC for java
Oracle Application Continuity with Oracle RAC for java
 
Oracle database maximum performance on Exadata
Oracle database maximum performance on ExadataOracle database maximum performance on Exadata
Oracle database maximum performance on Exadata
 
Clone_a_remote_PDB_in_Data_Guard_Environments_19c_1698741799.pdf
Clone_a_remote_PDB_in_Data_Guard_Environments_19c_1698741799.pdfClone_a_remote_PDB_in_Data_Guard_Environments_19c_1698741799.pdf
Clone_a_remote_PDB_in_Data_Guard_Environments_19c_1698741799.pdf
 
Import option in Oracle Database : tip & trick🧶.pdf
Import option in Oracle Database : tip & trick🧶.pdfImport option in Oracle Database : tip & trick🧶.pdf
Import option in Oracle Database : tip & trick🧶.pdf
 
🔴Oracle ASM Filter Driver & ASMLIB & UDEV🔴.pdf
🔴Oracle ASM Filter Driver & ASMLIB & UDEV🔴.pdf🔴Oracle ASM Filter Driver & ASMLIB & UDEV🔴.pdf
🔴Oracle ASM Filter Driver & ASMLIB & UDEV🔴.pdf
 
Recovering a Oracle datafile without backup.pdf
Recovering a Oracle datafile without backup.pdfRecovering a Oracle datafile without backup.pdf
Recovering a Oracle datafile without backup.pdf
 
♨️How To Use DataPump (EXPDP) To Export From Physical Standby….pdf
♨️How To Use DataPump (EXPDP) To Export From Physical Standby….pdf♨️How To Use DataPump (EXPDP) To Export From Physical Standby….pdf
♨️How To Use DataPump (EXPDP) To Export From Physical Standby….pdf
 
♨️CPU limitation per Oracle database instance
♨️CPU limitation per Oracle database instance♨️CPU limitation per Oracle database instance
♨️CPU limitation per Oracle database instance
 
Out-of-Place Oracle Database Patching and Provisioning Golden Images
Out-of-Place Oracle Database Patching and Provisioning Golden ImagesOut-of-Place Oracle Database Patching and Provisioning Golden Images
Out-of-Place Oracle Database Patching and Provisioning Golden Images
 
IO Schedulers (Elevater) concept and its affection on database performance
IO Schedulers (Elevater) concept and its affection on database performanceIO Schedulers (Elevater) concept and its affection on database performance
IO Schedulers (Elevater) concept and its affection on database performance
 
The Fundamental Characteristics of Storage concepts for DBAs
The Fundamental Characteristics of Storage concepts for DBAsThe Fundamental Characteristics of Storage concepts for DBAs
The Fundamental Characteristics of Storage concepts for DBAs
 
What is Scalability and How can affect on overall system performance of database
What is Scalability and How can affect on overall system performance of databaseWhat is Scalability and How can affect on overall system performance of database
What is Scalability and How can affect on overall system performance of database
 
🏗️Improve database performance with connection pooling and load balancing tec...
🏗️Improve database performance with connection pooling and load balancing tec...🏗️Improve database performance with connection pooling and load balancing tec...
🏗️Improve database performance with connection pooling and load balancing tec...
 
Oracle Database 23c–Fine Grained locking features
Oracle Database 23c–Fine Grained locking featuresOracle Database 23c–Fine Grained locking features
Oracle Database 23c–Fine Grained locking features
 
Store non-structured data in JSON column types and enhancements of JSON
Store non-structured data in JSON column types and enhancements of JSONStore non-structured data in JSON column types and enhancements of JSON
Store non-structured data in JSON column types and enhancements of JSON
 
Enhancements in Oracle 23c Introducing the NewOld Returning Clause
Enhancements in Oracle 23c Introducing the NewOld Returning ClauseEnhancements in Oracle 23c Introducing the NewOld Returning Clause
Enhancements in Oracle 23c Introducing the NewOld Returning Clause
 
PostgreSQL vs Oracle a brief comparison
PostgreSQL vs Oracle a brief  comparisonPostgreSQL vs Oracle a brief  comparison
PostgreSQL vs Oracle a brief comparison
 
How to take a dump from a Wal file PostgreSQL
How to take a dump from a Wal file PostgreSQLHow to take a dump from a Wal file PostgreSQL
How to take a dump from a Wal file PostgreSQL
 

Recently uploaded

Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxolyaivanovalion
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改atducpo
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxolyaivanovalion
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSAishani27
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxMohammedJunaid861692
 
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一ffjhghh
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...Suhani Kapoor
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Callshivangimorya083
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxolyaivanovalion
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingNeil Barnes
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 

Recently uploaded (20)

Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptx
 
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in  KishangarhDelhi 99530 vip 56974 Genuine Escort Service Call Girls in  Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
 
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
代办国外大学文凭《原版美国UCLA文凭证书》加州大学洛杉矶分校毕业证制作成绩单修改
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICS
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
 
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
 
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptx
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data Storytelling
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 

Flashback time travel vs Flash back Data Archive.pdf

  • 1. ♨ Flashback time travel♨ vs ♨ Flash back Data Archive♨ Oracle 19c and newer Sometimes DBA need to restore/recover important data set in production to avoiding data lost or deletion by user interference, and human errors or any problems. As examples consider a user did some wrong delete on a base table, at this situation if you alert quickly you have a chance to fl ashback deleted rows on the table by using undo data, for example: SQL>insert into base_table Select * from table1 AS OF TIMESTAMP TO_TIMESTAMP('224-02-12 13:34:12', 'YYYY-MM-DD HH24:MI:SS'); Or SQL>insert into base_table Select * from table1 AS OF SCN 123456; But this chance is depending on sizing of undo_retention parameter and undo tablespace. that the UNDO_RETENTION is not guaranteed by default so the fact that the UNDO_RETENTION is 900 seconds (=15 minutes) doesn't necessarily mean that you can query data as of 15 minutes ago. Another thing that you should also take into account is the UNDO_RETENTION behaviour in autoextend undo tabelspace vs. fi xed-size undo tablespace because in fi xed-size undo tablespace the UNDO_RETENTION is being ignored by Oracle so it's basically meaningless (unless retention guarantee is enabled). So you can consider a bigger retention for your undo, but if you want to protect a big table in production same as this way, this solution is not applicable (very large undo for recovering inadvertent deleted data is not good solution)
  • 2. Solution: Use Flashback Data Archive (FDA). This solution protects your speci fi c tables and also can be used for auditing and tracking changes on the tables in a isolated and separated tablespace without need Undo tablespace! So if we have big or very big tables also we can used this feature and we can enable or disable on demand any time. The FDA is available feom 11g but has some improvements on 19c and higher. In Oracle 19c, they rebranded the feature called “Flashback Time Travel”. The Flashback Time travel is a nothing but a combination Flashback Data archive and Flashback Query AS OF and Versions. Use Flashback Time Travel to automatically track and archive historical versions of changes to tables enabled for fl ashback archive, ensuring SQL-level access to the versions of database objects without getting a snapshot-too-old error. The Historical data is key for business decisions and having reliable data is very important for organizations. There are frequent implications for both fi nancial and legal data for organizations and having a secure and accurate history of change of data is crucial for business. Oracle Flashback technology o ff ers signi fi cant bene fi ts for database management and recovery to meet the organizational needs. Using Flashback Time Travel in Orcale 19c and higher Flashback Time Travel provides the ability to track and store transactional changes to a table over its lifetime. It is useful for compliance with record stage policies and audit reports. A Flashback Archive consists of one or more tablespaces or parts thereof. You can have multiple Flashback Archives. If you are logged on as SYSDBA, you can specify a default Flashback Archive for the system. A Flashback Archive is con fi gured with retention time. Data archived in the Flashback Archive is retained for the retention time speci fi ed when the Flashback Archive was created.
  • 3. Creating a Flashback Archive You can create a Flashback Archive with the CREATEFLASHBACK ARCHIVE statement. Create a Flashback Archive with the CREATEFLASHBACK ARCHIVE statement, specifying: • Name of the Flashback Archive • Name of the fi rst tablespace of the Flashback Archive • (Optional) Maximum amount of space that the Flashback Archive can use in the fi rst tablespace The default is unlimited. Unless your space quota on the fi rst tablespace is also unlimited, you must specify this value; otherwise, error ORA-55621 occurs. • Retention time (number of days that Flashback Archive data for the table is guaranteed to be stored) • (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. If you are logged on as SYSDBA, you can also specify that this is the default Flashback Archive for the system. If you omit this option, you can still make this Flashback Archive as default at a later stage. Oracle recommends that all users who must use Flashback Archive have unlimited quota on the Flashback Archive tablespace; however, if this is not the case, you must grant su ffi cient quota on that tablespace to those users. Examples • Create a default Flashback Archive named fl a1 that uses up to 10 G of tablespace tbs1, whose data are retained for one year: SQL> CREATE FLASHBACK ARCHIVE DEFAULT fl a1 TABLESPACE tbs1 QUOTA 10G RETENTION 1 YEAR; • Create a Flashback Archive named fa2 that uses tablespace tbs2, whose data are retained for two years: SQL> CREATE FLASHBACK ARCHIVE fa2 TABLESPACE tbs2 RETENTION 2 YEAR; Examining and Restoring Past Data By de fi ning FDA or FTT, retrieving data in a older time is same as Flashback method such as: SQL> Select * from table1 AS OF TIMESTAMP TO_TIMESTAMP('2024-02-12 13:30:12', 'YYYY- MM-DD HH24:MI:SS'); Suppose that you discover at 12:30 PM that the row for employee KAMRANI was deleted from the employees table, and you know that at 9:30AM the data for KAMRANI was correctly stored in the database. You can use Oracle Flashback Query to examine the contents of the table at 9:30 AM to fi nd out what data was lost. If appropriate, you can restore the lost data. Example 1: Retrieves the state of the record for Kamrani at 9:30AM, April 4, 2024: SELECT * FROM employees AS OF TIMESTAMP TO_TIMESTAMP('2024-02-04 09:30:00', 'YYYY-MM-DD HH:MI:SS') WHERE last_name = 'Kamrani '; Example 2 Restores Kamrani's information to the employees table:
  • 4. INSERT INTO employees ( SELECT * FROM employees AS OF TIMESTAMP TO_TIMESTAMP('2024-02-04 09:30:00', 'YYYY-MM-DD HH:MI:SS') WHERE last_name = 'Kamrani' ); Bene fi ts of Flashback data archive: Uses of Oracle Flashback Query include: • Recovering lost data or undoing incorrect, committed changes. For example, if you mistakenly delete or update rows, and then commit them, you can immediately undo the mistake. • Comparing current data with the corresponding data at an earlier time. For example, you can run a daily report that shows the change in data from yesterday. You can compare individual rows of table data or fi nd intersections or unions of sets of rows. • Checking the state of transactional data at a particular time. For example, you can verify the account balance of a certain day. • Selecting data that was valid at a particular time or at any time within a user-de fi ned valid time period. For example, you can fi nd employees with valid employee information as of a particular timestamp or between a speci fi ed start and end time in the speci fi ed valid time period. • Simplifying application design by removing the need to store some kinds of temporal data. Oracle Flashback Query lets you retrieve past data directly from the database. • Applying packaged applications, such as report generation tools, to past data. • Providing self-service error correction for an application, thereby enabling users to undo and correct their errors. Guidelines for Oracle Flashback Query • You can specify or omit the AS OF clause for each table and specify di ff erent times for di ff erent tables. • Note: If a table is a Flashback Time Travel and you specify a time for it that is earlier than its creation time, the query returns zero rows for that table, rather than causing an error. • You can use the AS OF clause in queries to perform data de fi nition language (DDL) operations (such as creating and truncating tables) or data manipulation language (DML) statements (such as INSERT and DELETE) in the same session as Oracle Flashback Query. • To use the result of Oracle Flashback Query in a DDL or DML statement that a ff ects the current state of the database, use an AS OFclause inside an INSERT or CREATE TABLEAS SELECT statement. • If a possible 3-second error (maximum) is important to Oracle Flashback Query in your application, use an SCN instead of a time stamp. • You can create a view that refers to past data by using the AS OF clause in the SELECT statement that de fi nes the view. If you specify a relative time by subtracting from the current time on the database host, the past time is recalculated for each query. For example: CREATE VIEW hour_ago AS SELECT * FROM employees AS OF TIMESTAMP (SYSTIMESTAMP - INTERVAL '60' MINUTE); SYSTIMESTAMP refers to the time zone of the database host environment. • You can use the AS OF clause in self-joins, or in set operations such as INTERSECTand MINUS, to extract or compare data from two di ff erent times. You can store the results by preceding Oracle Flashback Query with a CREATETABLE AS SELECT or INSERT INTO TABLESELECT statement. For example, this query reinserts into table employees the rows that existed an hour ago: INSERT INTO employees (SELECT * FROM employees AS OF TIMESTAMP (SYSTIMESTAMP - INTERVAL '60' MINUTE) MINUS SELECT * FROM employees;
  • 5. SYSTIMESTAMP refers to the time zone of the database host environment. • You can use the AS OF clause in queries to check for data that was valid at a particular time. Using Oracle Flashback Version Query Use Oracle Flashback Version Query to retrieve the di ff erent versions of speci fi c rows that existed during a given time interval. A row version is created whenever a COMMIT statement is executed. Note:After executing a CREATE TABLE statement, wait at least 15 seconds to commit any transactions, to ensure that Oracle Flashback Version Query re fl ects those transactions. Specify Oracle Flashback Version Query using the VERSIONS BETWEEN clause of the SELECT statement. The syntax is either: VERSIONS BETWEEN { SCN | TIMESTAMP } start AND end where start and end are expressions representing the start and end, respectively, of the time interval to be queried. The time interval includes (start and end). or: VERSIONS PERIOD FOR user_valid_time [ BETWEEN TIMESTAMP start AND end ] where user_valid_time refers to the user-speci fi ed valid time period. Oracle Flashback Version Query returns a table with a row for each version of the row that existed at any time during the speci fi ed time interval. Each row in the table includes pseudocolumns of metadata about the row version, which can reveal when and how a particular change (perhaps erroneous) occurred to your database. For example, this output indicates that the salary was 10243 from September 9, 2023, included, to November 25, 2024, excluded. VERSIONS_START_TIME VERSIONS_END_TIME SALARY ----------------- ----------------- ------ 09-SEP-2"24 25-NOV-2024 10243 Here is a typical use of Oracle Flashback Version Query: SELECT versions_startscn, versions_starttime, versions_endscn, versions_endtime, versions_xid, versions_operation, last_name, salary FROM employees VERSIONS BETWEEN TIMESTAMP TO_TIMESTAMP('2024-12-18 14:00:00', 'YYYY-MM-DD HH24:MI:SS') AND TO_TIMESTAMP('2024-12-18 17:00:00', 'YYYY-MM-DD HH24:MI:SS') WHERE fi rst_name = 'John'; You can use VERSIONS_XID with Oracle Flashback Transaction Query to locate this transaction's metadata, including the SQL required to undo the row change and the user responsible for the change. Flashback Version Query allows index-only access only with IOTs (index-organized tables), but index fast full scan is not allowed. Using Flashback Time Travel Flashback Time Travel provides the ability to track and store transactional changes to a table over its lifetime. It is useful for compliance with record stage policies and audit reports.
  • 6. A Flashback Archive consists of one or more tablespaces or parts thereof. You can have multiple Flashback Archives. If you are logged on as SYSDBA, you can specify a default Flashback Archive for the system. A Flashback Archive is con fi gured with retention time. Data archived in the Flashback Archive is retained for the retention time speci fi ed when the Flashback Archive was created. By default, Flashback Archive is not enabled for any tables. You can enable Flashback Archive for a table if all of these conditions are true: • You have the FLASHBACK ARCHIVE object privilege on the Flashback Archive to use for that table. • The table is not nested, temporary, remote, or external. • The table contains neither LONG nor nested columns. • The table does not use any of these Flashback Archive reserved words as column names: ◦ STARTSCN ◦ ENDSCN ◦ RID ◦ XID ◦ OP ◦ OPERATION You cannot enable Flashback Archive on a nested table, temporary table, external table, materialized view, Advanced Query (AQ) table, or non-table object. After Flashback Archive is enabled for a table, you can disable it only if you either have the FLASHBACKARCHIVE ADMINISTER system privilege or you are logged on as SYSDBA. When choosing a Flashback Archive for a speci fi c table, consider the data retention requirements for the table and the retention times of the Flashback Archives on which you have the FLASHBACK ARCHIVEobject privilege. E ff ective with Oracle Database 12c Release 1 (12.1.0.1), Flashback Archive is enhanced to include the following: • User context tracking. The metadata information for tracking transactions can include (if the feature is enabled) the user context, which makes it easier to determine which user made which changes to a table. To set the user context level (determining how much user context is to be saved), use the DBMS_FLASHBACK_ARCHIVE.SET_CONTEXT_LEVEL procedure. To access the context information, use the DBMS_FLASHBACK_ARCHIVE.GET_SYS_CONTEXT function. • Database hardening. This feature enables you to associate a set of tables together in an "application", and then enable Flashback Archive on all those tables with a single command. Also, database hardening enables you to lock all the tables with a single command, preventing any DML on those tables until they are subsequently unlocked. Database hardening is designed to make it easier to use Flashback Time Travel to track and protect the security-sensitive tables for an application. DDL Statements on Tables Enabled for Flashback Archive Flashback Archive supports only these DDL statements: • ALTER TABLE statement that does any of the following: ◦ Adds, drops, renames, or modi fi es a column ◦ Adds, drops, or renames a constraint ◦ Drops or truncates a partition or subpartition operation • TRUNCATE TABLE statement • RENAME statement that renames a table Flashback Archive does not support DDL statements that move, split, merge, or coalesce partitions or subpartitions, move tables, or convert LONG columns to LOB columns. For example, the following DDL statements cause error ORA-55610 when used on a table enabled for Flashback Archive: • ALTER TABLE statement that includes an UPGRADE TABLE clause, with or without an INCLUDING DATA clause • ALTER TABLE statement that moves or exchanges a partition or subpartition operation • DROP TABLE statement If you must use unsupported DDL statements on a table enabled for Flashback Archive, use the DBMS_FLASHBACK_ARCHIVE.DISASSOCIATE_FBAprocedure to disassociate the base table from its Flashback Archive. To reassociate the Flashback Archive with the base table afterward,
  • 7. use the DBMS_FLASHBACK_ARCHIVE.REASSOCIATE_FBAprocedure. Also, to drop a table enabled for Flashback Archive, you must fi rst disable Flashback Archive on the table by using the ALTER TABLE ... NO FLASHBACK ARCHIVE clause. Consideration: Before con fi guration of FDA you should consider following: Allocate su ffi cient storage to handle retention period •For Faster access create indexes on the History tables •Ideal approach is to create FDA on tables with primary key •Enable FDA on tables which are important for business not on all tables in a schema Limitations: You can enable fl ashback data archive, but you must meet below conditions: You cannot enable Flashback Archive on a nested table, temporary table, external table, materialized view, Advanced Query (AQ) table, or non-table object. •The table is not nested, remote, external, or temporary •The table has neither nested column or LONG column •The table does not any reserved words as column names such as START SCN, END SCN, OP, OPERATION, XID, RID •The user should have FLASHBACK ARCHIVE object privilege. Conclusion: The historical data is key for business decisions and having reliable data is very important for organizations. Flashback Data Archive and Time Travel provides centralized historical data store by tracking changes in a secure and e ffi cient way, which helps organization with compliance, audit, historical reporting, selective data recovery and restore lost data cause of human interference and many other capabilities, but this feature have some limitations aslo. For more information see: https://docs.oracle.com/en/database/oracle/oracle-database/19/adfns/ fl ashback.html Sincerely, Alireza Kamrani.