1. 개요

OPatch 기본 사용 명령어 정리



2. OPatch

2.1 OPatch Upgrade

현재 Version 확인

1
2
3
4
5
ORACLE_HOME=/sw/weblogic/14c
${ORACLE_HOME}/OPatch/opatch version
OPatch Version: 13.9.4.2.3

OPatch succeeded.

작성일 기준 최신 Patch(13.9.4.2.11) File 준비

1
2
$ ls ${ORACLE_HOME}/OPatch/patches
6880880  p28186730_1394211_Generic.zip

반드시 6880880/README.txt 준수하여 작업.

Run Patch

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Same JDK of WebLogic
JAVA_HOME=/sw/jdk/jdk1.8.0_351

# tmpdir
TMP=${ORACLE_HOME}/tmpdir_$(date "+%Y%m%d_%H%M%S")
mkdir ${TMP}

# Patch file or directory
PATCH=${ORACLE_HOME}/OPatch/patches/6880880/opatch_generic.jar

${JAVA_HOME}/bin/java -Djava.io.tmpdir=${ORACLE_HOME}/${TMP} -jar ${PATCH} -silent oracle_home=${ORACLE_HOME} -invPtrLoc ${ORACLE_HOME}/oraInst.loc

Launcher log file is /sw/weblogic/14c/sw/weblogic/14c/tmpdir_20230316_102048/OraInstall2023-03-16_10-20-48AM/launcher2023-03-16_10-20-48AM.log.
Extracting the installer . . . . Done
Checking if CPU speed is above 300 MHz.   Actual 2089.010 MHz    Passed
Checking swap space: must be greater than 512 MB.   Actual 16383 MB    Passed
Checking if this platform requires a 64-bit JVM.   Actual 64    Passed (-d64 flag is not required)
Checking temp space: must be greater than 300 MB.   Actual 343361 MB    Passed
Preparing to launch the Oracle Universal Installer from /sw/weblogic/14c/sw/weblogic/14c/tmpdir_20230316_102048/OraInstall2023-03-16_10-20-48AM
Installation Summary


Disk Space : Required 43 MB, Available 343,311 MB
Feature Sets to Install:
        Next Generation Install Core 13.9.4.0.1
        OPatch 13.9.4.2.11
        OPatch Auto OPlan 13.9.4.2.11
Session log file is /sw/weblogic/14c/sw/weblogic/14c/tmpdir_20230316_102048/OraInstall2023-03-16_10-20-48AM/install2023-03-16_10-20-48AM.log

...

The install operation completed successfully.

Logs successfully copied to /sw/weblogic/inventories/14c/logs.

Patched version 확인

1
2
3
4
5
ORACLE_HOME=/sw/weblogic/14c
${ORACLE_HOME}/OPatch/opatch version
OPatch Version: 13.9.4.2.11

OPatch succeeded.


2.2 OPatch lsinventory

적용된 Patch 확인

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
${ORACLE_HOME}/OPatch/opatch lsinventory -jre ${JAVA_HOME}/jre -oh ${ORACLE_HOME} -invPtrLoc ${ORACLE_HOME}/oraInst.loc

Oracle Interim Patch Installer version 13.9.4.2.11
Copyright (c) 2023, Oracle Corporation.  All rights reserved.


Oracle Home       : /sw/weblogic/14c
Central Inventory : /sw/weblogic/inventories/14c
   from           : /sw/weblogic/14c/oraInst.loc
OPatch version    : 13.9.4.2.11
OUI version       : 13.9.4.0.0
Log file location : /sw/weblogic/14c/cfgtoollogs/opatch/opatch2023-03-16_10-26-36AM_1.log


OPatch detects the Middleware Home as "/sw/weblogic/14c"

Lsinventory Output file location : /sw/weblogic/14c/cfgtoollogs/opatch/lsinv/lsinventory2023-03-16_10-26-36AM.txt

--------------------------------------------------------------------------------
Local Machine Information::
Hostname: wls.local
ARU platform id: 226
ARU platform description:: Linux x86-64


There are no Interim patches installed in this Oracle Home.


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

OPatch succeeded.


2.3 OPatch apply

Patch 적용

작성일 기준 WebLogic 14c 최신(14.1.1.0.221213) PSU

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Same JDK of WebLogic
JAVA_HOME=/sw/jdk/jdk1.8.0_351

# tmpdir
TMP=${ORACLE_HOME}/tmpdir_$(date "+%Y%m%d_%H%M%S")
mkdir ${TMP}

# Patch file or directory
PATCH=${ORACLE_HOME}/OPatch/patches/34890864

${ORACLE_HOME}/OPatch/opatch apply ${PATCH} -jre ${JAVA_HOME}/jre -oh ${ORACLE_HOME} -invPtrLoc ${ORACLE_HOME}/oraInst.loc

Oracle Interim Patch Installer version 13.9.4.2.11
Copyright (c) 2023, Oracle Corporation.  All rights reserved.


Oracle Home       : /sw/weblogic/14c
Central Inventory : /sw/weblogic/inventories/14c
   from           : /sw/weblogic/14c/oraInst.loc
OPatch version    : 13.9.4.2.11
OUI version       : 13.9.4.0.0
Log file location : /sw/weblogic/14c/cfgtoollogs/opatch/opatch2023-03-16_10-38-48AM_1.log


OPatch detects the Middleware Home as "/sw/weblogic/14c"

Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   34890864

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 = '/sw/weblogic/14c')


Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '34890864' to OH '/sw/weblogic/14c'

...

Patch 34890864 successfully applied.
Log file location: /sw/weblogic/14c/cfgtoollogs/opatch/opatch2023-03-16_10-38-48AM_1.log

OPatch succeeded.


2.4 OPatch rollback

Patch 제거

제거를 위해서는 ${ORACLE_HOME}/.patch_storage 가 반드시 있어야 한다.

누적 적용된 모든 Patch 정보가 해당 Directory에 있기 때문이다.

해당 Dir이 누실되거나 손상되어 대체 할 방법(Backup)이 없으면 제품 재설치 외에는 방법이 없다.


1
2
3
4
5
6
7
8
9
10
11
# Same JDK of WebLogic
JAVA_HOME=/sw/jdk/jdk1.8.0_351

# tmpdir
TMP=${ORACLE_HOME}/tmpdir_$(date "+%Y%m%d_%H%M%S")
mkdir ${TMP}

# Patch ID that will be rollbacked
ID=34890864

${ORACLE_HOME}/OPatch/opatch rollback -id ${ID} -jre ${JAVA_HOME}/jre -oh ${ORACLE_HOME} -invPtrLoc ${ORACLE_HOME}/oraInst.loc


3. Trouble Shootings

3.1 .patch_storage

.patch_storage는 OPatch의 rollback을 가능케 해주는 매우 중요한 Directory 이므로, 유실/손상되어서는 안된다.

해당 Directory가 잘 Backup 되어 있지 않아, 그렇게 된 경우 제품 재설치 외에는 방법이 없다.


rollback 시도하지만, .patch_storage에서 정보를 찾을 수 없는 경우.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
${ORACLE_HOME}/OPatch/opatch rollback -id ${ID} -jre ${JAVA_HOME}/jre -oh ${ORACLE_HOME} -invPtrLoc ${ORACLE_HOME}/oraInst.loc
Oracle Interim Patch Installer version 13.9.4.2.11
Copyright (c) 2023, Oracle Corporation.  All rights reserved.


Oracle Home       : /sw/weblogic/14c
Central Inventory : /sw/weblogic/inventories/14c
   from           : /sw/weblogic/14c/oraInst.loc
OPatch version    : 13.9.4.2.11
OUI version       : 13.9.4.0.0
Log file location : /sw/weblogic/14c/cfgtoollogs/opatch/opatch2023-03-16_11-02-40AM_1.log


OPatch detects the Middleware Home as "/sw/weblogic/14c"


Patches will be rolled back in the following order:
   34890864
Prerequisite check "CheckRollbackable" failed.
Possible causes are:
 The patch can not be rolled back
 No read or write permission to ORACLE_HOME/.patch _storage
 The ORACLE_HOME/.patch_storage file may have been removed.
The details are:

Patch 34890864:
Copy Action: Directory "/sw/weblogic/14c/.patch_storage/34890864_Dec_13_2022_11_52_01" does not exists or is not readable.
'oracle.wls.core.app.server, 14.1.1.0.0': Cannot copy file from 'compDef.xml' to '/sw/weblogic/14c/inventory/Components/oracle.wls.core.app.server/14.1.1.0.0/patches/25040883/compDef.xml'
Delete Action: Directory "/sw/weblogic/14c/.patch_storage/34890864_Dec_13_2022_11_52_01" does not exists or is not readable.
'oracle.wls.core.app.server, 14.1.1.0.0': Cannot copy file from 'trusted.crt' to '/sw/weblogic/14c/wlserver/server/lib/trusted.crt'
Delete Action: Directory "/sw/weblogic/14c/.patch_storage/34890864_Dec_13_2022_11_52_01" does not exists or is not readable.
'oracle.wls.core.app.server, 14.1.1.0.0': Cannot copy file from 'CertGenInteropCAKey.der' to '/sw/weblogic/14c/wlserver/server/lib/CertGenInteropCAKey.der'

...

UtilSession failed: Prerequisite check "CheckRollbackable" failed.
Log file location: /sw/weblogic/14c/cfgtoollogs/opatch/opatch2023-03-16_11-02-40AM_1.log

OPatch failed with error code 73


3.2 Inventory failed

-invPtrLoc 로 제공하는 Inventory가 유실/손상된 경우 재생성

1
2
3
4
5
6
7
8
# Same JDK of WebLogic
JAVA_HOME=/sw/jdk/jdk1.8.0_351

# tmpdir
TMP=${ORACLE_HOME}/tmpdir_$(date "+%Y%m%d_%H%M%S")
mkdir ${TMP}

${ORACLE_HOME}/oui/bin/attachHome.sh -invPtrLoc ${ORACLE_HOME}/oraInst.loc


4. References

Primary Note For OPatch (Doc ID 293369.1)

Using OUI NextGen OPatch 13 for Oracle Fusion Middleware 12c / WLS 14.1.1 (Doc ID 1587524.1)

Can You Delete $ORACLE_HOME/.patch_storage Directory ? (Doc ID 403218.1)

opatch fails with Error: ‘Archive Action: Source file “$ORACLE_HOME/.patch_storage/…” does not exist.’ or ‘Achive Action: Directory “$ORACLE_HOME/.patch_storage/…” does not exists or is not readable’. (Doc ID 1244414.1)