[Oracle Cloud] Oracle DB のマネージドサービス (Database Cloud Service) に、令和パッチを手動適用してみた

# はじめに

Oracle Cloud Infrastructure(以下OCI)には、Oracle DB のマネージドサービスがいくつかあります。

今までオンプレミスで使ってきた Oracle DB と同じような操作感で扱うことのできる Database Cloud Service や、パフォーマンスチューニングやアップグレードなど様々な自動機能が備わっている Autonomous DB があります。今回は、Database Cloud Service に令和パッチを適用する方法を紹介します。



令和パッチを適用することで、Oracle DB 側で次のような SQL を実行したときに、令和XX年と表示されます。

```
SELECT to_char(sysdate,'EEYY"年"mm"月"dd"日"','nls_calendar = ''Japanese Imperial''') FROM DUAL;
```

![1580170216059.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/104247/3c151e53-b06b-fa0b-12bd-35bb4c7d5a20.png)



[こちらの記事](https://qiita.com/sugimount/items/20859267573e37e0bf85) では、Database Cloud Service に備わっているパッチ適用支援機能を紹介しています。このパッチ適用支援機能を使えば令和パッチも適用可能かと想定していましたが、2020.01月現在では含まれておりません。パッチ適用支援機能では、PSU (Patch Set Update) と呼ばれる四半期毎にリリースされる累積型パッチて提供されています。令和パッチはこの PSU には含まれていなかったため、手動で パッチをダウンロードして適用する必要があります。

note : パッチ適用支援機能に、令和パッチが含まれていない事を確認したのは、バージョン 11.2.0.4 です。これ以外のバージョンでは含まれている可能性がありますが、確認していません。



# パッチ適用前の詳細確認

パッチ適用前の状態で、Oracle DB インスタンスに適用されているパッチを確認します。Oracle DB インスタンスに SSH ログインして、`oracle` ユーザーへスイッチします。

```
> ssh opc@10.0.100.10 
key_load_public: invalid format 
Last login: Mon Jan 27 09:11:36 2020 from 10.0.0.3 
[opc@current ~]$      
[opc@current ~]$ sudo su - oracle 
Last login: Mon Jan 27 09:08:59 UTC 2020 
[oracle@current ~]$  
```



環境変数から、ORACLE_HOME 確認します。

```
[oracle@current ~]$ env | grep -i oracle_home  
ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1
```



ORACLE_HOME へ移動します。

```
cd /u01/app/oracle/product/11.2.0.4/dbhome_1
```



OPatch ディレクトリへ移動します。OPatch とは、Oracle が提供しているパッチ管理ツールです。インストールされているパッチの詳細表示や、パッチの適用が出来るコマンドです。

```
[oracle@current dbhome_1]$ cd OPatch/ 
[oracle@current OPatch]$ 
```



ディレクトリの中身を表示します。OPatch のバイナリファイルが含まれています。

```
[oracle@current OPatch]$ ls -la  
total 188 
drwxr-x--- 15 oracle oinstall  4096 Jan 27 06:10 .
drwxr-xr-x 79 oracle oinstall  4096 Jan 27 06:11 ..
-rw-r-----  1 oracle oinstall  2915 Apr 12  2019 README.txt
drwxr-x---  6 oracle oinstall  4096 Apr 12  2019 auto
drwxr-x---  2 oracle oinstall  4096 Apr 12  2019 config
drwxr-x---  3 oracle oinstall  4096 Apr 12  2019 crs
drwxr-x---  2 oracle oinstall  4096 Apr 12  2019 docs
-rw-r-----  1 oracle oinstall 23550 Apr 12  2019 emdpatch.pl
drwxr-x---  2 oracle oinstall  4096 Apr 12  2019 jlib
drwxr-x---  6 oracle oinstall  4096 May 13  2018 jre
drwxr-x---  9 oracle oinstall  4096 Apr 12  2019 modules
drwxr-x---  5 oracle oinstall  4096 Apr 12  2019 ocm
-rwx--x---  1 oracle oinstall 48493 Apr 12  2019 opatch
-rwx--x---  1 oracle oinstall 16326 Apr 12  2019 opatch.bat
-rw-r-----  1 oracle oinstall    49 Jan 27 06:10 opatch.ini
-rw-r-----  1 oracle oinstall  2551 Apr 12  2019 opatch.pl
-rwxr-x---  1 oracle oinstall  4290 Apr 12  2019 opatch_env.sh
drwxr-x---  4 oracle oinstall  4096 Apr 12  2019 opatchprereqs
-rwxr-x---  1 oracle oinstall  3159 Apr 12  2019 operr
-rwxr-x---  1 oracle oinstall  4218 Apr 12  2019 operr.bat
-rw-r-----  1 oracle oinstall  3177 Apr 12  2019 operr_readme.txt
drwxr-x---  3 oracle oinstall  4096 Apr 12  2019 oplan
drwxr-x---  3 oracle oinstall  4096 Apr 12  2019 oracle_common 
drwxr-x---  3 oracle oinstall  4096 Apr 12  2019 plugins
drwxr-x---  2 oracle oinstall  4096 Apr 12  2019 scripts
-rw-r-----  1 oracle oinstall    27 Apr 12  2019 version.txt
```



OPatch の version を表示します。

```
[oracle@current OPatch]$ ./opatch version  
OPatch Version: 11.2.0.3.21 

OPatch succeeded.
[oracle@current OPatch]$ 
```



Oracle DB インスタンスに適用しているパッチを一覧表示します。

```
[oracle@current OPatch]$ ./opatch lspatches     
28602216; 
30207820; 
30132974;OJVM PATCH SET UPDATE 11.2.0.4.191015
29913194;Database Patch Set Update : 11.2.0.4.191015 (29913194)
29938455;OCW Patch Set Update : 11.2.0.4.191015 (30070097) 

OPatch succeeded.
[oracle@current OPatch]$  
```



パッチの詳細表示をします。

```
[oracle@current OPatch]$ ./opatch lsinventory -all 
Oracle Interim Patch Installer version 11.2.0.3.21 
Copyright (c) 2020, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/11.2.0.4/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/11.2.0.4/dbhome_1/oraInst.loc
OPatch version    : 11.2.0.3.21
OUI version       : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0.4/dbhome_1/cfgtoollogs/opatch/opatch2020-01-27_09-16-12AM_1.log

Lsinventory Output file location : /u01/app/oracle/product/11.2.0.4/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2020-01-27_09-16-12AM.txt 

-------------------------------------------------------------------------------- 
Local Machine Information:: 
Hostname: current.privsubnet01.vcn.oraclevcn.com
ARU platform id: 226
ARU platform description:: Linux x86-64 

List of Oracle Homes:
  Name          Location
   OraGrid190         /u01/app/19.0.0.0/grid
   OraDB11204_home1         /u01/app/oracle/product/11.2.0.4/dbhome_1

Installed Top-level Products (1):

Oracle Database 11g                                                  11.2.0.4.0
There are 1 products installed in this Oracle Home.


Interim patches (5) : 

Patch  28602216     : applied on Thu Oct 17 09:12:09 UTC 2019 
Unique Patch ID:  22426824
   Created on 10 Sep 2018, 00:46:07 hrs PST8PDT
   Bugs fixed:
     13417321, 25881255, 12949905, 27015449, 12320006, 24701840, 20875898
     19396455, 22873635, 16799735, 22037014, 15897859, 18759211, 25173124
     23614158, 17432124

Patch  30207820     : applied on Thu Oct 17 09:11:41 UTC 2019 
Unique Patch ID:  23074440
   Created on 21 Aug 2019, 15:18:59 hrs PST8PDT
   Bugs fixed:
     18948524, 22453212, 26196152, 19449552
   This patch overlays patches:
     29913194
   This patch needs patches:
     29913194
   as prerequisites

Patch  30132974     : applied on Thu Oct 17 09:11:14 UTC 2019
Unique Patch ID:  23113139
Patch description:  "OJVM PATCH SET UPDATE 11.2.0.4.191015"
   Created on 12 Sep 2019, 03:29:21 hrs PST8PDT
   Bugs fixed:
     18933818, 19176885, 17201047, 25649873, 25067795, 28502128, 27952577
     14774730, 27461842, 19153980, 21911849, 23727132, 18166577, 27000663
     24448240, 17056813, 21811517, 19909862, 25494379, 22675136, 24534298
     19895326, 22253904, 17804361, 19231857, 27642235, 26023002, 17528315
     19058059, 29992392, 19554117, 19007266, 28915933, 30160639, 17285560
     29254615, 22670385, 18458318, 19187988, 23265914, 19699946, 19006757
     19374518, 29774367, 19223010, 29448234, 25076732, 22118835, 26637592
     19852360, 20408829, 21047766, 21566944

Patch  29913194     : applied on Thu Oct 17 09:02:56 UTC 2019 
Unique Patch ID:  23112673
Patch description:  "Database Patch Set Update : 11.2.0.4.191015 (29913194)"
   Created on 12 Sep 2019, 21:00:41 hrs PST8PDT
Sub-patch  29497421; "Database Patch Set Update : 11.2.0.4.190716 (29497421)"
Sub-patch  29141056; "Database Patch Set Update : 11.2.0.4.190416 (29141056)"
Sub-patch  28729262; "Database Patch Set Update : 11.2.0.4.190115 (28729262)"
Sub-patch  28204707; "Database Patch Set Update : 11.2.0.4.181016 (28204707)"
Sub-patch  27734982; "Database Patch Set Update : 11.2.0.4.180717 (27734982)"
Sub-patch  27338049; "Database Patch Set Update : 11.2.0.4.180417 (27338049)"
Sub-patch  26925576; "Database Patch Set Update : 11.2.0.4.180116 (26925576)"
Sub-patch  26392168; "Database Patch Set Update : 11.2.0.4.171017 (26392168)"
Sub-patch  26609445; "Database Patch Set Update : 11.2.0.4.170814 (26609445)"
Sub-patch  25869727; "Database Patch Set Update : 11.2.0.4.170718 (25869727)"
Sub-patch  24732075; "Database Patch Set Update : 11.2.0.4.170418 (24732075)"
Sub-patch  24006111; "Database Patch Set Update : 11.2.0.4.161018 (24006111)"
Sub-patch  23054359; "Database Patch Set Update : 11.2.0.4.160719 (23054359)"
Sub-patch  22502456; "Database Patch Set Update : 11.2.0.4.160419 (22502456)"
Sub-patch  21948347; "Database Patch Set Update : 11.2.0.4.160119 (21948347)"
Sub-patch  21352635; "Database Patch Set Update : 11.2.0.4.8 (21352635)"
Sub-patch  20760982; "Database Patch Set Update : 11.2.0.4.7 (20760982)"
Sub-patch  20299013; "Database Patch Set Update : 11.2.0.4.6 (20299013)"
Sub-patch  19769489; "Database Patch Set Update : 11.2.0.4.5 (19769489)"
Sub-patch  19121551; "Database Patch Set Update : 11.2.0.4.4 (19121551)"
Sub-patch  18522509; "Database Patch Set Update : 11.2.0.4.3 (18522509)"
Sub-patch  18031668; "Database Patch Set Update : 11.2.0.4.2 (18031668)"
Sub-patch  17478514; "Database Patch Set Update : 11.2.0.4.1 (17478514)"
   Bugs fixed:
     17184721, 21174504, 20169408, 21538558, 16091637, 18092127, 17381384
     15979965, 20671094, 16731148, 16314254, 18441944, 13837378, 17835048
     17291347, 23105538, 28254374, 13558557, 21656630, 21842740, 17008068
     18382302, 17201159, 17853498, 25427662, 21197626, 17246576, 20717359
     18356166, 18681862, 18440047, 20569094, 20031873, 16875449, 20387265
     19788842, 17296856, 21330264, 14010183, 17648596, 17025461, 18886413
     17551063, 24719736, 17258582, 17267114, 21063322, 22507210, 17912217
     17889583, 18202441, 17040764, 17478145, 16524926, 25655390, 19358317
     22730454, 22148226, 18747196, 26544823, 18641419, 17036973, 18948177
     17811789, 16542886, 14285317, 18009564, 17359610, 16618694, 8322815
     16832076, 18247991, 16692232, 22507234, 28022101, 17570240, 13871092
     24624166, 26631046, 24348685, 19429927, 17848897, 17441661, 14034426
     17465741, 20273319, 19207156, 16596890, 17437634, 20506706, 18510194
     21343897, 28849751, 18339044, 21453153, 17951233, 21795111, 22321741
     18430495, 21787056, 22380919, 20506715, 19692824, 19469538, 17811429
     17903598, 19721304, 11786053, 29511611, 18230522, 19554106, 19458377
     21281607, 17612828, 6599380, 18029658, 22092979, 19516448, 17040527
     22321756, 17811438, 18641461, 18682983, 14657740, 25635149, 21502702
     13364795, 19490948, 21387964, 17346671, 17588480, 22351572, 18235390
     26474853, 18849970, 17982832, 17889549, 19309466, 16472716, 23008056
     20627866, 24908321, 20134113, 25775213, 20596234, 18331850, 18641451
     17019356, 20882568, 17344412, 19461270, 21179898, 17546761, 24842886
     17231779, 14521849, 18203835, 18203838, 18964939, 18203837, 17313525
     22195457, 18139690, 16837842, 14106803, 22296366, 17842825, 22657942
     21352646, 16360112, 22594718, 20657441, 22195441, 17389192, 26198926
     14565184, 19781326, 17019345, 17205719, 18740837, 18440095, 14764829
     14354737, 22195448, 17019086, 13944971, 16571443, 21868720, 17186905
     17080436, 18673342, 28501075, 22905130, 17027426, 19972569, 27374796
     19972568, 16833845, 19972566, 20144308, 17282229, 19972564, 16870214 
     16410570, 21629064, 19615136, 21354456, 26039623, 19871910, 17390431
     18762750, 23007241, 25248384, 16613964, 18098207, 17957017, 17484762
     18471685, 19730508, 18264060, 21538485, 17323222, 17754782, 17600719
     18317531, 17852463, 17596908, 17655634, 18166013, 16228604, 20074391
     27053456, 24790914, 19972570, 26482376, 20856766, 18090142, 19891090
     18996843, 16042673, 19854503, 17835627, 22901797, 20334344, 17393683
     20861693, 18000422, 17551709, 26575788, 23315889, 20506699, 19006849
     18277454, 18456514, 17258090, 19174430, 20657411, 17174582, 25654936
     17242746, 27097854, 16399083, 17824637, 21132297, 17762296, 22465352
     22168163, 28612674, 18604692, 17397545, 16450169, 12364061, 20067212
     19373893, 18856999, 19211724, 19463893, 19463897, 27351628, 21343775
     17853456, 18373438, 18673304, 20004021, 28000269, 26030218, 21668627
     16194160, 17477958, 23140259, 16538760, 12982566, 24570598, 20828947
     27255377, 18259031, 20296213, 21425496, 28855981, 18293054, 17610798
     19699191, 23065323, 17311728, 18135678, 18774543, 23294548, 16785708
     10136473, 22551446, 19777862, 24560906, 17786518, 18315328, 25879984
     18334586, 12747740, 22250006, 18096714, 19032867, 21641760, 17390160
     18899974, 17232014, 20598042, 16354467, 26245237, 26679352, 17484731
     18673325, 16422541, 18155762, 19827973, 14015842, 22683225, 17726838
     18554871, 23177648, 18051556, 20803583, 18282562, 17922254, 15990359
     21972320, 16855292, 16668584, 21343838, 20299015, 29483672, 17446237
     18043064, 18093615, 17694209, 23713236, 17288409, 18308268, 20475845
     17274537, 13955826, 16934803, 18841764, 17634921, 17501491, 16315398
     23725036, 22683212, 17006183, 13829543, 18191164, 26746894, 22809871
     17655240, 28819280, 19393542, 18384391, 29633753, 21538567, 17695685
     16198143, 21847223, 28199085, 25823754, 17892268, 20142975, 19584068
     17165204, 25165496, 27072923, 18604493, 18508861, 21756699, 18554763
     16901385, 21532755, 18189036, 17443671, 17385178, 14829250, 17936109
     20476175, 20925795, 20509482, 17478514, 27441326, 16850630, 13951456
     16595641, 14054676, 15861775, 21142837, 16912439, 17299889, 17297939
     23003979, 16833527, 18619917, 17798953, 17630484, 19697993, 17816865
     25914276, 18607546, 17571306, 21286665, 16898135, 17341326, 16819962
     26910644, 17851160, 17586955, 20558005, 19049453, 21051840, 17587063
     16956380, 18328509, 25042823, 14735792, 25423453, 14133975, 29033139
     19718981, 18061914, 18522509, 16233738, 17518652, 21051833, 18765602
     20294666, 23194294, 20860659, 18272672, 20324049, 18199537, 17332800
     13609098, 22502493, 18384537, 14338435, 17945983, 27710072, 16392068
     21067387, 17752995, 21097043, 21051862, 16863422, 17237521, 25505382
     29483723, 18244962, 19544839, 28357401, 19433930, 24433711, 24717859
     17156148, 18973907, 23026585, 17449815, 17877323, 18180390, 17088068
     17037130, 20004087, 21422580, 19466309, 11733603, 25505371, 18610915
     21051858, 18084625, 29027694, 18674024, 26243698, 21051852, 18091059
     18306996, 16306373, 25369547, 19930276, 17787259, 19915271, 18193833
     20631274, 20513399, 16344544, 26439748, 25879656, 14692762, 18614015
     22782647, 17346091, 18413820, 19297917, 18228645, 17721717, 13960236
     18685892, 18436307, 11883252, 19888853, 21756677, 17891943, 19475971
     22353199, 16384983, 19121551, 27825893, 25634317, 12816846, 17982555
     17761775, 17227073, 13936038, 22243719, 17265217, 25505394, 17071721
     16721594, 18262334, 21756661, 17891946, 15913355, 17672719, 17602269
     17239687, 17042658, 25555252, 17238511, 21059919, 17811456, 17284817
     17752121, 20879889, 28806384, 21380789, 19601762, 17394950, 17011832
     28305362, 16579084, 22195465, 16875230, 14602788, 28790634, 18325460
     27567477, 30275351, 26569225, 24476265, 24476274, 12611721, 18674465
     16903536, 17006570, 19689979, 28076295, 16043574, 18783224, 22836801
     14705949, 24662775, 16494615, 21526048, 17392698, 19197175, 16069901
     17811447, 29200700, 27870645, 28876684, 17308789, 24835538, 22195477
     17865671, 17343514, 19013183, 17325413, 18316692, 16180763, 30275359
     17348614, 14368995, 21983325, 17393915, 16285691, 19788303, 19211433
     20331945, 17883081, 17705023, 24316947, 17614227, 23571055, 19578350
     22195485, 14084247, 24975421, 26078387, 23115139, 13645875, 23328639
     16777840, 19727057, 21698350, 14852021, 18744139, 18674047, 17716305
     19285025, 18482502, 17622427, 19289642, 27534509, 25947799, 22195492
     14458214, 20869721, 21172913, 17767676, 18723434, 25505407, 17786278
     19258504, 17082983, 17365043, 21351877, 13498382, 18331812, 16065166
     25489607, 16685417, 21566639, 18031668, 22893153, 17551674, 16943711
     19272701, 21517440, 25897615, 17649265, 13866822, 18094246, 24528741
     17783588, 14245531, 17082359, 18280813, 26007010, 20448824, 23330119
     16268425, 19487147, 25600421, 18018515, 17302277, 17215560, 24411921
     19271443, 25764020, 14176370, 17016369, 20777150, 16756406, 23330124
     22977256, 20441797, 19769489, 28100487, 17545847, 25093656, 18260550
     13853126, 17227277, 17551699, 23536835, 30237239, 25957038, 24652769
     20725343, 19207117, 9756271, 17495022, 18868646, 17614134, 26667023
     17546973, 19680952, 18704244, 26667015, 17050888, 18273830, 18828868
     17360606, 16992075, 24563422, 17375354, 12905058, 18362222, 21429602
     17254374, 27086138, 28364007, 26667032, 17571039, 17468141, 18436647
     17570606, 17235750, 21168487, 17279227, 16220077, 16929165

Patch  29938455     : applied on Thu Oct 17 09:00:22 UTC 2019 
Unique Patch ID:  23033728
Patch description:  "OCW Patch Set Update : 11.2.0.4.191015 (30070097)"
   Created on 23 Aug 2019, 01:51:24 hrs PST8PDT
   Bugs fixed:
     18328800, 19270660, 18691572, 18508710, 20038451, 21251192, 22162062
     20365005, 21232394, 17336871, 17387214, 17750548, 17617807, 14497275
     20219458, 17733927, 18180541, 23757020, 18962892, 17292250, 17378618
     16759171, 20110156, 17843489, 17065496, 13991403, 21694632, 18419139
     17273020, 22762046, 17336884, 17155238, 17336889, 18261183, 18053580
     20012766, 21245437, 20218012, 17013634, 17886392, 20995001, 24422155
     17039197, 16317771, 17947785, 10052729, 20340620, 22353346, 16237657
     20317221, 18199185, 15917869, 18399991, 20186278, 18024089, 17374271
     16849642, 20246071, 20746251, 14270845, 23621494, 20552947, 18414137
     18882642, 17001914, 17927970, 29323944, 14378120, 16346413, 15986647
     17336898, 18068871, 21222147, 16206997, 18143836, 21982225, 25490238
     19168690, 18343490, 20235511, 21875360, 16613232, 19276791, 17722664
     20440643, 12928658, 18226143, 18520351, 16249829, 18952577, 17172091
     18229842, 16076412, 18265482, 20676340, 17818075, 20091753, 18231837
     14373486, 17483479, 20136892, 20551654, 18120545, 18729166, 13843841
     17405302, 21225209, 18709496, 18330979, 18744838, 14525998, 18187697
     17087371, 20531190, 14385860, 20598625, 18348155, 19479503, 12928592
     17516024, 18370031, 17764053, 19272663, 17551223, 14671408, 18272135
     14207615, 24692493, 21255373, 17500165, 18875012, 14769643, 18464784
     25656952, 19558324, 18848125, 19241857, 30158572, 17955615, 14851828
     14693336, 20315294, 16284825, 17352230, 20014326, 17238586, 17089344
     17405605, 17531342, 21327402, 26546632, 19398098, 17159489, 17640316
     13823394, 16543190, 22024217, 17983675, 20795241, 28973538, 17481314
     18346135, 28553832, 17598201, 16281493, 15986311, 17208793, 19601468
     18700935, 18999857, 14076173, 18428146, 16709532, 17435488, 18352845
     18352846, 20408163, 17592037, 19616601, 17387779, 17391726, 14777968
     15851860, 16206882, 20141091, 15832129, 17305100, 21113068, 20175174
     19885321, 16901346, 17985714, 25591658, 18536826, 17780903, 18752378
     18946768, 16876500, 16875342, 17769597, 19955755, 16429265, 18336452
     23186035, 17273003, 17209968, 25484507, 16988311, 19319357, 20094984
     17046460, 17059927, 18053631, 16867761, 18774591, 21442094, 20235486
     19359787, 15869775, 17447588, 19642566, 21152052, 16798862, 15920201



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

OPatch succeeded.
[oracle@current OPatch]$
```



# OPatch コマンドで令和パッチを Install

My Oracle Support で提供されている手順を使用して適用をします。

https://support.oracle.com/epmos/faces/DocumentDisplay?id=2416596.1



令和パッチのダウンロード先リンクがあります。

![1580117197436.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/104247/527684ae-33cb-ddc3-7a2f-b83ea0d3175b.png)



11.2.0.4 の Release のものを選択します。

![1580117227685.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/104247/606fe1af-59ec-4ac7-9a46-4518b04fa8b3.png)



Download を押してダウンロードをします。

![1580117250229.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/104247/c9a427e3-ca4c-6871-3031-33bedb751f1b.png)



リンクを押して Download します。

![1580117275235.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/104247/a3ef2741-7a90-ab8a-646b-71fd440979d9.png)



ダウンロードしてきた Zip ファイル `p28730253_112040_Linux-x86-64.zip` を、OCI DBCS インスタンスへ SCP などで格納します。oracle ユーザーで作業するため、`/home/oracle/opatch` 配下にzipファイルを配置します

```
[opc@current ~]$ sudo su - 
Last login: Mon Jan 27 23:29:59 UTC 2020 on pts/0 
[root@current ~]#  
[root@current ~]# mv /home/opc/p28730253_112040_Linux-x86-64.zip /home/oracle/opatch/
```



oracle ユーザーが触れるように、権限設定を行います

```
chown oracle:oinstall /home/oracle/opatch/p28730253_112040_Linux-x86-64.zip
```



oracle ユーザーにスイッチして、移動します

```
[opc@current ~]$ sudo su - oracle 
Last login: Mon Jan 27 23:38:43 UTC 2020 on pts/0 
[oracle@current ~]$ cd opatch/ 
[oracle@current opatch]$ 
```



zipファイルを解凍します

```
unzip p28730253_112040_Linux-x86-64.zip
```



実行例

```
[oracle@current opatch]$ unzip p28730253_112040_Linux-x86-64.zip 
Archive:  p28730253_112040_Linux-x86-64.zip 
   creating: 28730253/
  inflating: 28730253/README.txt     
   creating: 28730253/etc/
   creating: 28730253/etc/config/
  inflating: 28730253/etc/config/actions.xml  
  inflating: 28730253/etc/config/deploy.xml  
  inflating: 28730253/etc/config/inventory.xml  
   creating: 28730253/etc/xml/
  inflating: 28730253/etc/xml/ShiphomeDirectoryStructure.xml  
  inflating: 28730253/etc/xml/GenericActions.xml  
   creating: 28730253/files/
   creating: 28730253/files/lib/
   creating: 28730253/files/lib/libnls11.a/
  inflating: 28730253/files/lib/libnls11.a/lxe.o  
  inflating: 28730253/files/lib/libnls11.a/lxet.o  
[oracle@current opatch]$
```



解凍したディレクトリに移動します。ディレクトリの構成は以下の形です。

```
[oracle@current opatch]$ cd 28730253/  
[oracle@current 28730253]$ pwd 
/home/oracle/opatch/28730253
[oracle@current 28730253]$ 
[oracle@current 28730253]$ ls -la 
total 24 
drwxr-xr-x 4 oracle oinstall 4096 Apr  9  2019 .
drwxr-xr-x 3 oracle oinstall 4096 Jan 27 23:39 ..
-rw-r--r-- 1 oracle oinstall 5771 Apr  9  2019 README.txt
drwxr-xr-x 4 oracle oinstall 4096 Apr  9  2019 etc
drwxr-xr-x 3 oracle oinstall 4096 Apr  9  2019 files
[oracle@current 28730253]$ 
```



opatch apply コマンドで、令和パッチを適用します

```
/u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/opatch apply /home/oracle/opatch/28730253
```



yを入力

```
[oracle@current 28730253]$ /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/opatch apply /home/oracle/opatch/28730253 
Oracle Interim Patch Installer version 11.2.0.3.21 
Copyright (c) 2020, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/11.2.0.4/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/11.2.0.4/dbhome_1/oraInst.loc
OPatch version    : 11.2.0.3.21
OUI version       : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0.4/dbhome_1/cfgtoollogs/opatch/opatch2020-01-27_23-47-18PM_1.log

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

Do you want to proceed? [y|n]
y 
```



Email address や User Name を入力

```
User Responded with: Y 
All checks passed.
Provide your email address to be informed of security issues, install and 
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.html for details.
Email address/User Name: 
```



password は 空白でもOK

```
Provide your My Oracle Support password to receive security updates via your My Oracle Support account. 
Password (optional):   
```



OCM (Oracle Configuration Manager) を Oracle Support Hub を通して構成は行わないため、NONE

```
Unable to establish a network connection to Oracle. Specify the URL for an
Oracle Support Hub in this format:
    http[s]://<OracleSupportHubHost>:<OracleSupportHubPort>
If you do not wish to configure OCM through an Oracle Support Hub, enter NONE
Oracle Support Hub URL: NONE
```



Proxyも NONE

```
Proxy specification: NONE 
```



y

```
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system. 
(Oracle Home = '/u01/app/oracle/product/11.2.0.4/dbhome_1')


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



処理が進みます

```
Backing up files...
Applying interim patch '28730253' to OH '/u01/app/oracle/product/11.2.0.4/dbhome_1' 

Patching component oracle.nlsrtl.rsf, 11.2.0.4.0...

Patching component oracle.rdbms.rsf, 11.2.0.4.0...

Patching component oracle.rdbms, 11.2.0.4.0...
Patch 28730253 successfully applied. 
Log file location: /u01/app/oracle/product/11.2.0.4/dbhome_1/cfgtoollogs/opatch/opatch2020-01-27_23-47-18PM_1.log 

OPatch succeeded.
[oracle@current 28730253]$ 
```



パッチの一覧を表示

```
/u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/opatch lspatches
```



令和パッチが追加されています

```
[oracle@current 28730253]$ /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/opatch lspatches 
28730253;  <===== 追加されている
28602216;
30207820;
30132974;OJVM PATCH SET UPDATE 11.2.0.4.191015
29913194;Database Patch Set Update : 11.2.0.4.191015 (29913194) 
29938455;OCW Patch Set Update : 11.2.0.4.191015 (30070097) 

OPatch succeeded.
[oracle@current 28730253]$ 
```



詳細確認

```
[oracle@current 28730253]$ /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/opatch lsinventory -all  
Oracle Interim Patch Installer version 11.2.0.3.21 
Copyright (c) 2020, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/11.2.0.4/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/11.2.0.4/dbhome_1/oraInst.loc
OPatch version    : 11.2.0.3.21
OUI version       : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0.4/dbhome_1/cfgtoollogs/opatch/opatch2020-01-27_23-55-01PM_1.log

Lsinventory Output file location : /u01/app/oracle/product/11.2.0.4/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2020-01-27_23-55-01PM.txt 

-------------------------------------------------------------------------------- 
Local Machine Information:: 
Hostname: current.privsubnet01.vcn.oraclevcn.com
ARU platform id: 226
ARU platform description:: Linux x86-64

List of Oracle Homes: 
  Name          Location
   OraGrid190         /u01/app/19.0.0.0/grid
   OraDB11204_home1         /u01/app/oracle/product/11.2.0.4/dbhome_1

Installed Top-level Products (1): 

Oracle Database 11g                                                  11.2.0.4.0
There are 1 products installed in this Oracle Home.


Interim patches (6) :

Patch  28730253     : applied on Mon Jan 27 23:50:00 UTC 2020 
Unique Patch ID:  22858110
   Created on 9 Apr 2019, 14:54:29 hrs PST8PDT 
   Bugs fixed:
     28730253

Patch  28602216     : applied on Thu Oct 17 09:12:09 UTC 2019
Unique Patch ID:  22426824
   Created on 10 Sep 2018, 00:46:07 hrs PST8PDT
   Bugs fixed:
     13417321, 25881255, 12949905, 27015449, 12320006, 24701840, 20875898
     19396455, 22873635, 16799735, 22037014, 15897859, 18759211, 25173124
     23614158, 17432124

Patch  30207820     : applied on Thu Oct 17 09:11:41 UTC 2019
Unique Patch ID:  23074440
   Created on 21 Aug 2019, 15:18:59 hrs PST8PDT
   Bugs fixed:
     18948524, 22453212, 26196152, 19449552
   This patch overlays patches:
     29913194
   This patch needs patches:
     29913194
   as prerequisites

Patch  30132974     : applied on Thu Oct 17 09:11:14 UTC 2019 
Unique Patch ID:  23113139
Patch description:  "OJVM PATCH SET UPDATE 11.2.0.4.191015"
   Created on 12 Sep 2019, 03:29:21 hrs PST8PDT
   Bugs fixed:
     18933818, 19176885, 17201047, 25649873, 25067795, 28502128, 27952577
     14774730, 27461842, 19153980, 21911849, 23727132, 18166577, 27000663
     24448240, 17056813, 21811517, 19909862, 25494379, 22675136, 24534298
     19895326, 22253904, 17804361, 19231857, 27642235, 26023002, 17528315
     19058059, 29992392, 19554117, 19007266, 28915933, 30160639, 17285560
     29254615, 22670385, 18458318, 19187988, 23265914, 19699946, 19006757
     19374518, 29774367, 19223010, 29448234, 25076732, 22118835, 26637592
     19852360, 20408829, 21047766, 21566944

Patch  29913194     : applied on Thu Oct 17 09:02:56 UTC 2019 
Unique Patch ID:  23112673
Patch description:  "Database Patch Set Update : 11.2.0.4.191015 (29913194)"
   Created on 12 Sep 2019, 21:00:41 hrs PST8PDT
Sub-patch  29497421; "Database Patch Set Update : 11.2.0.4.190716 (29497421)"
Sub-patch  29141056; "Database Patch Set Update : 11.2.0.4.190416 (29141056)"
Sub-patch  28729262; "Database Patch Set Update : 11.2.0.4.190115 (28729262)"
Sub-patch  28204707; "Database Patch Set Update : 11.2.0.4.181016 (28204707)"
Sub-patch  27734982; "Database Patch Set Update : 11.2.0.4.180717 (27734982)"
Sub-patch  27338049; "Database Patch Set Update : 11.2.0.4.180417 (27338049)"
Sub-patch  26925576; "Database Patch Set Update : 11.2.0.4.180116 (26925576)"
Sub-patch  26392168; "Database Patch Set Update : 11.2.0.4.171017 (26392168)"
Sub-patch  26609445; "Database Patch Set Update : 11.2.0.4.170814 (26609445)"
Sub-patch  25869727; "Database Patch Set Update : 11.2.0.4.170718 (25869727)"
Sub-patch  24732075; "Database Patch Set Update : 11.2.0.4.170418 (24732075)"
Sub-patch  24006111; "Database Patch Set Update : 11.2.0.4.161018 (24006111)"
Sub-patch  23054359; "Database Patch Set Update : 11.2.0.4.160719 (23054359)"
Sub-patch  22502456; "Database Patch Set Update : 11.2.0.4.160419 (22502456)"
Sub-patch  21948347; "Database Patch Set Update : 11.2.0.4.160119 (21948347)"
Sub-patch  21352635; "Database Patch Set Update : 11.2.0.4.8 (21352635)"
Sub-patch  20760982; "Database Patch Set Update : 11.2.0.4.7 (20760982)"
Sub-patch  20299013; "Database Patch Set Update : 11.2.0.4.6 (20299013)"
Sub-patch  19769489; "Database Patch Set Update : 11.2.0.4.5 (19769489)"
Sub-patch  19121551; "Database Patch Set Update : 11.2.0.4.4 (19121551)"
Sub-patch  18522509; "Database Patch Set Update : 11.2.0.4.3 (18522509)"
Sub-patch  18031668; "Database Patch Set Update : 11.2.0.4.2 (18031668)"
Sub-patch  17478514; "Database Patch Set Update : 11.2.0.4.1 (17478514)"
   Bugs fixed:
     17184721, 21174504, 20169408, 21538558, 16091637, 18092127, 17381384
     15979965, 20671094, 16731148, 16314254, 18441944, 13837378, 17835048
     17291347, 23105538, 28254374, 13558557, 21656630, 21842740, 17008068
     18382302, 17201159, 17853498, 25427662, 21197626, 17246576, 20717359
     18356166, 18681862, 18440047, 20569094, 20031873, 16875449, 20387265
     19788842, 17296856, 21330264, 14010183, 17648596, 17025461, 18886413
     17551063, 24719736, 17258582, 17267114, 21063322, 22507210, 17912217
     17889583, 18202441, 17040764, 17478145, 16524926, 25655390, 19358317
     22730454, 22148226, 18747196, 26544823, 18641419, 17036973, 18948177
     17811789, 16542886, 14285317, 18009564, 17359610, 16618694, 8322815
     16832076, 18247991, 16692232, 22507234, 28022101, 17570240, 13871092
     24624166, 26631046, 24348685, 19429927, 17848897, 17441661, 14034426
     17465741, 20273319, 19207156, 16596890, 17437634, 20506706, 18510194
     21343897, 28849751, 18339044, 21453153, 17951233, 21795111, 22321741
     18430495, 21787056, 22380919, 20506715, 19692824, 19469538, 17811429
     17903598, 19721304, 11786053, 29511611, 18230522, 19554106, 19458377
     21281607, 17612828, 6599380, 18029658, 22092979, 19516448, 17040527
     22321756, 17811438, 18641461, 18682983, 14657740, 25635149, 21502702
     13364795, 19490948, 21387964, 17346671, 17588480, 22351572, 18235390
     26474853, 18849970, 17982832, 17889549, 19309466, 16472716, 23008056
     20627866, 24908321, 20134113, 25775213, 20596234, 18331850, 18641451
     17019356, 20882568, 17344412, 19461270, 21179898, 17546761, 24842886
     17231779, 14521849, 18203835, 18203838, 18964939, 18203837, 17313525
     22195457, 18139690, 16837842, 14106803, 22296366, 17842825, 22657942
     21352646, 16360112, 22594718, 20657441, 22195441, 17389192, 26198926
     14565184, 19781326, 17019345, 17205719, 18740837, 18440095, 14764829
     14354737, 22195448, 17019086, 13944971, 16571443, 21868720, 17186905
     17080436, 18673342, 28501075, 22905130, 17027426, 19972569, 27374796
     19972568, 16833845, 19972566, 20144308, 17282229, 19972564, 16870214
     16410570, 21629064, 19615136, 21354456, 26039623, 19871910, 17390431
     18762750, 23007241, 25248384, 16613964, 18098207, 17957017, 17484762
     18471685, 19730508, 18264060, 21538485, 17323222, 17754782, 17600719
     18317531, 17852463, 17596908, 17655634, 18166013, 16228604, 20074391
     27053456, 24790914, 19972570, 26482376, 20856766, 18090142, 19891090
     18996843, 16042673, 19854503, 17835627, 22901797, 20334344, 17393683
     20861693, 18000422, 17551709, 26575788, 23315889, 20506699, 19006849
     18277454, 18456514, 17258090, 19174430, 20657411, 17174582, 25654936
     17242746, 27097854, 16399083, 17824637, 21132297, 17762296, 22465352
     22168163, 28612674, 18604692, 17397545, 16450169, 12364061, 20067212
     19373893, 18856999, 19211724, 19463893, 19463897, 27351628, 21343775
     17853456, 18373438, 18673304, 20004021, 28000269, 26030218, 21668627
     16194160, 17477958, 23140259, 16538760, 12982566, 24570598, 20828947
     27255377, 18259031, 20296213, 21425496, 28855981, 18293054, 17610798
     19699191, 23065323, 17311728, 18135678, 18774543, 23294548, 16785708
     10136473, 22551446, 19777862, 24560906, 17786518, 18315328, 25879984
     18334586, 12747740, 22250006, 18096714, 19032867, 21641760, 17390160
     18899974, 17232014, 20598042, 16354467, 26245237, 26679352, 17484731
     18673325, 16422541, 18155762, 19827973, 14015842, 22683225, 17726838
     18554871, 23177648, 18051556, 20803583, 18282562, 17922254, 15990359
     21972320, 16855292, 16668584, 21343838, 20299015, 29483672, 17446237
     18043064, 18093615, 17694209, 23713236, 17288409, 18308268, 20475845
     17274537, 13955826, 16934803, 18841764, 17634921, 17501491, 16315398
     23725036, 22683212, 17006183, 13829543, 18191164, 26746894, 22809871
     17655240, 28819280, 19393542, 18384391, 29633753, 21538567, 17695685
     16198143, 21847223, 28199085, 25823754, 17892268, 20142975, 19584068
     17165204, 25165496, 27072923, 18604493, 18508861, 21756699, 18554763
     16901385, 21532755, 18189036, 17443671, 17385178, 14829250, 17936109
     20476175, 20925795, 20509482, 17478514, 27441326, 16850630, 13951456
     16595641, 14054676, 15861775, 21142837, 16912439, 17299889, 17297939
     23003979, 16833527, 18619917, 17798953, 17630484, 19697993, 17816865
     25914276, 18607546, 17571306, 21286665, 16898135, 17341326, 16819962
     26910644, 17851160, 17586955, 20558005, 19049453, 21051840, 17587063
     16956380, 18328509, 25042823, 14735792, 25423453, 14133975, 29033139
     19718981, 18061914, 18522509, 16233738, 17518652, 21051833, 18765602
     20294666, 23194294, 20860659, 18272672, 20324049, 18199537, 17332800
     13609098, 22502493, 18384537, 14338435, 17945983, 27710072, 16392068
     21067387, 17752995, 21097043, 21051862, 16863422, 17237521, 25505382
     29483723, 18244962, 19544839, 28357401, 19433930, 24433711, 24717859
     17156148, 18973907, 23026585, 17449815, 17877323, 18180390, 17088068
     17037130, 20004087, 21422580, 19466309, 11733603, 25505371, 18610915
     21051858, 18084625, 29027694, 18674024, 26243698, 21051852, 18091059
     18306996, 16306373, 25369547, 19930276, 17787259, 19915271, 18193833
     20631274, 20513399, 16344544, 26439748, 25879656, 14692762, 18614015
     22782647, 17346091, 18413820, 19297917, 18228645, 17721717, 13960236
     18685892, 18436307, 11883252, 19888853, 21756677, 17891943, 19475971
     22353199, 16384983, 19121551, 27825893, 25634317, 12816846, 17982555
     17761775, 17227073, 13936038, 22243719, 17265217, 25505394, 17071721
     16721594, 18262334, 21756661, 17891946, 15913355, 17672719, 17602269
     17239687, 17042658, 25555252, 17238511, 21059919, 17811456, 17284817
     17752121, 20879889, 28806384, 21380789, 19601762, 17394950, 17011832
     28305362, 16579084, 22195465, 16875230, 14602788, 28790634, 18325460
     27567477, 30275351, 26569225, 24476265, 24476274, 12611721, 18674465
     16903536, 17006570, 19689979, 28076295, 16043574, 18783224, 22836801
     14705949, 24662775, 16494615, 21526048, 17392698, 19197175, 16069901
     17811447, 29200700, 27870645, 28876684, 17308789, 24835538, 22195477
     17865671, 17343514, 19013183, 17325413, 18316692, 16180763, 30275359
     17348614, 14368995, 21983325, 17393915, 16285691, 19788303, 19211433
     20331945, 17883081, 17705023, 24316947, 17614227, 23571055, 19578350
     22195485, 14084247, 24975421, 26078387, 23115139, 13645875, 23328639
     16777840, 19727057, 21698350, 14852021, 18744139, 18674047, 17716305
     19285025, 18482502, 17622427, 19289642, 27534509, 25947799, 22195492
     14458214, 20869721, 21172913, 17767676, 18723434, 25505407, 17786278
     19258504, 17082983, 17365043, 21351877, 13498382, 18331812, 16065166
     25489607, 16685417, 21566639, 18031668, 22893153, 17551674, 16943711
     19272701, 21517440, 25897615, 17649265, 13866822, 18094246, 24528741
     17783588, 14245531, 17082359, 18280813, 26007010, 20448824, 23330119
     16268425, 19487147, 25600421, 18018515, 17302277, 17215560, 24411921
     19271443, 25764020, 14176370, 17016369, 20777150, 16756406, 23330124
     22977256, 20441797, 19769489, 28100487, 17545847, 25093656, 18260550
     13853126, 17227277, 17551699, 23536835, 30237239, 25957038, 24652769
     20725343, 19207117, 9756271, 17495022, 18868646, 17614134, 26667023
     17546973, 19680952, 18704244, 26667015, 17050888, 18273830, 18828868
     17360606, 16992075, 24563422, 17375354, 12905058, 18362222, 21429602
     17254374, 27086138, 28364007, 26667032, 17571039, 17468141, 18436647
     17570606, 17235750, 21168487, 17279227, 16220077, 16929165

Patch  29938455     : applied on Thu Oct 17 09:00:22 UTC 2019
Unique Patch ID:  23033728
Patch description:  "OCW Patch Set Update : 11.2.0.4.191015 (30070097)"
   Created on 23 Aug 2019, 01:51:24 hrs PST8PDT
   Bugs fixed:
     18328800, 19270660, 18691572, 18508710, 20038451, 21251192, 22162062
     20365005, 21232394, 17336871, 17387214, 17750548, 17617807, 14497275
     20219458, 17733927, 18180541, 23757020, 18962892, 17292250, 17378618
     16759171, 20110156, 17843489, 17065496, 13991403, 21694632, 18419139
     17273020, 22762046, 17336884, 17155238, 17336889, 18261183, 18053580
     20012766, 21245437, 20218012, 17013634, 17886392, 20995001, 24422155
     17039197, 16317771, 17947785, 10052729, 20340620, 22353346, 16237657
     20317221, 18199185, 15917869, 18399991, 20186278, 18024089, 17374271
     16849642, 20246071, 20746251, 14270845, 23621494, 20552947, 18414137
     18882642, 17001914, 17927970, 29323944, 14378120, 16346413, 15986647
     17336898, 18068871, 21222147, 16206997, 18143836, 21982225, 25490238
     19168690, 18343490, 20235511, 21875360, 16613232, 19276791, 17722664
     20440643, 12928658, 18226143, 18520351, 16249829, 18952577, 17172091
     18229842, 16076412, 18265482, 20676340, 17818075, 20091753, 18231837
     14373486, 17483479, 20136892, 20551654, 18120545, 18729166, 13843841
     17405302, 21225209, 18709496, 18330979, 18744838, 14525998, 18187697
     17087371, 20531190, 14385860, 20598625, 18348155, 19479503, 12928592
     17516024, 18370031, 17764053, 19272663, 17551223, 14671408, 18272135
     14207615, 24692493, 21255373, 17500165, 18875012, 14769643, 18464784
     25656952, 19558324, 18848125, 19241857, 30158572, 17955615, 14851828
     14693336, 20315294, 16284825, 17352230, 20014326, 17238586, 17089344
     17405605, 17531342, 21327402, 26546632, 19398098, 17159489, 17640316 
     13823394, 16543190, 22024217, 17983675, 20795241, 28973538, 17481314
     18346135, 28553832, 17598201, 16281493, 15986311, 17208793, 19601468
     18700935, 18999857, 14076173, 18428146, 16709532, 17435488, 18352845
     18352846, 20408163, 17592037, 19616601, 17387779, 17391726, 14777968
     15851860, 16206882, 20141091, 15832129, 17305100, 21113068, 20175174
     19885321, 16901346, 17985714, 25591658, 18536826, 17780903, 18752378
     18946768, 16876500, 16875342, 17769597, 19955755, 16429265, 18336452
     23186035, 17273003, 17209968, 25484507, 16988311, 19319357, 20094984
     17046460, 17059927, 18053631, 16867761, 18774591, 21442094, 20235486
     19359787, 15869775, 17447588, 19642566, 21152052, 16798862, 15920201



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

OPatch succeeded.
[oracle@current 28730253]$ 
```



Oracle DB インスタンスが停止されているため、仮想マシンインスタンスの再起動 (ほかに良いやり方があるかも)

```
sudo shutdown -r now
```



再起動後、SQL を実行してみると、正常に令和が表示されました

```
SELECT to_char(sysdate,'EEYY"年"mm"月"dd"日"','nls_calendar = ''Japanese Imperial''') FROM DUAL;
```



![1580170216059.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/104247/ccdbc197-d30f-4184-2854-c097387a12e7.png)



# Rollback 検証

OPatch を使ってパッチ適用の切り戻しが出来ます。切り戻しの方法を確認します。

詳細画面の Patch ID を確認します

```
[oracle@current 28730253]$ /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/opatch lsinventory -all  
Interim patches (6) :

~~~~~~~~~~~~~ 省略 ~~~~~~~~~~~~~

Patch  28730253     : applied on Mon Jan 27 23:50:00 UTC 2020 
Unique Patch ID:  22858110
   Created on 9 Apr 2019, 14:54:29 hrs PST8PDT 
   Bugs fixed:
     28730253

~~~~~~~~~~~~~ 省略 ~~~~~~~~~~~~~
```



Patch ID を `-id` で指定して、ロールバックを行います

```
/u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/opatch rollback -id 28730253
```



y を押します

```
[oracle@current ~]$ /u01/app/oracle/product/11.2.0.4/dbhome_1/OPatch/opatch rollback -id 28730253
Oracle Interim Patch Installer version 11.2.0.3.21
Copyright (c) 2020, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/11.2.0.4/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/11.2.0.4/dbhome_1/oraInst.loc
OPatch version    : 11.2.0.3.21
OUI version       : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0.4/dbhome_1/cfgtoollogs/opatch/opatch2020-01-28_00-21-35AM_1.log


Patches will be rolled back in the following order: 
   28730253
The following patch(es) will be rolled back: 28730253  

Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/u01/app/oracle/product/11.2.0.4/dbhome_1')


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



ロールバックが成功します

```
Rolling back patch 28730253...

RollbackSession rolling back interim patch '28730253' from OH '/u01/app/oracle/product/11.2.0.4/dbhome_1'

Patching component oracle.nlsrtl.rsf, 11.2.0.4.0...

Patching component oracle.rdbms.rsf, 11.2.0.4.0...

Patching component oracle.rdbms, 11.2.0.4.0...
RollbackSession removing interim patch '28730253' from inventory
Log file location: /u01/app/oracle/product/11.2.0.4/dbhome_1/cfgtoollogs/opatch/opatch2020-01-28_00-21-35AM_1.log

OPatch succeeded.
[oracle@current ~]$ 
```



Oracle DB インスタンスが停止しているため、起動するために仮想インスタンスを再起動します (ほかに良いやり方あるかも)

```
sudo shutdown -r now
```



# 参考URL

https://support.oracle.com/epmos/faces/DocumentDisplay?id=2416596.1