Database Reference
In-Depth Information
Flashback Version Query
Flashback Version Query is an enhancement to Flashback Query
technology. It provides the all the versions of a specific row
existed between one time to another time or between one SCN to
another SCN. We use the VERSIONS BETWEEN clause of
SELECT statement to make this happen.
Like Flashback query, make sure that the database is running
under Automatic Undo Management and you have set the
UNDO_RETENTION initialization parameter. Moreover, set the
undo tablespace with RETENTION GUARANTEE option, this
will make sure nothing gets over written in case undo tablespace
gets full before UNDO_RETENTION period.
Let's first have a look on Flashback version query based on
timestamp.
SELECT versions_startscn, versions_starttime,
versions_endscn, versions_endtime,
versions_xid, versions_operation,
emp_id, emp_name
FROM test_emp_table
VERSIONS BETWEEN TIMESTAMP
TO_TIMESTAMP('2008-01-11 15:00:00', 'YYYY-MM-DD
HH24:MI:SS')
AND TO_TIMESTAMP('2008-01-11 17:00:00', 'YYYY-MM-
DD HH24:MI:SS')
WHERE emp_name = 'ASIM';
Using SCN, the SELECT statement will look like as follows.
SELECT versions_startscn, versions_starttime,
versions_endscn, versions_endtime,
versions_xid, versions_operation,
emp_id, emp_name
FROM test_emp_table
VERSIONS BETWEEN SCN 1899340 AND 1899359
WHERE emp_name = 'ASIM';
Search WWH ::




Custom Search