惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
IT之家
IT之家
博客园 - Franky
Stack Overflow Blog
Stack Overflow Blog
宝玉的分享
宝玉的分享
Recent Announcements
Recent Announcements
Engineering at Meta
Engineering at Meta
S
SegmentFault 最新的问题
V
Visual Studio Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Last Week in AI
Last Week in AI
H
Help Net Security
V
V2EX
H
Hackread – Cybersecurity News, Data Breaches, AI and More
量子位
博客园 - 叶小钗
J
Java Code Geeks
博客园 - 【当耐特】
月光博客
月光博客
爱范儿
爱范儿
人人都是产品经理
人人都是产品经理
酷 壳 – CoolShell
酷 壳 – CoolShell
小众软件
小众软件

博客园 - 石云华

gpnptool手动修改GPnP-Profile信息,解决GI集群因心跳配置异常而无法启动的问题 hugePage配置不当,浪费太多物理内存,内存不足导致集群重启 terminating the instance due to error 472,故障原因分析 Exadata存储节点的RPM数据库损坏 duplicate方式搭建DataGuard时,报ORA-19563: header validation failed for file错误 Oracle 19.25 RAC 业务 IP 平滑变更实操 EM13c监控Exadata,提示Agent Unreachable Exadata环境中的CVE-2026-31431漏洞说明 /var/log/message日志中的“megaraid_sas 0000:65:00.0: Application firmware crash dump mode set success”信息 DBCA后,只能启动一个实例,都是rp_filter惹的祸 分析Exadata写入慢的性能故障 Exadata更换Infiniband交换机 数据库集群中的bond1接口出现网络丢包 EM13告警:Metric evaluation error start - oracle.sysman.emSDK.agent.fetchlet.exception.FetchletException: Permission denied(publickey,password) Exadata,更换完思科交换机后,与上联交换机无法通信 Exadata更换计算节点的硬盘 Exalogic虚拟机的网络无法启动,提示Device has different MAC address than expected 单个ASM磁盘free空间为0,导致rebalance时提示“ASM磁盘组空间耗尽(ORA-15041)” Exadata的思科交换机,重启后进入到了rommon模式 SYSAUX表空间中的SYS.EXP_HEAD$表,占用大量空间 PX并行进程产生大量的trace日志,导致文件系统撑爆 回收站存在大量对象,导致Insert into...select语句夯住 用dg broker执行switchover时,报0RA-01017 增量备份恢复的方式修改缺失归档的DataGuard 未设置min_free_kbytes参数,导致操作系统进行页缓存回收时,整个操作系统夯住 Exadata数据库性能异常,备份进程卡住 MySQL 5.7版本,搭建一个两主一从的多源主从复制环境 恢复某个数据文件不适当,导致DataGuard无法open数据库 Exadata计算节点的内存出现故障,导致CPU耗尽
Bug 34885986 - Flashback log file was not reused even if ...
石云华 · 2025-08-08 · via 博客园 - 石云华

0.案例概述

客户有一套11.2.0.4 的 RAC +DG环境,primary端的RAC数据库出现故障,检查日志发现:闪回区的空间使用率达到100%,最终导致了数据库故障。 故障解决后,需要分析该故障的具体原因。

1、案例分析

1.1 检查数据库闪回区的配置信息。

S0L> show parameter flash
NAME                              TYPE           VALUE
------------------------------  -------------   ---------
db_flash_cache_file               string   
db_flash_cache_size               integer        0
db_flashback_retention_target     integer        1440

S0L> show parameter recover
NAME                              TYPE           VALUE
------------------------------  -------------   ---------
db_recovery_file_dest             string          +DATA
db_recovery_file_dest_size        integer         100G
db_unrecoverable_scn_tracking     boolean         TRUE
recovery_parallelism              integer         0
S0L>

可见,当前的闪回区大小为100GB,闪回日志的保存时间为1440分钟,也即1天。

1.2  检查闪回区的当前使用情况。

SQL> select * from v$flash_recovery_area_usage;
FILE_TYPE             PERCENT_SPACE_USED   PERCENT_SPACE_RECLAIMABLE    NUMBER_OF_FILES
----------            -------------------  --------------------------   ----------------
CONTROL FILE             0.04                  0                            1
REDO LOG                 2.94                  0                            6
ARHICVED LOG                0                  0                            0
BACKUP PIECE                0                  0                            0
IMAGE COPY                  0                  0                            0
FLASHBACK LOG           41.47                  0                           87
FOREIGN ARCHIVED LOG        0                  0                            0

SQL> select OLDEST_FLASHBACK_SCN, OLDEST_FLASHBACK_TIME, RETENTION_TARGET, ESTIMATED_FLASHBACK_SIZE from v$flashback_database_log;
OLDEST_FLASHBACK_SCN  OLDEST_FLASHBACK_TI   RETENTION_TARGET   ESTIMATED_FLASHBACK_SIZE
--------------------  --------------------  -----------------  -------------------------
676939705              08/16/2024 18:51:02    1440               407937024              

可见,闪回日志占用了整个闪回区41.47%的空间。虽然设置的闪回日志保存时间为1天,但实际上闪回日志重未被自动清理过,数据库可以闪回到一年前。

1.3  检查数据库是否设置了guaranteed restore point。但未发现guaranteed restore point。

1.4 事出反常必有妖。搜索到《Bug 34885986 - Flashback log file was not reused even if db_flashback_retention_target is passed (Doc ID 34885986.8)》这篇文章,果然是一个BUG。

2、解决方案

针对该故障,官方提供了两个Workaround。
 There are 2 possible workarounds:
  - workaround#1: deletes all the flashback logs (this is simplest)
  - workaround#2: deletes a subset of the flashback logs, preserves 
                  all the flashback logs within the retention period
                  (db_flashback_retention_target minutes),

note: these 2 workarounds don't prevent the problem from happening, they just fix the problem after it has happened.
  
 Workaround#1:
 Remove all the flashback logs by disabling then re-enabling flashback:
   alter database flashback off;
   alter database flashback on;
  
 Workaround#2:
 Remove the problematic flashback log (and all the old flashback logs which could have been reused in the past but were not) via the following steps:
  1. check what is the approx current disk space usage Mb of all the flashback logs that were generated within the past db_flashback_retention_target minutes:
         select sum((bytes)/(1024*1024)) "Mb"
           from v$flashback_database_logfile
          where first_time >
                  (sysdate - ( db_flashback_retention_target /(24*60)));
     if the archive logs are also stored in the db_recovery_file_dest area (check via: select * form v$flash_recovery_area_usage), then run a similar query against v$archived_log:
         select sum((blocks*block_size)/(1024*1024)) "Mb"
           from v$archived_log
          where first_time >
                  (sysdate - ( db_flashback_retention_target /(24*60)));
  2. Note down the current FRA limit:
       select value from v$parameter
         where name='db_recovery_file_dest_size';
  3. Take the combined total from step#1, then set the FRA limit to say 120% of that value, via:
       alter system set db_recovery_file_dest_size= ...M;
     note: the +20% will allow for a future peak workload not needing to immediately create new flashback logs for the thread.
  4. as soon as the parameter is lowered, the problematic flashback log with the null x$kccfle.flehtim should be deleted, check this via
     running the selects as described in the "Rediscovery"
  5. restore the FRA limit back to its original value from step#2
       alter system set db_recovery_file_dest_size= ...M;

3、回顾下闪回区的管理规则:

The following rules govern creating, retaining, overwriting and deleting of flashback logs in the fast recovery area:
*  If the fast recovery area has enough space, then a flashback log is created whenever necessary to satisfy the flashback retention target.
*  If a flashback log is old enough that it is no longer needed to satisfy the flashback retention target, then a flashback log is reused.
*  If the database must create a new flashback log and the fast recovery area is full or there is no disk space, then the oldest flashback log is reused instead.
Note:  Reusing the oldest flashback log shortens the flashback database window. If enough flashback logs are reused due to a lack of disk space, then the flashback retention target may not be satisfied.
*  If the fast recovery area is full, then an archived redo log that is reclaimable according to the fast recovery area rules may be automatically deleted by the fast recovery area to make space for other files. In this case, any flashback logs that would require the use of that redo log file for the use of FLASHBACK DATABASE are also deleted.
Note:  According to fast recovery area rules, a file is reclaimable when one of the following criteria is true:  The file is reported as obsolete and not needed by the flashback database. For example, the file is outside the DB_FLASHBACK_RETENTION_TARGET parameters. The file is backed up to tape.
*  No file in the fast recovery area is eligible for deletion if it is required to satisfy a guaranteed restore point. Thus, retention of flashback logs and other files required to satisfy the guaranteed restore point, in addition to files required to satisfy the backup retention policy, can cause the fast recovery area to fill completely. Consult "Responding to a Full Fast Recovery Area" if your fast recovery area becomes full.