代码改变世界

源端为备库的场景下Duplicate失败问题

2023-05-22 15:48  AlfredZhao  阅读(175)  评论(0编辑  收藏  举报

环境:
Oracle 11.2.0.3 + OEL 7.9
A -> B -> C 级联ADG环境:db11g -> db11gadg -> db11gcas

之前测试提到,从一级备库duplicate到二级备库会报错:

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 05/14/2023 23:54:15
RMAN-05501: aborting duplication of target database
RMAN-05531: a mounted database cannot be duplicated while datafiles are fuzzy

客户确认是从一级备库duplicate到二级备库OK,查询文档:

  • RMAN Duplicate From Active Database Fails when Source Database is Standby and Patch 11715084 Applied (Doc ID 1522062.1)

原来又是一个bug,好在有已发布的补丁修复此问题。
为了避免更多杂七杂八的bug,我决定应用11.2.0.3版本最后的PSU(Patch Set Update);

根据MOS文档:

  • Assistant: Download Reference for Oracle Database/GI Update, Revision, PSU, SPU(CPU), Bundle Patches, Patchsets and Base Releases (Doc ID 2118136.2)

定位到 11.2.0.3最后一个PSU是:p20996944_112030_Linux-x86-64.zip

这个是包含了GI和DB的补丁,我这里单实例就只需要应用其中DB的,应用每一个补丁的具体步骤都是去参见对应的readme文件:README.html。

  • Patch 20996944 - Oracle Grid Infrastructure Patch Set Update 11.2.0.3.15 (Jul2015) (Includes Database PSU)

这里想多聊下关于readme,但凡是有经验的DBA,都知道打补丁要看对应的readme,而不是直接上去就操作,虽然打补丁流程类似,但也会有个别补丁之间存在差异,按readme指引操作才是最靠谱的。

This document is accurate at the time of release. For any changes and additional information regarding PSU 11.2.0.3.15, see these related documents that are available at My Oracle Support (http://support.oracle.com/):

Document 854428.1 Patch Set Updates for Oracle Products

Document 2006070.1 Oracle Grid Infrastructure Patch Set Update 11.2.0.3.15 Known Issues

This document includes the following sections:

Section 1, "Patch Information"

Section 2, "Patch Installation and Deinstallation"

Section 3, "Known Issues"

Section 4, "References"

Section 5, "Manual Steps for Apply/Rollback Patch"

Section 6, "Bugs Fixed by This Patch"

Section 7, "Documentation Accessibility"

我们需要下载OPatch Utility,通过 6880880 搜索:

  • You must use the OPatch utility version 11.2.0.3.5 or later to apply this patch.

题外话,这里的utility啥意思?
我们知道utility software通常是指最基础的系统工具软件,而Opatch 这种软件用于打各种版本的PSU补丁,所以称之为Opatch utility就容易理解了。
另外值得一提的是,像SUV这种耳熟能详的汽车车型,其中的U也是Utility这个词哦(Sport Utility Vehicle),这样是不是一下子就记住了呢~

  • The OPatch utility will prompt for your OCM (Oracle Configuration Manager) response file when it is run.
    OCM response file is required and is not optional.

这个ocm响应文件在这个版本下是必须的,在新版本就不需要,这些注意事项实际上都需要readme来确认。

在readme中针对比如手工应用等章节是指向到具体的MOS文档进一步说明:

  • Readme - Patch Installation and Deinstallation For 11.2.0.3.x GI PSU (Doc ID 1494646.1)

说这些只是为了让大家在应用补丁时仔细去看对应的readme说明,目前我这实验环境是单实例,手工应用补丁即可,使用最简单的opatch apply。

嗯,在应用之前,再去duplicate尝试下,确定目前是有问题的。
将级联备库db11gcas对应的实例启动到nomount状态;然后执行脚本报错:

sh dup_dg.sh 
...
RMAN-05531: a mounted database cannot be duplicated while datafiles are fuzzy

在db11gadg备库先应用PSU补丁,更新OPatch Utility版本然后应用补丁:

[oracle@db11gadg media]$ $ORACLE_HOME/OPatch/opatch version
Invoking OPatch 11.2.0.1.7

OPatch Version: 11.2.0.1.7

OPatch succeeded.

需要更新OPatch Utility,下载最新的11.2.0.3.41 尝试?
记得太新的其实未必兼容,另外目前连接实验环境没有多少流量可用传输。
所以从实验环境的本地网盘上搜到,p6880880_112000_Linux-x86-64_11.2.0.3.12.zip。
也符合要求。

安装此版本更新后再次查询符合要求:

[oracle@db11gadg dbhome_1]$ pwd
/u01/app/oracle/product/11.2.0/dbhome_1
[oracle@db11gadg dbhome_1]$ unzip /u01/media/p6880880_112000_Linux-x86-64_11.2.0.3.12.zip
[oracle@db11gadg dbhome_1]$ $ORACLE_HOME/OPatch/opatch version
OPatch Version: 11.2.0.3.12

OPatch succeeded.

解压补丁,应用DB补丁:
建立一个空文件夹,解压:

[oracle@db11gadg media]$ mkdir tmp
[oracle@db11gadg media]$ unzip p20996944_112030_Linux-x86-64.zip -d ./tmp/

[oracle@db11gadg tmp]$ pwd
/u01/media/tmp
[oracle@db11gadg tmp]$ ls -lrth
total 220K
-rw-r--r--  1 oracle oinstall   21 Jan  9  2014 README.txt
-rw-r--r--  1 oracle oinstall    0 Jan  9  2014 atp_lfp
drwxr-xr-x  5 oracle oinstall   44 Jan  9  2014 17592127
drwxrwxr-x 17 oracle oinstall 4.0K Jun  9  2015 20760997
-rw-r--r--  1 oracle oinstall  450 Jun  9  2015 bundle.xml
-rw-rw-r--  1 oracle oinstall  63K Jul 14  2015 README.html
-rw-rw-r--  1 oracle oinstall 143K Jul 14  2015 PatchSearch.xml

关闭数据库,监听,应用补丁;

SQL> shutdown immediate
[oracle@db11gadg 20760997]$ lsnrctl stop

[oracle@db11gadg 20760997]$ $ORACLE_HOME/OPatch/opatch apply

Email address/User Name: <--- 直接回车!
You have not provided an email address for notification of security issues.
Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]:  Y <--- Y表示 希望不了解安全问题,不然就一直让你输入邮箱..

Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/u01/app/oracle/product/11.2.0/dbhome_1')


Is the local system ready for patching? [y|n]
y  <--- y表示本地环境已经准备好应用补丁了!

...
Composite patch 20760997 successfully applied.
OPatch Session completed with warnings.
Log file location: /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2023-05-22_15-17-55PM_1.log

OPatch completed with warnings.

应用完补丁查询:

[oracle@db11gadg 20760997]$ $ORACLE_HOME/OPatch/opatch lsinventory
...
OPatch succeeded.

启动监听和数据库:

$ lsnrctl start
SQL> startup

然后级联备库再次发起duplicate操作,不再报错了哈~

为了统一,接下来计划在主库、级联备库都应用11.2.0.3的PSU补丁。
这里先应用一个备库,就是为了验证这个问题是否能修复。