0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

はじめに

ひとつ前の記事で

OracleDB のときは unzip したRUをどこかに置いておく必要がありましたが、これに相当する作業がないのは楽で良いですね。

と書きましたが、どうやら AutoUpgrade にRUの自動DL機能がある模様 :eyes:
AutoUpgrade というと OracleDB のメジャーバージョンアップや移行の際に使用することができるツール、という認識でしたが、2022/7 のリリースでRU適用機能が実装されていたようです。
ということで早速試してみます!(19.3→19.27)

ひとつ前の記事はこちら↓

AutoUpgrade については下記ご参考です。

各種準備

最新の AutoUpgrade の入手

My Oracle Support のドキュメント:AutoUpgrade Tool (ドキュメントID 2485457.1) から autoupgrade.jar をDLします。
なお、本記事作成時点では日本語版ドキュメント:自動アップグレード (AutoUpgrade) ツール (ドキュメントID 2603647.1) のDLリンクは古いもののようなのでご注意ください。
DLしたら$ORACLE_HOME/rdbms/admin/に格納します。(元々格納されているものは削除するなりリネームするなり任意です)

[oracle@59f8353d3910 admin]$ ls -la autoup*
-rw-r--r-- 1 oracle oinstall 3360892 Feb  9  2019 autoupgrade_bk.jar
-rwxr-xr-x 1 oracle oinstall 6530319 Jun 24 17:45 autoupgrade.jar

構成ファイルの作成

AutoUpgrade の実行に必要な各種情報を記載するファイルが構成ファイルです。(.cfg)
AutoUpgrade の機能でサンプルの構成ファイルを生成する方法もありますが、私はviで作成しました。(生成されたサンプルにRU適用で流用できる内容があまりなかったため…)

test.cfg
[oracle@59f8353d3910 ~]$ cat test.cfg
global.global_log_dir=/home/oracle/autoupg_wk/glogdir
global.keystore=/opt/oracle/admin/ORCLCDB/piyo
upg1.sid=ORCLCDB
upg1.source_home=/opt/oracle/product/19c/dbhome_1
upg1.target_home=/opt/oracle/product/19c/dbhome_2
upg1.folder=/home/oracle/autoupg_wk/patches
upg1.download=YES
upg1.restoration=no
[oracle@59f8353d3910 ~]$
(参考) 構成ファイルのサンプル生成
[oracle@59f8353d3910 ~]$ java -jar $ORACLE_HOME/rdbms/admin/autoupgrade.jar -create_sample_file config
Created sample configuration file /home/oracle/sample_config.cfg
[oracle@59f8353d3910 ~]$ head sample_config.cfg
#
# Sample config file for AutoUpgrade
#
# build version 25.3.250509
# build date    2025/05/09 02:53:51 +0000
#
#
# Global configurations
#
# This directory will include the following:
[oracle@59f8353d3910 ~]$

構成ファイル内で指定しているパラメータの一部について簡単に解説すると、

  • global.global_log_dir:AutoUpgrade の各種ログの出力先を指定します
  • global.keystore:後述するキーストアで指定するディレクトリと同じディレクトリを指定します
  • upg1.folder:自動DLしたRUを格納するディレクトリを指定します
  • upg1.download:RUの自動DLを制御します
  • upg1.restoration:RUを適用する前に保証付きリストアポイント (GRP) を作成するか制御します。本来の運用では YES が望ましいと思いますが、今回はRUの自動DLを中心に確認したかったため NO としました。

という感じです。詳細はマニュアルをご確認ください。

キーストアの作成

RUの自動DLを行うにあたり、My Oracle Support資格証明をロードするキーストアが必要なので作成しておきましょう。

ディレクトリの作成
[oracle@59f8353d3910 ~]$ mkdir $ORACLE_BASE/admin/ORCLCDB/piyo
キーストアの作成
SQL> ADMINISTER KEY MANAGEMENT CREATE KEYSTORE '/opt/oracle/admin/ORCLCDB/piyo' IDENTIFIED BY password;

keystore altered.

OracleDB 19c のベースイメージの入手

AutoUpgrade を使用したRU適用は out-of-place patching となります。※
そのため OracleDB 19c のベースイメージが必要です。(一度入手すれば以降使いまわせるのでRUほど面倒ではないものの、ベースイメージもRUのように自動DLできたら良いんですが…)

下記からDLし、構成ファイルのupg1.folderで指定したディレクトリに格納してください。

[oracle@59f8353d3910 ~]$ ls -la autoupg_wk/patches/
total 2988008
drwxr-xr-x 2 oracle oinstall       4096 Jun 24 18:37 .
drwxr-xr-x 4 oracle oinstall       4096 Jun 24 18:35 ..
-rwxr-xr-x 1 oracle oinstall 3059705302 Jun 24 18:38 LINUX.X64_193000_db_home.zip

out-of-place patching については、少し古いですが下記ご参考です。

※構成ファイル内のmethodパラメータで In-place に変更できるかもしれないので、マニュアルで該当の記載が見つけられたら試します

My Oracle Support資格証明のロード

RUの自動DLを行えるように My Oracle Support資格証明をキーストアにロードします。
ウォレットのパスワードが求められるので、前述のキーストア作成時に指定したパスワードを入力するとパスワードコンソール (MOS>) に遷移します。

[oracle@59f8353d3910 ~]$ java -jar $ORACLE_HOME/rdbms/admin/autoupgrade.jar -patch -config test.cfg -load_password
Processing config file ...
Loading AutoUpgrade Patching keystore
Enter wallet password:
AutoUpgrade Patching keystore is loaded

Starting AutoUpgrade Patching Password Loader - Type help for available options

MOS>

遷移後、add -user MOSアカウントのメールアドレスを実行するとMOSアカウントのパスワードを求められるので入力します。
listで資格証明のロードが成功していることを確認しsaveexitします。

MOS>
MOS> add -user narita.yuichiro@jri.co.jp
Enter your secret/Password:
Re-enter your secret/Password:
MOS> list
MOS Credentials Loaded - Connection Successful
MOS> save
Convert the AutoUpgrade Patching keystore to auto-login [YES|NO] ? no
MOS> exit

AutoUpgrade Patching Password Loader finished - Exiting AutoUpgrade Patching
[oracle@59f8353d3910 ~]$

いざ実行!

の前に恒例の状態確認です。
今回は out-of-place patching なので ORACLE_HOME の設定値も表示しています。

[oracle@59f8353d3910 ~]$ echo $ORACLE_HOME/
/opt/oracle/product/19c/dbhome_1/
[oracle@59f8353d3910 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Jun 24 19:32:24 2025
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> select version_full from product_component_version;

VERSION_FULL
--------------------------------------------------------------------------------
19.3.0.0.0

SQL> select status, description from dba_registry_sqlpatch;

STATUS
-------------------------
DESCRIPTION
--------------------------------------------------------------------------------
SUCCESS
Database Release Update : 19.3.0.0.190416 (29517242)


SQL>

19.3であることを確認して実行!(-mode deploy)
RUのDLから始まりました。(デフォルトでは最新のRU, OJVM, DPBP, OPATCH がDLされます)

[oracle@59f8353d3910 ~]$ java -jar $ORACLE_HOME/rdbms/admin/autoupgrade.jar -patch -config test.cfg -mode deploy
AutoUpgrade Patching 25.3.250509 launched with default internal options
Processing config file ...
Loading AutoUpgrade Patching keystore
Enter wallet password:
AutoUpgrade Patching keystore is loaded

Connected to MOS - Searching for specified patches

----------------------------------------------------
Downloading files to /home/oracle/autoupg_wk/patches
----------------------------------------------------
DATABASE RELEASE UPDATE 19.27.0.0.0
    File: p37642901_190000_Linux-x86-64.zip \ 42%

DLが完了すると AutoUpgradeコンソール (patch>) に遷移します。
lsjstatusで状況を確認できます。

----------------------------------------------------
Downloading files to /home/oracle/autoupg_wk/patches
----------------------------------------------------
DATABASE RELEASE UPDATE 19.27.0.0.0
    File: p37642901_190000_Linux-x86-64.zip - VALIDATED

DATAPUMP BUNDLE PATCH 19.27.0.0.0
    File: p37777295_1927000DBRU_Generic.zip - VALIDATED

OJVM RELEASE UPDATE 19.27.0.0.0
    File: p37499406_190000_Linux-x86-64.zip - VALIDATED

OPatch 12.2.0.1.46 for DB 19.0.0.0.0 (Apr 2025)
    File: p6880880_190000_Linux-x86-64.zip - VALIDATED
----------------------------------------------------

+-----------------------------------------+
| Starting AutoUpgrade Patching execution |
+-----------------------------------------+
1 CDB(s) plus 2 PDB(s) will be processed
Type 'help' to list console commands
patch> lsj
+----+-------+---------+---------+-------+----------+-------+----------------------------+
|Job#|DB_NAME|    STAGE|OPERATION| STATUS|START_TIME|UPDATED|                     MESSAGE|
+----+-------+---------+---------+-------+----------+-------+----------------------------+
| 100|ORCLCDB|PRECHECKS|EXECUTING|RUNNING|  19:43:20|50s ago|Loading database information|
+----+-------+---------+---------+-------+----------+-------+----------------------------+
Total jobs 1

patch> status

Config

        User configuration file    [/home/oracle/test.cfg]
        General logs location      [/home/oracle/autoupg_wk/glogdir/cfgtoollogs/patch/auto]
        Mode                       [DEPLOY]
Jobs Summary

        Total databases in configuration file [3]
        Total Non-CDB being processed         [0]
        Total Containers being processed      [3]

        Jobs finished successfully            [0]
        Jobs finished/stopped                 [0]
        Jobs in progress                      [1]

Progress
        +---+---------------------------------------------------------+
        |Job|                                                 Progress|
        +---+---------------------------------------------------------+
        |100|[||||||||                                          ] 14 %|
        +---+---------------------------------------------------------+

patch>
(参考) 60分ほど経過した時点の状況
patch> lsj
+----+-------+-----------+---------+-------+----------+-------+-------------------------------+
|Job#|DB_NAME|      STAGE|OPERATION| STATUS|START_TIME|UPDATED|                        MESSAGE|
+----+-------+-----------+---------+-------+----------+-------+-------------------------------+
| 100|ORCLCDB|DB_PATCHING|EXECUTING|RUNNING|  19:43:20|19s ago|DBUPGRADE - 0%Patching ORCLPDB1|
+----+-------+-----------+---------+-------+----------+-------+-------------------------------+
Total jobs 1

patch> status

Config

        User configuration file    [/home/oracle/test.cfg]
        General logs location      [/home/oracle/autoupg_wk/glogdir/cfgtoollogs/patch/auto]
        Mode                       [DEPLOY]
Jobs Summary

        Total databases in configuration file [3]
        Total Non-CDB being processed         [0]
        Total Containers being processed      [3]

        Jobs finished successfully            [0]
        Jobs finished/stopped                 [0]
        Jobs in progress                      [1]

Progress
        +---+---------------------------------------------------------+
        |Job|                                                 Progress|
        +---+---------------------------------------------------------+
        |100|[||||||||||||||||||||||||||||||||||||              ] 71 %|
        +---+---------------------------------------------------------+

patch>

70分ほど経過してジョブ完了が通知されました。
root.shを実行するよう指示がありますが、その前に summary report を見てみます。

patch> Job 100 completed
------------------- Final Summary --------------------
Number of databases            [ 1 ]

Jobs finished                  [1]
Jobs failed                    [0]
Jobs restored                  [0]
Jobs pending                   [0]

# Run the root.sh script as root for the following jobs:
For ORCLCDB -> /opt/oracle/product/19c/dbhome_2/root.sh



Please check the summary report at:
/home/oracle/autoupg_wk/glogdir/cfgtoollogs/patch/auto/status/status.html
/home/oracle/autoupg_wk/glogdir/cfgtoollogs/patch/auto/status/status.log
[oracle@59f8353d3910 ~]$

summary report では各ステージのステータスや開始時刻、所要時間が確認できます。
POSTCHECKSステージの詳細レポートを見てみます。
image.png

CDB\$ROOT, PDB\$SEED, ORCLPDB1 のそれぞれで Recommend が表示されています。
いずれもディクショナリ統計を収集してね~というものでした。可能な限り実施しましょう。
(PDB$SEED のディクショナリ統計収集なんてできるんだ…:thinking:)
image.png

話を戻して、rootでroot.shを実行します。

[root@59f8353d3910 ~]# /opt/oracle/product/19c/dbhome_2/root.sh
Check /opt/oracle/product/19c/dbhome_2/install/root_59f8353d3910_2025-06-25_10-16-44-196252339.log for the output of root script

dbhome_1 から dbhome_2 に切り替えます。

[oracle@59f8353d3910 ~]$ echo $ORACLE_HOME/
/opt/oracle/product/19c/dbhome_1/
[oracle@59f8353d3910 ~]$
[oracle@59f8353d3910 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jun 25 10:23:06 2025
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Connected to an idle instance.

SQL>
SQL> exit
Disconnected
[oracle@59f8353d3910 ~]$
[oracle@59f8353d3910 ~]$
[oracle@59f8353d3910 ~]$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs
export ORACLE_SID=ORCLCDB
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19c/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin

[oracle@59f8353d3910 ~]$
[oracle@59f8353d3910 ~]$
[oracle@59f8353d3910 ~]$ vi .bash_profile
[oracle@59f8353d3910 ~]$
[oracle@59f8353d3910 ~]$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs
export ORACLE_SID=ORCLCDB
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19c/dbhome_2
export PATH=$PATH:$ORACLE_HOME/bin

[oracle@59f8353d3910 ~]$
[oracle@59f8353d3910 ~]$
[oracle@59f8353d3910 ~]$ echo $ORACLE_HOME/
/opt/oracle/product/19c/dbhome_1/
[oracle@59f8353d3910 ~]$
[oracle@59f8353d3910 ~]$
[oracle@59f8353d3910 ~]$ source ~/.bash_profile
[oracle@59f8353d3910 ~]$
[oracle@59f8353d3910 ~]$ echo $ORACLE_HOME/
/opt/oracle/product/19c/dbhome_2/
[oracle@59f8353d3910 ~]$
[oracle@59f8353d3910 ~]$

切り替えられたので、状態確認です。

[oracle@59f8353d3910 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jun 25 10:33:32 2025
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.27.0.0.0

SQL> set pages 50000
SQL> select version_full from product_component_version;

VERSION_FULL
--------------------------------------------------------------------------------
19.27.0.0.0

SQL>
SQL>
SQL> select status, description from dba_registry_sqlpatch;

STATUS
-------------------------
DESCRIPTION
--------------------------------------------------------------------------------
SUCCESS
Database Release Update : 19.3.0.0.190416 (29517242)

WITH ERRORS (PREV PATCH)
OJVM RELEASE UPDATE: 19.27.0.0.250415 (37499406)

WITH ERRORS
Database Release Update : 19.27.0.0.250415 (37642901)

WITH ERRORS (PREV PATCH)
DATAPUMP BUNDLE PATCH 19.27.0.0.0

SUCCESS
OJVM RELEASE UPDATE: 19.27.0.0.250415 (37499406)

SUCCESS
Database Release Update : 19.27.0.0.250415 (37642901)

SUCCESS
DATAPUMP BUNDLE PATCH 19.27.0.0.0


7 rows selected.

SQL>

19.27になっていることを確認できました!

所見

  • RU都度DLの作業負荷が高い場合は AutoUpgrade を使って自動DLが可能
  • 自動DLには MOS (My Oracle Suppor) 接続が必要なため、ネットワーク構成は要検討
  • 今のところ out-of-place patching のみ対応してるようなので、バイナリファイルを複数インストールできるディスクの余裕が必要
  • ORACLE HOMEの切り替えに対応できるよう、APの接続構成は要チェック&見直し
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?