一、环境
数据库环境为DG一主三备(最大可用模式),操作系统均为CentOS release 6.5版本,数据库版本11.2.0.3.15
二、描述
2016年12月26日下午,业务人员突然说系统不能用,一些网页频繁报错,没办法将数据查出来,最后结合开发人将对应的sql提取出来进行分析,发现所有的sql均带有with语法,且都是对standby databae进行的查询。通过metalink查找发现,这与一个bug有关。在ADG环境中使用with语句且系统自动生成临时表时会出现
ORA-30927: Unable to complete execution due to failure in
temporary table transformation报错。(在standby database中会出现)
METALINK上的描述是:
On ADG,
queries that use a cursor-duration temporary table may fail with ORA-30927
errors.
Such
queries use Star with Temp Transformation and subquery factoring (WITH clause).
(Bug 14143632-
ora-30927 on active data guard(文档ID 14143632.8))
此时线上的数据库PSU已打到了11.2.0.3.15但是没有包含这个bug的补丁。补丁号(14143632)
例如:执行如下代码,with内的表被使用了两次,oracle会自动生成一个临时表来存放with内的表。
-
With a as (
-
Select object _id aa,object_name na from dba_objects
-
)
-
Select * from a where aa in (select a.aa from a);
而对于with内的表只使用一次的是不会生成临时表
-
with a as (
-
select object_id aa,object_name na from dba_objects
-
)
-
select * from a;
三、解决
在METALINK下载相应的补丁,上传至standby database服务器
通过opatch查看为一个online的补丁。
且需要19769496这个补丁,在查看以前安装过的补丁发现已经有这个补丁。现在就可以直接在线打补丁。
1. 检查可以在线处理
-
[oracle@oracle-test 14143632]$ opatch query -all online
-
Oracle 中间补丁程序安装程序版本 11.2.0.3.6
-
版权所有 (c) 2013, Oracle Corporation。保留所有权利。
-
Oracle Home : /home/app/oracle/product/11.2.0/dbhome_1
-
Central Inventory : /home/app/oraInventory
-
from : /home/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
-
OPatch version : 11.2.0.3.6
-
OUI version : 11.2.0.3.0
-
Log file location : /home/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2016-12-27_15-36-57下午_1.log
-
-------------------------------------------------------------------------------
-
Patch created on 5 Jun 2015, 23:20:09 hrs PST8PDT
-
Need to shutdown Oracle instances: false
-
Patch is roll-backable: true
-
Patch is a "Patchset Update": false
-
Patch is a rolling patch: true
-
Patch has sql related actions: false
-
Patch is an online patch: true
-
Patch is a portal patch: false
-
Patch is an "auto-enabled" patch: false
-
Patch is translatable: false
-
List of platforms supported:
-
226: Linux x86-64
-
List of prereq patches:
-
19769496
-
List of overlay patches:
-
19769496
-
List of bugs to be fixed:
-
14143632: QUERIES MAY FAIL WITH ORA-30927 ERRORS ON AN ADG STANDBY DATABASE
-
This patch is a "singleton" patch.
-
This patch belongs to the "db" product family
-
This patch supports the patching model as "one-off"
-
This patch supports the language "en"
-
List of executables affected:
-
ORACLE_HOME/bin/oracle
-
ORACLE_HOME/bin/renamedg
-
ORACLE_HOME/lib/libclntsh.so.11.1
-
List of optional components:
-
oracle.rdbms: 11.2.0.3.0
-
List of optional actions:
-
Patch the Database instances with Online Patch hpatch/bug14143632.pch
-
Possible XML representation of the patch:
-
-
-
-
-
-
-
14143632
-
-
-
-
-------------------------------------------------------------------------------
-
OPatch succeeded.
2. 在线打补丁
检查现有补丁
-
[oracle@newfhldb1 OPatch]$ opatch lsinventory
打
14143632补丁
-
[oracle@newfhldb1 ~]$ cd 14143632/
-
[oracle@newfhldb1 14143632]$ ls
-
etc files online README.txt
-
**此处sid username password 均对应当前数据库的sid,username以及password最好使有dba权限的用户**
-
[oracle@newfhldb1 14143632]$ opatch apply online -connectString :::
-
Oracle 中间补丁程序安装程序版本 11.2.0.3.6
-
版权所有 (c) 2013, Oracle Corporation。保留所有权利。
-
Oracle Home : /usr/app/oracle/110203/v01
-
Central Inventory : /usr/app/oracle/oraInventory
-
from : /usr/app/oracle/110203/v01/oraInst.loc
-
OPatch version : 11.2.0.3.6
-
OUI version : 11.2.0.3.0
-
Log file location : /usr/app/oracle/110203/v01/cfgtoollogs/opatch/14143632_Dec_27_2016_12_57_10/apply2016-12-27_12-57-10下午_1.log
-
补丁程序只应在 '-all_nodes' 模式下应用/回退。
-
将 RAC 模式转换为 '-all_nodes' 模式。
-
Applying interim patch '14143632' to OH '/usr/app/oracle/110203/v01'
-
Verifying environment and performing prerequisite checks...
-
All checks passed.
-
提供电子邮件地址以用于接收有关安全问题的通知, 安装 Oracle Configuration Manager 并启动它。如果您使用 My Oracle
-
Support 电子邮件地址/用户名, 操作将更简单。
-
有关详细信息, 请访问 http://www.oracle.com/support/policies.html。
-
电子邮件地址/用户名:
-
尚未提供电子邮件地址以接收有关安全问题的通知。
-
是否不希望收到有关安全问题 (是 [Y], 否 [N]) [N] 的通知: y
-
Backing up files...
-
正在为组件 oracle.rdbms, 11.2.0.3.0 打补丁...
-
正在数据库 'fhlsys' 上安装和启用联机补丁程序 'bug14143632.pch'。
-
Verifying the update...
-
Patch 14143632 successfully applied
-
Log file location: /usr/app/oracle/110203/v01/cfgtoollogs/opatch/14143632_Dec_27_2016_12_57_10/apply2016-12-27_12-57-10下午_1.log
-
OPatch succeeded.
一共三台standby数据库,依次安装。
补丁安装成功,在执行相应带有with且生成临时表的sql语句,执行成功。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30820196/viewspace-2132271/
,如需转载,请注明出处,否则将追究法律责任。