required archivelog files for a guaranteed restore point 查找GRP需要的归档文件

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';

相关推荐
七夜zippoe12 分钟前
DolphinDB SQL查询:从简单到复杂
数据库·sql·mysql·查询·dolphindb
山峰哥1 小时前
SQL性能飞跃:从索引策略到查询优化的全链路实战指南
数据库·sql·性能优化·深度优先
fy121631 小时前
【SQL】写SQL查询时,常用到的日期函数
数据库·sql
wuyikeer2 小时前
如何在docker中的mysql容器内执行命令与执行SQL文件
sql·mysql·docker
王仲肖3 小时前
PostgreSQL 关系级锁 — 总结与优化指南
数据库·postgresql·oracle
云边有个稻草人4 小时前
运营每次改数据都要等排期?我用飞牛NAS搭了个在线表格数据库,非技术也能自己管了
数据库·oracle
孟意昶5 小时前
Doris专题28-聚合多维分析
大数据·数据库·数据仓库·sql·doris
苏瞳儿10 小时前
java对数据库的增删改查
java·数据库·oracle
程序边界17 小时前
KingbaseES 表空间目录自动创建特性深度解析(下篇)
数据库·oracle
七夜zippoe19 小时前
DolphinDB SQL查询:从基础到进阶
数据库·sql·进阶·聚合·dolphindb