源端為備庫的場景下Duplicate失敗問題

2023-05-23 06:01:31

環境:
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修補程式。
這裡先應用一個備庫,就是為了驗證這個問題是否能修復。