Applies to:
Oracle Database - Enterprise Edition - Version 11.2.0.2 and later
Information in this document applies to any platform.
Goal
How can you determine the required archivelog files needed for a guaranteed restore point before running flashback database?
Solution
The following query should give this information:
SELECT DISTINCT al.thread#, al.sequence#, al.resetlogs_change#, al.resetlogs_time
FROM v$archived_log al,
(select grsp.rspfscn from_scn,
grsp.rspscn to_scn,
dbinc.resetlogs_change# resetlogs_change#,
dbinc.resetlogs_time resetlogs_time
from xkccrsp grsp, vdatabase_incarnation dbinc
where grsp.rspincarn = dbinc.incarnation#
and bitand(grsp.rspflags, 2) != 0
and bitand(grsp.rspflags, 1) = 1 -- guaranteed
and grsp.rspfscn <= grsp.rspscn -- filter clean grp
and grsp.rspfscn != 0
) grsp
WHERE al.next_change# >= grsp.from_scn
AND al.first_change# <= (grsp.to_scn + 1)
AND al.resetlogs_change# = grsp.resetlogs_change#
AND al.resetlogs_time = grsp.resetlogs_time
AND al.archived = 'YES';