株式会社コーソル

コーソルDatabaseエンジニアのブログ

技術ブログ

Restart環境でのopatchauto実行例 – (全部俺)某Oracle書籍を25日後に脱稿するXX歳のAdvent Calendar 2021 11日目

Oracle ACEの渡部です。

この記事は(全部俺)某Oracle書籍を25日後に脱稿するXX歳の Advent Calendar 2021の11日目の記事です。10日目の記事はRPMベースのOracle Databaseインストール - (全部俺)某Oracle書籍を25日後に脱稿するXX歳のAdvent Calendar 2021 10日目でした。

つい「カッと」なって(全部俺)某Oracle書籍を25日後に脱稿するXX歳の Advent Calendar 2021を作ってしまいました。

オラクルマスター教科書 Bronze DBA Oracle Database Fundamentalsオラクルマスター教科書 Silver DBA Oracle Database Administration Iに続く「某Oracle書籍」を執筆中のOracle ACE 渡部が、12月25日のドラフト脱稿目指して1日1記事頑張って投稿してゆきたいと思います!

(注意点) 一連の投稿について

  • 「某Oracle書籍」執筆中に実施した下調べの内容や、「某Oracle書籍」のターゲットを超える内容、内容的に関連するセミナー資料の抜粋などを記載する予定です。

  • 2021年12月時点で「某Oracle書籍」の発売時期は未定です。もう少々お待ちを。

  • 万が一、関係者から怒られたら途中でやめるかも(たぶん大丈夫だと思うのだけど)

  • 執筆中の「某Oracle書籍」の記載内容と、一連の投稿の記載内容は異なります

    • そもそも、同じ内容を投稿したら「問題」になる!
  • 「某Oracle書籍」の記載と、一連の投稿は品質が全く異なります

    • 「某Oracle書籍」の記載は、十分に推敲を重ねた、図や表を用いた丁寧なものです。一方、一連の投稿はメモ書きの延長のレベルで、概して推敲が不十分で図や表はあまり使っていません。
    • 「某Oracle書籍」の記載は、先頭から読んでいけばスンナリ理解できるように工夫された完結性・完備性が高いものです。一方、一連の投稿は特定の観点やトピックにのみ関連するものです。内容を理解するには前提知識が求められます。

[宣伝] これまでに渡部が執筆した書籍の一覧

2022/3/25 追記

12月中の脱稿には失敗してしまいましたが、その後鋭意執筆を進め、2022年5月27日に「オラクルマスター教科書 Gold DBA Oracle Database Administration II」を販売開始します。詳細は以下をご覧ください。

ORACLE MASTER Gold DBA 2019試験対策本の発売日が決定しました

19c Restartでのopatchauto

opatchautoは、実行ノードのGI/RDBMSに対してパッチを適用するパッチ適用自動化ツールです。 システムパッチ形式のパッチを用いて、異なる製品(GI/RDBMS)にパッチを適用できます。 また、パッチ適用に付随する起動・停止などの処理を自動化するため、手順が非常にシンプルになります。

以下に、Oracle Restart 19.3.0の環境に対して、GI RU 19.12.0をopatchautoで適用した例を示します。

[root@dbsvr1 ~]# opatchauto apply /var/tmp/32895426

OPatchauto session is initiated at Tue Nov 16 12:06:36 2021

System initialization log file is /u01/app/grid/product/19.0.0/grid/cfgtoollogs/opatchautodb/systemconfig2021-11-16_12-06-38PM.log.

Session log file is /u01/app/grid/product/19.0.0/grid/cfgtoollogs/opatchauto/opatchauto2021-11-16_12-06-43PM.log
The id for this session is 1T22

Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/19.0.0/dbhome_1
Patch applicability verified successfully on home /u01/app/oracle/product/19.0.0/dbhome_1

Executing patch validation checks on home /u01/app/oracle/product/19.0.0/dbhome_1
Patch validation checks successfully completed on home /u01/app/oracle/product/19.0.0/dbhome_1

Verifying SQL patch applicability on home /u01/app/oracle/product/19.0.0/dbhome_1
SQL patch applicability verified successfully on home /u01/app/oracle/product/19.0.0/dbhome_1

Executing OPatch prereq operations to verify patch applicability on home /u01/app/grid/product/19.0.0/grid
Patch applicability verified successfully on home /u01/app/grid/product/19.0.0/grid

Executing patch validation checks on home /u01/app/grid/product/19.0.0/grid
Patch validation checks successfully completed on home /u01/app/grid/product/19.0.0/grid

Preparing to bring down database service on home /u01/app/oracle/product/19.0.0/dbhome_1
Successfully prepared home /u01/app/oracle/product/19.0.0/dbhome_1 to bring down database service

Bringing down database service on home /u01/app/oracle/product/19.0.0/dbhome_1
Following database has been stopped and will be restarted later during the session: orcl
Database service successfully brought down on home /u01/app/oracle/product/19.0.0/dbhome_1

Performing prepatch operations on CRS - bringing down CRS service on home /u01/app/grid/product/19.0.0/grid
Prepatch operation log file location: /u01/app/grid/crsdata/dbsvr1/crsconfig/hapatch_2021-11-16_12-08-48AM.log
CRS service brought down successfully on home /u01/app/grid/product/19.0.0/grid

Start applying binary patch on home /u01/app/oracle/product/19.0.0/dbhome_1
Binary patch applied successfully on home /u01/app/oracle/product/19.0.0/dbhome_1

Start applying binary patch on home /u01/app/grid/product/19.0.0/grid
Binary patch applied successfully on home /u01/app/grid/product/19.0.0/grid

Performing postpatch operations on CRS - starting CRS service on home /u01/app/grid/product/19.0.0/grid
Postpatch operation log file location: /u01/app/grid/crsdata/dbsvr1/crsconfig/hapatch_2021-11-16_12-18-18AM.log
CRS service started successfully on home /u01/app/grid/product/19.0.0/grid

Starting database service on home /u01/app/oracle/product/19.0.0/dbhome_1
Database service successfully started on home /u01/app/oracle/product/19.0.0/dbhome_1

Preparing home /u01/app/oracle/product/19.0.0/dbhome_1 after database service restarted
No step execution required.........

Trying to apply SQL patch on home /u01/app/oracle/product/19.0.0/dbhome_1
SQL patch applied successfully on home /u01/app/oracle/product/19.0.0/dbhome_1

OPatchAuto successful.

--------------------------------Summary--------------------------------

Patching is completed successfully. Please find the summary as follows:

Host:dbsvr1
SIDB Home:/u01/app/oracle/product/19.0.0/dbhome_1
Version:19.0.0.0.0
Summary:

==Following patches were SKIPPED:

Patch: /var/tmp/32895426/32915586
Reason: This patch is not applicable to this specified target type - "oracle_database"

Patch: /var/tmp/32895426/32585572
Reason: This patch is not applicable to this specified target type - "oracle_database"

Patch: /var/tmp/32895426/32918050
Reason: This patch is not applicable to this specified target type - "oracle_database"

==Following patches were SUCCESSFULLY applied:

Patch: /var/tmp/32895426/32904851
Log: /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/opatchauto/core/opatch/opatch2021-11-16_12-09-16PM_1.log

Patch: /var/tmp/32895426/32916816
Log: /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/opatchauto/core/opatch/opatch2021-11-16_12-09-16PM_1.log

Host:dbsvr1
SIHA Home:/u01/app/grid/product/19.0.0/grid
Version:19.0.0.0.0
Summary:

==Following patches were SUCCESSFULLY applied:

Patch: /var/tmp/32895426/32585572
Log: /u01/app/grid/product/19.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-11-16_12-13-25PM_1.log

Patch: /var/tmp/32895426/32904851
Log: /u01/app/grid/product/19.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-11-16_12-13-25PM_1.log

Patch: /var/tmp/32895426/32915586
Log: /u01/app/grid/product/19.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-11-16_12-13-25PM_1.log

Patch: /var/tmp/32895426/32916816
Log: /u01/app/grid/product/19.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-11-16_12-13-25PM_1.log

Patch: /var/tmp/32895426/32918050
Log: /u01/app/grid/product/19.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-11-16_12-13-25PM_1.log

OPatchauto session completed at Tue Nov 16 12:26:15 2021
Time taken to complete the session 19 minutes, 39 seconds
[root@dbsvr1 ~]#

パッチ適用結果の確認

GI opatch lsinventory

GIのopatch lsinventory の実行結果から、GIに対して、以下の5つのパッチが適用されていることがわかります。

  • Patch 32918050 : "TOMCAT RELEASE UPDATE 19.0.0.0.0 (32918050)"
  • Patch 32916816 : "OCW RELEASE UPDATE 19.12.0.0.0 (32916816)"
  • Patch 32915586 : "ACFS RELEASE UPDATE 19.12.0.0.0 (32915586)"
  • Patch 32904851 : "Database Release Update : 19.12.0.0.210720 (32904851)"
  • Patch 32585572 : "DBWLM RELEASE UPDATE 19.0.0.0.0 (32585572)"
[grid@dbsvr1 ~]$ $ORACLE_HOME/OPatch/opatch lsinventory
Oracle Interim Patch Installer version 12.2.0.1.28
Copyright (c) 2021, Oracle Corporation.  All rights reserved.

Oracle Home       : /u01/app/grid/product/19.0.0/grid
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/grid/product/19.0.0/grid/oraInst.loc
OPatch version    : 12.2.0.1.28
OUI version       : 12.2.0.7.0
Log file location : /u01/app/grid/product/19.0.0/grid/cfgtoollogs/opatch/opatch2021-11-16_12-28-00PM_1.log

Lsinventory Output file location : /u01/app/grid/product/19.0.0/grid/cfgtoollogs/opatch/lsinv/lsinventory2021-11-16_12-28-00PM.txt
--------------------------------------------------------------------------------
Local Machine Information::
Hostname: dbsvr1.domain
ARU platform id: 226
ARU platform description:: Linux x86-64

Installed Top-level Products (1):

Oracle Grid Infrastructure 19c                                       19.0.0.0.0
There are 1 products installed in this Oracle Home.

Interim patches (5) :

Patch  32918050     : applied on Tue Nov 16 12:18:12 JST 2021
Unique Patch ID:  24245791
Patch description:  "TOMCAT RELEASE UPDATE 19.0.0.0.0 (32918050)"
   Created on 24 May 2021, 02:10:30 hrs PST8PDT
   Bugs fixed:
     29286300, 32625073, 30997459, 32248633, 32107716, 30729044, 31657943
     30009095

Patch  32916816     : applied on Tue Nov 16 12:17:36 JST 2021
Unique Patch ID:  24340736
Patch description:  "OCW RELEASE UPDATE 19.12.0.0.0 (32916816)"
   Created on 19 Jul 2021, 01:56:39 hrs PST8PDT
   Bugs fixed:
     13742922, 17787434, 24611963, 24677421, 24943214, 25736599, 26305045
     26496292, 26615554, 26675491, 26813848, 27092095, 27148384, 27222128

      (略)

     32706601, 32712335, 32718561, 32737389, 32738085, 32794660, 32843834
     32847095, 32847378, 32851426, 32898579, 32928719, 3

Patch  32915586     : applied on Tue Nov 16 12:16:55 JST 2021
Unique Patch ID:  24337590
Patch description:  "ACFS RELEASE UPDATE 19.12.0.0.0 (32915586)"
   Created on 15 Jul 2021, 23:20:33 hrs PST8PDT
   Bugs fixed:
     22162072, 27494830, 27917085, 28064731, 28293236, 28321248, 28375150
     28531803, 28539108, 28553487, 28611527, 28649123, 28687713, 28701011

      (略)

     32494810, 32509265, 32523711, 32540610, 32585935, 32726268, 32888445
     33112882

Patch  32904851     : applied on Tue Nov 16 12:15:22 JST 2021
Unique Patch ID:  24343243
Patch description:  "Database Release Update : 19.12.0.0.210720 (32904851)"
   Created on 20 Jul 2021, 09:21:24 hrs UTC
   Bugs fixed:
     7391838, 8460502, 8476681, 14570574, 14735102, 15931756, 16662822
     16664572, 16750494, 17275499, 17395507, 17428816, 17468475, 17777718

      (略)

     32902635, 32936961, 32941509, 32996071, 33034103, 33048277, 33127032
     32490416

Patch  32585572     : applied on Tue Nov 16 12:13:40 JST 2021
Unique Patch ID:  24103449
Patch description:  "DBWLM RELEASE UPDATE 19.0.0.0.0 (32585572)"
   Created on 29 Mar 2021, 02:20:46 hrs PST8PDT
   Bugs fixed:
     31547458, 31554751, 32153618, 31862202

--------------------------------------------------------------------------------

OPatch succeeded.
[grid@dbsvr1 ~]$

DB opatch lsinventory

DBのopatch lsinventory の実行結果から、Oracle Databaseソフトウェアに対して、以下の2つのパッチが適用されていることがわかります。

  • Patch 32916816 : "OCW RELEASE UPDATE 19.12.0.0.0 (32916816)"
  • Patch 32904851 : "Database Release Update : 19.12.0.0.210720 (32904851)"
[oracle@dbsvr1 ~]$ $ORACLE_HOME/OPatch/opatch lsinventory
Oracle Interim Patch Installerバージョン12.2.0.1.28
Copyright (c) 2021, Oracle Corporation.  All rights reserved。

Oracleホーム       : /u01/app/oracle/product/19.0.0/dbhome_1
中央インベントリ : /u01/app/oraInventory
   元           : /u01/app/oracle/product/19.0.0/dbhome_1/oraInst.loc
OPatchのバージョン    : 12.2.0.1.28
OUIのバージョン       : 12.2.0.7.0
ログ・ファイルの場所 : /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2021-11-16_12-28-44午後_1.log

Lsinventory Output file location : /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2021-11-16_12-28-44午後.txt
--------------------------------------------------------------------------------
Local Machine Information::
Hostname: dbsvr1.domain
ARU platform id: 226
ARU platform description:: Linux x86-64

インストールされた最上位製品(1):

Oracle Database 19c                                                  19.0.0.0.0
このOracleホームには1の製品がインストールされています。

個別パッチ(2) :

Patch  32916816     : applied on Tue Nov 16 12:13:15 JST 2021
Unique Patch ID:  24340736
Patch description:  "OCW RELEASE UPDATE 19.12.0.0.0 (32916816)"
   Created on 19 Jul 2021, 01:56:39 hrs PST8PDT
   Bugs fixed:
     13742922, 17787434, 24611963, 24677421, 24943214, 25736599, 26305045
     26496292, 26615554, 26675491, 26813848, 27092095, 27148384, 27222128
      (略)
     32706601, 32712335, 32718561, 32737389, 32738085, 32794660, 32843834
     32847095, 32847378, 32851426, 32898579, 32928719, 3

Patch  32904851     : applied on Tue Nov 16 12:11:29 JST 2021
Unique Patch ID:  24343243
Patch description:  "Database Release Update : 19.12.0.0.210720 (32904851)"
   Created on 20 Jul 2021, 09:21:24 hrs UTC
   Bugs fixed:
     7391838, 8460502, 8476681, 14570574, 14735102, 15931756, 16662822
     16664572, 16750494, 17275499, 17395507, 17428816, 17468475, 17777718

      (略)

     32818019, 32858446, 32874995, 32881853, 32889434, 32895105, 32900208
     32902635, 32936961, 32941509, 32996071, 33034103, 33048277, 33127032
     32490416

--------------------------------------------------------------------------------

OPatch succeeded.
[oracle@dbsvr1 ~]$

Oracleデータベースへのdatapatch

DBA_REGISTRY_SQLPATCHへの問合せ結果から、Oracleデータベースに対して、以下の2つのdatapatchが適用されていることがわかります。

  • Patch 29517242 : "Database Release Update : 19.3.0.0.190416 (29517242)" ← 以前から適用済み
  • Patch 32904851 : "Database Release Update : 19.12.0.0.210720 (32904851)" ← 今回適用
SQL> SELECT install_id, patch_id, patch_uid, patch_type, action, status, description FROM DBA_REGISTRY_SQLPATCH;

INSTALL_ID   PATCH_ID  PATCH_UID PATCH_TYPE ACTION          STATUS
---------- ---------- ---------- ---------- --------------- -------------------------
DESCRIPTION
----------------------------------------------------------------------------------------------------
         1   29517242   22862832 RU         APPLY           SUCCESS
Database Release Update : 19.3.0.0.190416 (29517242)

         2   32904851   24343243 RU         APPLY           SUCCESS
Database Release Update : 19.12.0.0.210720 (32904851)

SQL>

注意点 各ホームのOPatchが古いとNG

パッチ適用対象となるそれぞでのホームOPatchが古いと、opatchautoを実行できません。

GIホームのOpatchが古い

[root@dbsvr1 ~]# opatchauto apply /var/tmp/32895426

OPatchauto session is initiated at Tue Nov 16 12:00:40 2021

System initialization log file is /u01/app/grid/product/19.0.0/grid/cfgtoollogs/opatchautodb/systemconfig2021-11-16_12-00-43PM.log.

Session log file is /u01/app/grid/product/19.0.0/grid/cfgtoollogs/opatchauto/opatchauto2021-11-16_12-00-47PM.log
The id for this session is T72R

Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/19.0.0/dbhome_1
Patch applicability verification failed on home /u01/app/oracle/product/19.0.0/dbhome_1

Execution of [OPatchAutoBinaryAction] patch action failed, check log for more details. Failures:
Patch Target : dbsvr1->/u01/app/oracle/product/19.0.0/dbhome_1 Type[sidb]
Details: [
---------------------------Patching Failed---------------------------------
Command execution failed during patching in home: /u01/app/oracle/product/19.0.0/dbhome_1, host: dbsvr1.
Command failed:  /u01/app/oracle/product/19.0.0/dbhome_1/OPatch/opatchauto  apply /var/tmp/32895426 -oh /u01/app/oracle/product/19.0.0/dbhome_1 -target_type oracle_database -binary -invPtrLoc /u01/app/grid/product/19.0.0/grid/oraInst.loc -jre /u01/app/grid/product/19.0.0/grid/OPatch/jre -persistresult /u01/app/oracle/product/19.0.0/dbhome_1/OPatch/auto/dbsessioninfo/sessionresult_analyze_dbsvr1_sidb.ser -analyze -online -prepare_home
Command failure output:
==Following patches FAILED in analysis for apply:

Patch: /var/tmp/32895426/32916816
Log: /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/opatchauto/core/opatch/opatch2021-11-16_12-01-02PM_1.log
Reason: Failed during Analysis: CheckMinimumOPatchVersion Failed, [ Prerequisite Status: FAILED, Prerequisite output:
The details are:

The OPatch being used has version 12.2.0.1.17 while the following patch(es) require higher versions:
Patch 32916816 requires OPatch version 12.2.0.1.23.
Patch 32904851 requires OPatch version 12.2.0.1.25.
Please download latest OPatch from My Oracle Support.
]

Patch: /var/tmp/32895426/32904851
Log: /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/opatchauto/core/opatch/opatch2021-11-16_12-01-02PM_1.log
Reason: Failed during Analysis: CheckMinimumOPatchVersion Failed, [ Prerequisite Status: FAILED, Prerequisite output:
The details are:

The OPatch being used has version 12.2.0.1.17 while the following patch(es) require higher versions:
Patch 32916816 requires OPatch version 12.2.0.1.23.
Patch 32904851 requires OPatch version 12.2.0.1.25.
Please download latest OPatch from My Oracle Support.
]

After fixing the cause of failure Run opatchauto resume

]
OPATCHAUTO-68061: The orchestration engine failed.
OPATCHAUTO-68061: The orchestration engine failed with return code 1
OPATCHAUTO-68061: Check the log for more details.
OPatchAuto failed.

OPatchauto session completed at Tue Nov 16 12:01:34 2021
Time taken to complete the session 0 minute, 54 seconds

 opatchauto failed with error code 42
[root@dbsvr1 ~]#

DBホームのOpatchが古い(GIホームのOpatchとDBホームのOpatchのバージョンが異なる)

[root@dbsvr1 ~]# opatchauto apply /var/tmp/32895426

OPatchauto session is initiated at Tue Nov 16 12:04:29 2021

System initialization log file is /u01/app/grid/product/19.0.0/grid/cfgtoollogs/opatchautodb/systemconfig2021-11-16_12-04-31PM.log.

Session log file is /u01/app/grid/product/19.0.0/grid/cfgtoollogs/opatchauto/opatchauto2021-11-16_12-04-35PM.log
The id for this session is 7QXU

Wrong OPatch software installed in following homes:
Host:dbsvr1, Home:/u01/app/oracle/product/19.0.0/dbhome_1

OPATCHAUTO-72088: OPatch version check failed.
OPATCHAUTO-72088: OPatch software version in homes selected for patching are different.←★
OPATCHAUTO-72088: Please install same OPatch software in all homes.←★
OPatchAuto failed.

OPatchauto session completed at Tue Nov 16 12:04:49 2021
Time taken to complete the session 0 minute, 20 seconds

 opatchauto failed with error code 42
[root@dbsvr1 ~]#

2022/3/25 追記

12月中の脱稿には失敗してしまいましたが、その後鋭意執筆を進め、2022年5月27日に「オラクルマスター教科書 Gold DBA Oracle Database Administration II」を販売開始します。詳細は以下をご覧ください。

ORACLE MASTER Gold DBA 2019試験対策本の発売日が決定しました

プロフィール

On7tWW6m1Ul4

渡部 亮太

・Oracle ACE
・AWS Certified Solutions Architect - Associate
・ORACLE MASTER Platinum Oracle Database 11g, 12c 他多数

カテゴリー

アーカイブ