Thứ Hai, 25 tháng 5, 2026

Runbook step-by-step patch OJVM 19.31

Dưới đây là runbook step-by-step patch OJVM 19.31 (patch p38194382_190000_Linux-x86-64) theo kiểu thực chiến. Em viết 2 luồng:

  • Luồng A (chuẩn nhất): DB RU đã ở 19.31 → patch OJVM 19.31

  • Luồng B: DB đang 19.23 (như anh nói) → khuyến nghị bắt buộc nâng DB RU lên 19.31 trước, rồi mới OJVM 19.31 (để tránh lệch level).

 

A. RUNBOOK OJVM 19.31 (khi DB RU đã là 19.31)

0) Chuẩn bị

0.1 Xác định đúng ORACLE_HOME (DB Home)

 

su - oracle

echo $ORACLE_HOME

$ORACLE_HOME/OPatch/opatch version

0.2 Giải nén patch

Ví dụ:

 

mkdir -p /u01/setup

cd /u01/setup

unzip 19.31_OJVM_p38906621_190000_Linux-x86-64.zip

# sẽ ra thư mục: 38906621/

0.3 Precheck: inventory + hiện trạng SQL patch

 

$ORACLE_HOME/OPatch/opatch lspatches

Trong SQL:

 

sqlplus / as sysdba

set lines 200 pages 200

select * from v$version where rownum<=20;

select description, action, status, to_char(action_time,'yyyy-mm-dd hh24:mi:ss') action_time

from dba_registry_sqlpatch

order by action_time;

 

BANNER

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

BANNER_FULL

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

BANNER_LEGACY                                                                        CON_ID

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

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.31.0.0.0

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production                0

 

 

SQL>   2    3 

 

DESCRIPTION                                                                                          ACTION      STATUS                ACTION_TIME

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

Database Release Update : 19.30.0.0.260120(REL-JAN260130) (38632161)                             APPLY       SUCCESS               2026-05-21 20:39:09

OJVM RELEASE UPDATE: 19.31.0.0.251021 (38194382)                                                     APPLY       SUCCESS               2026-05-21 21:02:02

Database Release Update : 19.31.0.0.260421 (39034528)                                                APPLY       SUCCESS               2026-05-25 15:52:12

 

 

1) Check conflict trước khi apply (rất nên làm)

 

cd /setup/38906621

$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./

  • Nếu báo conflict: thường do OPatch cũ hoặc thiếu RU nền / thiếu patch prerequisite → phải xử lý trước khi apply.

 

[oracle@vietdb01 38906621]$ cd /setup/38906621

[oracle@vietdb01 38906621]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./

 

Oracle Interim Patch Installer version 12.2.0.1.51

Copyright (c) 2026, Oracle Corporation.  All rights reserved.

 

PREREQ session

 

Oracle Home   : /u01/app/oracle/product/19c/dbhome_1

Central Inventory : /u01/app/oraInventory

   from       : /u01/app/oracle/product/19c/dbhome_1/oraInst.loc

OPatch version : 12.2.0.1.51

OUI version   : 12.2.0.7.0

Log file location : /u01/app/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2026-05-25_16-15-44PM_1.log

 

Invoking prereq "checkconflictagainstohwithdetail"

 

Prereq "checkConflictAgainstOHWithDetail" passed.

 

OPatch succeeded.

 

 

2) Dừng dịch vụ để tránh lỗi “CheckActiveFilesAndExecutables”

2.1 Single instance

 

lsnrctl stop

 

sqlplus / as sysdba

shutdown immediate;

exit

2.2 RAC (patch DB home trên từng node / hoặc dùng opatchauto)

Trên node đang patch:

  • stop instance trên node đó (khuyến nghị dùng srvctl):

 

srvctl stop instance -d <db_unique_name> -i <instance_name>

  • dừng listener nếu listener chạy từ DB home:

 

srvctl stop listener

# hoặc lsnrctl stop (nếu quản lý tay)

Nếu trước đó anh hay bị lỗi libclntsh “in-use”, kiểm tra:

 

lsof $ORACLE_HOME/lib/libclntsh.so.19.1

Phải không còn output.

 

3) Apply OJVM 19.31 (binary)

 

cd /setup/38906621

$ORACLE_HOME/OPatch/opatch apply

[oracle@vietdb01 38906621]$ $ORACLE_HOME/OPatch/opatch apply

Oracle Interim Patch Installer version 12.2.0.1.51

Copyright (c) 2026, Oracle Corporation.  All rights reserved.

 

 

Oracle Home   : /u01/app/oracle/product/19c/dbhome_1

Central Inventory : /u01/app/oraInventory

   from       : /u01/app/oracle/product/19c/dbhome_1/oraInst.loc

OPatch version : 12.2.0.1.51

OUI version   : 12.2.0.7.0

Log file location : /u01/app/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2026-05-25_16-20-00PM_1.log

 

Verifying environment and performing prerequisite checks...

OPatch continues with these patches:   38906621 

 

Do you want to proceed? [y|n]

y

User Responded with: Y

All checks passed.

 

Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.

(Oracle Home = '/u01/app/oracle/product/19c/dbhome_1')

 

 

Is the local system ready for patching? [y|n]

y

User Responded with: Y

Backing up files...

Applying interim patch '38906621' to OH '/u01/app/oracle/product/19c/dbhome_1'

 

Patching component oracle.javavm.server, 19.0.0.0.0...

 

Patching component oracle.javavm.server.core, 19.0.0.0.0...

 

Patching component oracle.rdbms.dbscripts, 19.0.0.0.0...

 

Patching component oracle.rdbms, 19.0.0.0.0...

 

Patching component oracle.javavm.client, 19.0.0.0.0...

Patch 38906621 successfully applied.

Sub-set patch [38194382] has become inactive due to the application of a super-set patch [38906621].

Please refer to Doc ID 2161861.1 for any possible further required actions.

Log file location: /u01/app/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2026-05-25_16-20-00PM_1.log

 

OPatch succeeded.

Verify:

$ORACLE_HOME/OPatch/opatch lspatches | egrep -i "38906621|OJVM"

38906621;OJVM RELEASE UPDATE: 19.31.0.0.260421 (38906621)

 

4) Start DB lên lại

Single:

 

lsnrctl start

sqlplus / as sysdba

startup;

exit

 

RAC:

srvctl start instance -d <db_unique_name> -i <instance_name>

# sau khi patch xong toàn bộ node thì start listener/service lại đầy đủ

 

5) Chạy datapatch (bắt buộc để update DBA_REGISTRY_SQLPATCH)

Chỉ cần chạy 1 lần trên 1 node (thường chạy trên node đang là PRIMARY instance):

 

su - oracle

cd $ORACLE_HOME/OPatch

$ORACLE_HOME/OPatch/datapatch -verbose

[oracle@vietdb01 38906621]$ $ORACLE_HOME/OPatch/datapatch -verbose

SQL Patching tool version 19.31.0.0.0 Production on Mon May 25 16:25:53 2026

Copyright (c) 2012, 2026, Oracle.  All rights reserved.

 

Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_420425_2026_05_25_16_25_53/sqlpatch_invocation.log

 

Connecting to database...OK

Gathering database info...done

Bootstrapping registry and package to current versions...done

Determining current state...done

 

Current state of interim SQL patches:

Interim patch 38194382 (OJVM RELEASE UPDATE: 19.31.0.0.251021 (38194382)):

  Binary registry: Not installed

  SQL registry: Applied successfully on 21-MAY-26 09.02.02.207089 PM

Interim patch 38906621 (OJVM RELEASE UPDATE: 19.31.0.0.260421 (38906621)):

  Binary registry: Installed

  SQL registry: Not installed

 

Current state of release update SQL patches:

  Binary registry:

19.31.0.0.0 Release_Update 260426152757: Installed

  SQL registry:

Applied 19.31.0.0.0 Release_Update 260426152757 successfully on 25-MAY-26 03.52.12.848905 PM

 

Adding patches to installation queue and performing prereq checks...done

Installation queue:

  The following interim patches will be rolled back:

38194382 (OJVM RELEASE UPDATE: 19.31.0.0.251021 (38194382))

  No release update patches need to be installed

  The following interim patches will be applied:

38906621 (OJVM RELEASE UPDATE: 19.31.0.0.260421 (38906621))

 

Installing patches...

Patch installation complete.  Total patches installed: 2

 

Validating logfiles...done

Patch 38194382 rollback: SUCCESS

  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/38194382/27894333/38194382_rollback_APIDLDC_2026May25_16_26_29.log (no errors)

Patch 38906621 apply: SUCCESS

  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/38906621/28588735/38906621_apply_APIDLDC_2026May25_16_27_29.log (no errors)

SQL Patching tool complete on Mon May 25 16:27:51 2026

Xem log:

ls -ltr $ORACLE_BASE/cfgtoollogs/sqlpatch | tail -50

 

[oracle@vietdb01 38906621]$ ls -ltr $ORACLE_BASE/cfgtoollogs/sqlpatch | tail -50

total 40

drwxrwxr-x. 2 oracle oinstall 4096 May 21 16:57 sqlpatch_15700_2026_05_21_16_57_08

drwxrwxr-x. 2 oracle oinstall 4096 May 21 16:58 sqlpatch_16245_2026_05_21_16_57_56

drwxrwxr-x. 2 oracle oinstall 4096 May 21 20:21 sanity_checks_20260521_202107_26478

-rwxrwxr-x. 1 oracle oinstall 0 May 21 20:22 38632161_28482211.lock

drwxrwxr-x. 3 oracle oinstall   22 May 21 20:22 38632161

drwxrwxr-x. 2 oracle oinstall 4096 May 21 20:39 sqlpatch_26549_2026_05_21_20_21_30

-rwxrwxr-x. 1 oracle oinstall 0 May 21 21:00 38194382_27894333.lock

drwxrwxr-x. 3 oracle oinstall   22 May 21 21:00 38194382

drwxrwxr-x. 2 oracle oinstall 4096 May 21 21:02 sqlpatch_32390_2026_05_21_21_00_28

drwxr-xr-x. 2 oracle oinstall 4096 May 25 15:49 sanity_checks_20260525_154916_417722

-rw-r--r--. 1 oracle oinstall 0 May 25 15:50 39034528_28700584.lock

drwxr-xr-x. 3 oracle oinstall   22 May 25 15:50 39034528

drwxr-xr-x. 2 oracle oinstall 4096 May 25 15:52 sqlpatch_417787_2026_05_25_15_50_08

drwxr-xr-x. 2 oracle oinstall 4096 May 25 15:56 sqlpatch_418350_2026_05_25_15_55_29

-rwxrwxr-x. 1 oracle oinstall  780 May 25 16:25 sqlpatch_history.txt

-rw-r--r--. 1 oracle oinstall 0 May 25 16:26 38906621_28588735.lock

drwxr-xr-x. 3 oracle oinstall   22 May 25 16:26 38906621

drwxr-xr-x. 2 oracle oinstall 4096 May 25 16:27 sqlpatch_420425_2026_05_25_16_25_53


Verify trong SQL:

sqlplus / as sysdba

 

set lines 200 pages 200

select description, action, status, to_char(action_time,'yyyy-mm-dd hh24:mi:ss') action_time

from dba_registry_sqlpatch

order by action_time;

 

DESCRIPTION                                                                                          ACTION      STATUS                ACTION_TIME

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

Database Release Update : 19.30.0.0.260120(REL-JAN260130) (38632161)                             APPLY       SUCCESS               2026-05-21 20:39:09

OJVM RELEASE UPDATE: 19.31.0.0.251021 (38194382)                                                     APPLY       SUCCESS               2026-05-21 21:02:02

Database Release Update : 19.31.0.0.260421 (39034528)                                                APPLY       SUCCESS               2026-05-25 15:52:12

OJVM RELEASE UPDATE: 19.31.0.0.251021 (38194382)                                                     ROLLBACK    SUCCESS               2026-05-25 16:27:29

OJVM RELEASE UPDATE: 19.31.0.0.260421 (38906621)                                                     APPLY       SUCCESS               2026-05-25 16:27:51

 

 

-- kiểm nhanh còn cái nào không SUCCESS:

select description, status

from dba_registry_sqlpatch

where status <> 'SUCCESS';

 

no rows selected

 

Kỳ vọng: có record liên quan OJVM 19.31 (p38906621) APPLY SUCCESS.

Thc tế: no rows selected

 

6) Post-check nhanh

 

$ORACLE_HOME/OPatch/opatch lsinventory | egrep -i "38906621|OJVM" -n

27:Patch  38906621     : applied on Mon May 25 16:22:49 ICT 2026

29:Patch description:  "OJVM RELEASE UPDATE: 19.31.0.0.260421 (38906621)"

 

Trong DB:

select comp_id, comp_name, version, status from dba_registry;

 

B. DB đang 19.23 nhưng muốn “OJVM 19.31” (khuyến nghị chuẩn)

Không khuyến nghị patch OJVM 19.31 khi DB RU vẫn 19.23, vì rất dễ:

  • conflict,

  • “binary lên nhưng SQL registry không đúng”,

  • hoặc mismatch patch level gây lỗi runtime JVM.

Cách chuẩn:

  1. Nâng DB RU lên 19.31 (DB Release Update)

  2. datapatch

  1. Sau đó mới OJVM 19.31 theo Runbook A.

Nếu anh muốn, em viết luôn runbook “19.23 → 19.31 RU + OJVM 19.31” gộp 1 mạch.

 

C. RAC: có phải làm từng node không? có phải tắt toàn bộ không?

  • Binary patch (OJVM/DB home) trong RAC: phải patch trên tất cả node (đồng bộ ORACLE_HOME).

  • Thường làm rolling node-by-node (không cần tắt cả 4 node) nếu patch hỗ trợ rolling và anh dùng srvctl/opatchauto đúng cách.

  • datapatch: chỉ chạy 1 lần sau khi binary đã đồng bộ (thường khi DB mở và cluster ổn).

 

D. Rollback (khi cần quay lại)

Nếu cần rollback patch OJVM:

cd /u01/setup/patch/38906621

$ORACLE_HOME/OPatch/opatch rollback -id 38906621

 

Sau đó chạy lại datapatch để đồng bộ registry (nếu có SQL component đã apply).

 


ĐỌC NHIỀU

Trần Văn Bình - Oracle Database Master