dataguard添加临时数据文件的bug

简介: 有一个环境是10gR2,一主两备,因为10g的备库还不是active,所以有一些查询的需求的时候,我们还是会打开相应的窗口时间。 开发的同学需要做一个大查询,数据只能全表,而且还有order by,势必会消耗大量的temp空间,这个时候充分利用备库就是好一些,有一个备库平时也没有用过,今天就用这个备库来完成查询需求。
有一个环境是10gR2,一主两备,因为10g的备库还不是active,所以有一些查询的需求的时候,我们还是会打开相应的窗口时间。
开发的同学需要做一个大查询,数据只能全表,而且还有order by,势必会消耗大量的temp空间,这个时候充分利用备库就是好一些,有一个备库平时也没有用过,今天就用这个备库来完成查询需求。
但是过了一会,开发同事说,查询失败了。让我看看什么原因。
开发同学提供的日志为:
2015-11-20 10:48:05,---exception: ---- StatementCallback; uncategorized SQLException for SQL [select c.cn as cn,c.uin as uin from test_bind c where enabled='Y' group by c.cn,c.uin having count(c.cn) >1]; SQL state [99999]; error code [25153]; ORA-25153: Temporary Tablespace is Empty
; nested exception is java.sql.SQLException: ORA-25153: Temporary Tablespace is Empty
看来这个问题还挺不好意思的,原来临时表空间为空了。
SQL> select file_name,bytes from dba_temp_files;
no rows
那么备库中的临时表空间怎么没了呢?
查看历史记录发现是在前几天的一次日志应用后,临时表空间清空了。
Tue Nov 17 17:48:23 CST 2015
Media Recovery Log /U01/app/oracle/admin/acctest/arch/1_21281_782846320.dbf
Recovery deleting tempfile #3:'/U03/app/oracle/oradata/acctest/temp03.dbf'
Recovery deleting tempfile #2:'/U03/app/oracle/oradata/acctest/temp02.dbf'
Recovery deleting tempfile #1:'/U03/app/oracle/oradata/acctest/temp01.dbf'
Recovery dropped temporary tablespace 'TEMP'
Media Recovery Waiting for thread 1 sequence 21282
因为临时表空间对于数据库来说还是一个辅助的部分,主备库可以不同。所以简单的分析之后决定还是手工添加临时数据文件。
这个时候查看临时表空间,发现已经是TEMP2了。
SQL> select tablespace_name from dba_tablespaces;
TABLESPACE_NAME
---------------
SYSTEM
UNDOTBS1
SYSAUX
USERS
...
TEMP2
9 rows selected.
既然是空的,那就添加一个临时数据文件吧。结果基本功不扎实,错误提示还是有些误导。
SQL> alter tablespace temp2 add datafile /U03/app/oracle/oradata/acctest/temp01.dbf' size 32G;
alter tablespace temp2 add datafile /U03/app/oracle/oradata/acctest/temp01.dbf' size 32G
                                    *
ERROR at line 1:
ORA-16000: database open for read-only access
简单修改,把datafile改为tempfile继续
SQL> alter tablespace temp2 add tempfile '/U03/app/oracle/oradata/acctest/temp01.dbf' size 30G;
alter tablespace temp2 add tempfile '/U03/app/oracle/oradata/acctest/temp01.dbf' size 30G
*
ERROR at line 1:
ORA-01119: error in creating database file '/U03/app/oracle/oradata/acctest/temp01.dbf'
ORA-27038: created file already exists
Additional information: 1
这个时候提示文件已经存在,好吧,确实是文件存在,那我就reuse吧。
使用resue的方式,结果报出了ORA-27086的错误。
SQL> alter tablespace temp2 add tempfile '/U03/app/oracle/oradata/acctest/temp01.dbf' size 30G reuse;
alter tablespace temp2 add tempfile '/U03/app/oracle/oradata/acctest/temp01.dbf' size 30G reuse
*
ERROR at line 1:
ORA-01119: error in creating database file '/U03/app/oracle/oradata/acctest/temp01.dbf'
ORA-27086: unable to lock file - already in use
Linux-x86_64 Error: 11: Resource temporarily unavailable
Additional information: 8
Additional information: 19076
这个错误还是让人有些摸不着头脑。是本身就有临时数据文件吗?
SQL> select file_name,bytes from dba_temp_files;
no rows
这个时候查看文件系统中文件的情况。发现貌似时间戳确实是更新了,但是这个文件就是不在数据字典里。
$ ll temp*.dbf
total 432600976
-rw-r----- 1 oracle oinstall 32212262912 Nov 20 10:58 temp01.dbf
-rw-r----- 1 oracle oinstall 21109940224 Jan  5  2015 temp02.dbf
-rw-r----- 1 oracle oinstall 21109940224 Jan  5  2015 temp03.dbf
那么这个问题还是很奇怪的,只能联想到是bug了,结果一查还真有这么一个bug,版本都完全符合。
Bug 15944809 - add tempfile at physical standby fails with ORA-1119, ORA-27086 (Doc ID 15944809.8)
这个问题的workaround 有两个,一个就是重启备库
Workaround
A shutdown/startup of the standby databse will clear the DBW0's
stale file lock state, and then the new tempfile can be created.
那我先试试添加一个新的数据文件,先不停库。
SQL> alter tablespace temp2 add tempfile '/U03/app/oracle/oradata/acctest/temp04.dbf' size 10G;
Tablespace altered.
可以创建了,那就开始resize一下。
SQL> alter database tempfile '/U03/app/oracle/oradata/acctest/temp04.dbf' resize 30G;
Database altered.
这个时候,先让开发同学去完成这个查询任务。
然后查询完成之后,收回环境之后,就可以尝试重启了。
重启之后,再次添加临时数据文件,就没有问题了。
SQL> alter tablespace temp2 add tempfile '/U03/app/oracle/oradata/acctest/temp01.dbf' size 30G reuse;       
Tablespace altered.
SQL> select name,bytes from v$tempfile;
NAME                                                    BYTES
-------------------------------------------------- ----------
/U03/app/oracle/oradata/acctest/temp04.dbf        3.2212E+10
/U03/app/oracle/oradata/acctest/temp01.dbf        3.2212E+10



目录
相关文章
|
4天前
|
云安全 人工智能 安全
AI被攻击怎么办?
阿里云提供 AI 全栈安全能力,其中对网络攻击的主动识别、智能阻断与快速响应构成其核心防线,依托原生安全防护为客户筑牢免疫屏障。
|
14天前
|
域名解析 人工智能
【实操攻略】手把手教学,免费领取.CN域名
即日起至2025年12月31日,购买万小智AI建站或云·企业官网,每单可免费领1个.CN域名首年!跟我了解领取攻略吧~
|
8天前
|
安全 Java Android开发
深度解析 Android 崩溃捕获原理及从崩溃到归因的闭环实践
崩溃堆栈全是 a.b.c?Native 错误查不到行号?本文详解 Android 崩溃采集全链路原理,教你如何把“天书”变“说明书”。RUM SDK 已支持一键接入。
565 210
|
3天前
|
编解码 Linux 数据安全/隐私保护
教程分享免费视频压缩软件,免费视频压缩,视频压缩免费,附压缩方法及学习教程
教程分享免费视频压缩软件,免费视频压缩,视频压缩免费,附压缩方法及学习教程
227 138
|
存储 人工智能 监控
从代码生成到自主决策:打造一个Coding驱动的“自我编程”Agent
本文介绍了一种基于LLM的“自我编程”Agent系统,通过代码驱动实现复杂逻辑。该Agent以Python为执行引擎,结合Py4j实现Java与Python交互,支持多工具调用、记忆分层与上下文工程,具备感知、认知、表达、自我评估等能力模块,目标是打造可进化的“1.5线”智能助手。
796 59
|
6天前
|
人工智能 移动开发 自然语言处理
2025最新HTML静态网页制作工具推荐:10款免费在线生成器小白也能5分钟上手
晓猛团队精选2025年10款真正免费、无需编程的在线HTML建站工具,涵盖AI生成、拖拽编辑、设计稿转代码等多种类型,均支持浏览器直接使用、快速出图与文件导出,特别适合零基础用户快速搭建个人网站、落地页或企业官网。
1108 157
|
6天前
|
存储 安全 固态存储
四款WIN PE工具,都可以实现U盘安装教程
Windows PE是基于NT内核的轻量系统,用于系统安装、分区管理及故障修复。本文推荐多款PE制作工具,支持U盘启动,兼容UEFI/Legacy模式,具备备份还原、驱动识别等功能,操作简便,适合新旧电脑维护使用。
479 109