Por Yenugula Venkata Ravikumar , Nassyam Basha e Alex Zaballa
Postado em Novembro 2016
Revisado por Marcelo Pivovar - Solution Architect
Introdução
Aplicar patches no banco de dados deveria ser uma tarefa regular executada ao menos trimestralmente quando a Oracle lança as correções de segurança.
As numerosas tarefas e desafios da aplicação de patches em ambientes On-Premises são drasticamente simplificadas quando estamos na Oracle Cloud.
Neste artigo iremos verificar como é possível aplicar um patch no seu banco de dados com apenas um clique.
Desafios para aplicar patches em ambientes On-Premises
Abaixo estão alguns dos itens (os mais importantes), em que é necessária a realização de uma avaliação detalhada antes de aplicar um patch em um ambiente On-Premise:
DBAAS – Cloud patching
Vamos considerar um cliente que migrou um banco de dados on-premise para a Oracle Cloud.
Pergunta: É fácil aplicar um patch no banco de dados que está na nuvem (DBAAS)?
Pensamento provável: Provavelmente deveremos executar os mesmos passos que executávamos em ambientes on-premises.
Resposta: Apenas um clique e em cerca de 30 minutos tudo é feito automaticamente para você.
Informações do ambiente:
Service/Hostname: CKPT-DBaaS
Domain: nassyambasha
Oracle RDBMS: 12.1.0.2
Database: On Cloud
SID: ORC1
Versão do OPatch: 12.1.0.1.10
Patch que será aplicado: April 2016 PSU
Patch 22291127: DATABASE PATCH SET UPDATE 12.1.0.2.160419
Patch 22291127 - Database Patch Set Update 12.1.0.2.160419 (Includes CPUApr2016)
Aplicando o Patch
Para acessar a console e verificar a lista de banco de dados disponíveis, siga o seguinte caminho:
Dashboard à Oracle Database Cloud Service à Services
Nessa página, é possível verificar as informações de hardware e conectividade.
Na aba Administration, é possível verificar as informações de patches.
Podemos verificar a lista de patches disponíveis, que nesse caso é o PSU update 12.1.0.2.160419 (April 2016 PSU).
Antes de aplicar o patch, devemos executar um “pre-check”, que irá nos informar sobre possíveis conflitos:
Pre-check em andamento:
Como podemos verificar abaixo, podemos proceder com a aplicação do patch:
Antes de aplicar o patch via console, podemos também verificar via linha de comando os patches que já foram aplicados nesse banco de dados:
[oracle@CKPT-DBaaS ~]$ hostname CKPT-DBaaS [oracle@CKPT-DBaaS ~]$ id uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba) [oracle@CKPT-DBaaS ~]$
[oracle@CKPT-DBaaS ~]$ export PATH=$ORACLE_HOME/OPatch:$PATH [oracle@CKPT-DBaaS ~]$ OPatch version OPatch Version: 12.1.0.1.10
OPatch succeeded. [oracle@CKPT-DBaaS ~]$ OPatch lsinventory Oracle Interim Patch Installer version 12.1.0.1.10 Copyright (c) 2016, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/12.1.0/dbhome_1 Central Inventory : /u01/app/oraInventory from : /u01/app/oracle/product/12.1.0/dbhome_1/oraInst.loc OPatch version : 12.1.0.1.10 OUI version : 12.1.0.2.0 Log file location : /u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/OPatch/OPatch2016-07-16_08-23-00AM_1.log
Lsinventory Output file location :
/u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/OPatch/lsinv/lsinventory2016-07-16_08-23-00AM.txt
----------------------------------------------------------------------Local Machine Information:: Hostname: CKPT-DBaaS.compute-nassyambasha.oraclecloud.internal ARU platform id: 226 ARU platform description:: Linux x86-64
Installed Top-level Products (1):
Oracle Database 12c 12.1.0.2.0 There are 1 products installed in this Oracle Home.
Interim patches (3) :
Patch 22139226 : applied on Thu Jan 21 12:30:53 IST 2016 Unique Patch ID: 19729684 Patch description: "Database PSU 12.1.0.2.160119, Oracle JavaVM Component (Jan2016)" Created on 4 Jan 2016, 01:41:46 hrs PST8PDT Bugs fixed: 19699946, 19176885, 19623450, 22139226, 19909862, 21811517, 19223010 21068507, 19895326, 19877336, 22118835, 22118851, 21566993, 19153980 20408829, 21047766, 19231857, 19895362, 19855285, 20415564, 21555660 19245191, 21047803, 20408866, 21566944
Patch 22543975 : applied on Thu Jan 21 12:27:21 IST 2016 Unique Patch ID: 19772638 Created on 20 Jan 2016, 19:09:00 hrs PST8PDT Bugs fixed: 19770063, 19665921, 21281607, 21154593, 22543975, 21294504 This patch overlays patches: 21948354 This patch needs patches: 21948354 as prerequisites
Patch 21948354 : applied on Thu Jan 21 12:20:58 IST 2016 Unique Patch ID: 19553095 Patch description: "Database Patch Set Update : 12.1.0.2.160119 (21948354)" Created on 20 Dec 2015, 23:39:33 hrs PST8PDT Sub-patch 21359755; "Database Patch Set Update : 12.1.0.2.5 (21359755)" Sub-patch 20831110; "Database Patch Set Update : 12.1.0.2.4 (20831110)" Sub-patch 20299023; "Database Patch Set Update : 12.1.0.2.3 (20299023)" Sub-patch 19769480; "Database Patch Set Update : 12.1.0.2.2 (19769480)" Bugs fixed: 19189525, 19075256, 19141838, 19865345, 19791273, 19280225, 18845653 20951038, 19243521, 19248799, 21756699, 18988834, 19238590, 21281532 20245930, 18921743, 18799063, 19134173, 19571367, 20476175, 20925795 19018206, 20509482, 20387265, 20588502, 19149990, 18849537, 18886413 17551063, 19183343, 19703301, 19001390, 18202441, 19189317, 19644859 19358317, 19390567, 19279273, 19706965, 19068970, 19619732, 20348653 18607546, 18940497, 19670108, 19649152, 18948177, 19315691, 19676905 18964978, 19035573, 20165574, 19176326, 20413820, 20558005, 19176223 19532017, 20134339, 19074147, 18411216, 20361671, 20425790, 18966843 20294666, 19307662, 19371175, 19195895, 19154375, 19468991, 19174521 19520602, 19382851, 21875360, 19326908, 19658708, 20093776, 20618595 21787056, 17835294, 19791377, 19068610, 20048359, 20746251, 19143550 19185876, 19627012, 20281121, 19577410, 22092979, 19001359, 19518079 18610915, 19490948, 18674024, 18306996, 19309466, 19081128, 19915271 20122715, 21188532, 20284155, 18791688, 20890311, 21442094, 18973548 19303936, 19597439, 20235511, 18964939, 19430401, 19044962, 19409212 19879746, 20657441, 19684504, 19024808, 18799993, 20877664, 19028800 19065556, 19723336, 19077215, 19604659, 21421886, 19524384, 19048007 18288842, 19689979, 20446883, 18952989, 16870214, 19928926, 21526048 19180770, 19197175, 19902195, 20318889, 19730508, 19012119, 19067244 20074391, 19512341, 19841800, 14643995, 20331945, 19587324, 19547370 19065677, 19637186, 21225209, 20397490, 18967382, 19174430, 18674047 19054077, 19536415, 19708632, 19289642, 20869721, 19335438, 17365043 18856999, 19869255, 20471920, 19468347, 21620471, 16359751, 18990693 17890099, 19439759, 19769480, 19272708, 19978542, 20101006, 21300341 20402832, 19329654, 19873610, 21668627, 21517440, 19304354, 19052488 20794034, 19291380, 18681056, 19896336, 19076343, 19561643, 18618122 20440930, 18456643, 19699191, 18909599, 19487147, 18250893, 19016730 18743542, 20347562, 16619249, 18354830, 19687159, 19174942, 20424899 19989009, 20688221, 20441797, 19157754, 19032777, 19058490, 19399918 18885870, 19434529, 19018447, 18417036, 20919320, 19022470, 19284031 20474192, 20173897, 22062026, 19385656, 19501299, 17274537, 20899461 19440586, 16887946, 19606174, 18436647, 17655240, 19023822, 19178851 19124589, 19805359, 19597583, 19155797, 19393542, 19050649
---------------------------------------------------------------------- OPatch succeeded. [oracle@CKPT-DBaaS ~]$
De volta a console, iremos proceder com a aplicação do patch:
Antes de continuar, é exibido um alerta de que ocorrerá indisponibilidade do ambiente durante a aplicação do patch e teremos que concordar para prosseguir:
Aplicação do patch em andamento:
A aplicação do patch pode ser monitorada na seção “Last Patch applied”:
Durante a aplicação do patch, podemos verificar via linha de comando que os serviços estão down:
[oracle@CKPT-DBaaS ~]$ ps -ef|grep pmon oracle 6848 1369 0 08:36 pts/1 00:00:00 grep pmon [oracle@CKPT-DBaaS ~]$ ps -ef|grep tns root 20 2 0 Jun26 ? 00:00:00 [netns] oracle 6850 1369 0 08:36 pts/1 00:00:00 grep tns [oracle@CKPT-DBaaS ~]$
A duração da aplicação do patch foi de 25 minutos:
Em 25 minutos, foram executadas as seguintes tarefas:
O histórico dos patches aplicados pode ser visualizado conforme abaixo:
Também podemos verificar através da seguinte query:
A mesma informação pode ser visualizada no alert.log:
Sat Jul 16 08:44:45 2016 AQPC started with pid=35, OS id=15902 Database Characterset for PDB$SEED is AL32UTF8 Opening pdb PDB$SEED (2) with no Resource Manager plan active ALTER PLUGGABLE DATABASE ALL OPEN Database Characterset for PSPDB is AL32UTF8 Opening pdb PSPDB (3) with no Resource Manager plan active Pluggable database PSPDB opened read write Completed: ALTER PLUGGABLE DATABASE ALL OPEN Starting background process CJQ0 Completed: ALTER DATABASE OPEN Sat Jul 16 08:44:48 2016 CJQ0 started with pid=36, OS id=16023 Sat Jul 16 08:44:49 2016 =========================================================== Dumping current patch information =========================================================== Patch Id: 19769480 Patch Description: Database Patch Set Update : 12.1.0.2.2 (19769480) Patch Apply Time: 2016-05-06 22:55:14 GMT+05:30 Bugs Fixed: 14643995,16359751,16870214,17835294,18250893,18288842,18354830, 18436647,18456643,18610915,18618122,18674024,18674047,18791688,18845653, 18849537,18885870,18921743,18948177,18952989,18964939,18964978,18967382, 18988834,18990693,19001359,19001390,19016730,19018206,19022470,19024808, 19028800,19044962,19048007,19050649,19052488,19054077,19058490,19065556, 19067244,19068610,19068970,19074147,19075256,19076343,19077215,19124589, 19134173,19143550,19149990,19154375,19155797,19157754,19174430,19174521, 19174942,19176223,19176326,19178851,19180770,19185876,19189317,19189525, 19195895,19197175,19248799,19279273,19280225,19289642,19303936,19304354, 19309466,19329654,19371175,19382851,19390567,19409212,19430401,19434529, 19439759,19440586,19468347,19501299,19518079,19520602,19532017,19561643, 19577410,19597439,19676905,19706965,19708632,19723336,19769480,20074391, 20284155
Patch Id: 20299023 Patch Description: Database Patch Set Update : 12.1.0.2.3 (20299023) Patch Apply Time: 2016-05-06 22:56:42 GMT+05:30 Bugs Fixed: 16619249,17274537,18202441,18306996,18417036,18607546,18681056, 18856999,18909599,18940497,19012119,19018447,19023822,19035573,19065677, 19081128,19183343,19238590,19272708,19291380,19315691,19335438,19358317, 19385656,19393542,19487147,19512341,19524384,19536415,19547370,19597583, 19606174,19619732,19627012,19637186,19644859,19649152,19658708,19670108, 19684504,19687159,19730508,19791377,19805359,19841800,19865345,19873610, 19896336,19915271,19928926,19978542,20235511,20347562,20348653,20425790, 20440930
Patch Id: 20831110 Patch Description: Database Patch Set Update : 12.1.0.2.4 (20831110) Patch Apply Time: 2016-05-06 22:58:23 GMT+05:30 Bugs Fixed: 19284031,19307662,19399918,19699191,19703301,19989009,20093776, 20165574,20294666,20331945,20387265,20402832,20424899,20474192,20558005, 20657441,20746251,20899461,20919320,21225209
Patch Id: 21359755 Patch Description: Database Patch Set Update : 12.1.0.2.5 (21359755) Patch Apply Time: 2016-05-06 23:00:02 GMT+05:30 Bugs Fixed: 17365043,18411216,18743542,18966843,19032777,19243521,19468991, 19571367,19587324,19791273,20048359,20122715,20134339,20245930,20281121, 20361671,20397490,20413820,20441797,20471920,20476175,20688221,20925795, 21281532,21421886,21442094,21620471,22062026
Patch Id: 21948354 Patch Description: Database Patch Set Update : 12.1.0.2.160119 (21948354) Patch Apply Time: 2016-05-06 23:01:39 GMT+05:30 Bugs Fixed: 16887946,17551063,17655240,17890099,18799063,18799993,18886413, 18973548,19141838,19326908,19490948,19604659,19689979,19869255,19879746, 19902195,20101006,20173897,20318889,20446883,20509482,20588502,20618595, 20794034,20869721,20877664,20890311,20951038,21188532,21300341,21517440, 21526048,21668627,21756699,21787056,21875360,22092979
Patch Id: 22291127 Patch Description: Database Patch Set Update : 12.1.0.2.160419 (22291127) Patch Apply Time: 2016-05-06 23:03:25 GMT+05:30 Bugs Fixed: 13542050,16439813,16923858,18499088,18893947,18914624,18990023, 19258504,19333670,19354335,19450314,19591608,19639483,19676012,19721304, 19777862,19835133,19883092,19888853,19990037,20043616,20117253,20124446, 20356733,20373598,20447445,20466628,20596234,20711718,20825533,20831538, 20879889,20904530,20936905,20952966,21091431,21153266,21260431,21273804, 21315084,21329301,21744290,21756661,21756677,21847223,21899588,21915719, 21917884,22046677,22168163,22173980,22353199,22353346,22374754,22528741, 22762046
Patch Id: 22674709 Patch Description: Database PSU 12.1.0.2.160419, Oracle JavaVM Component (Apr2016) Patch Apply Time: 2016-05-06 23:04:29 GMT+05:30 Bugs Fixed: 19153980,19176885,19223010,19231857,19245191,19623450,19699946, 19855285,19877336,19895326,19895362,19909862,20408829,20408866,20415564, 21047766,21047803,21068507,21188537,21555660,21566944,21566993,21811517, 22118835,22118851,22139226,22670385,22670413,22674709
Patch Id: 23192060 Patch Description: Patch Apply Time: 2016-05-06 23:05:07 GMT+05:30 Bugs Fixed: 19366375,19665921,19770063,21281607,21470120,21923026,23072137 =========================================================== Sat Jul 16 08:44:49 2016 db_recovery_file_dest_size of 6144 MB is 48.22% used. This is a user-specified limit on the amount of space that will be used by this database for recovery-related files, and does not reflect the amount of space available in the underlying filesystem or ASM diskgroup. Sat Jul 16 08:45:38 2016 SERVER COMPONENT id=UTLRP_BGN: timestamp=2016-07-16 08:45:38 Container=CDB$ROOT Id=1 diag_adl:SERVER COMPONENT id=UTLRP_END: timestamp=2016-07-16 08:45:41 Container=CDB$ROOT Id=1 diag_adl: diag_adl:XDB installed. diag_adl: diag_adl:XDB initialized. Sat Jul 16 08:54:28 2016 Resize operation completed for file# 1, old size 839680K, new size 849920K
Verificando via linha de comando os patches aplicados:
[oracle@CKPT-DBaaS ~]$ export PATH=$ORACLE_HOME/OPatch:$PATH [oracle@CKPT-DBaaS ~]$ OPatch lsinventory Oracle Interim Patch Installer version 12.1.0.1.10 Copyright (c) 2016, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/12.1.0/dbhome_1 Central Inventory : /u01/app/oraInventory from : /u01/app/oracle/product/12.1.0/dbhome_1/oraInst.loc OPatch version : 12.1.0.1.10 OUI version : 12.1.0.2.0 Log file location : /u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/OPatch/OPatch2016-07-16_15-37-52PM_1.log
Lsinventory Output file location :
/u01/app/oracle/product/12.1.0/dbhome_1/cfgtoollogs/OPatch/lsinv/lsinventory2016-07-16_15-37-52PM.txt
----------------------------------------------------------------------Local Machine Information:: Hostname: CKPT-DBaaS.compute-nassyambasha.oraclecloud.internal ARU platform id: 226 ARU platform description:: Linux x86-64
Installed Top-level Products (1):
Oracle Database 12c 12.1.0.2.0 There are 1 products installed in this Oracle Home.
Interim patches (3) :
Patch 23192060 : applied on Fri May 06 23:05:07 IST 2016 Unique Patch ID: 20172670 Created on 6 May 2016, 04:54:57 hrs PST8PDT Bugs fixed: 19770063, 19366375, 21923026, 19665921, 23072137, 21281607, 21470120 This patch overlays patches: 22291127 This patch needs patches: 22291127 as prerequisites
Patch 22674709 : applied on Fri May 06 23:04:29 IST 2016 Unique Patch ID: 20057886 Patch description: "Database PSU 12.1.0.2.160419, Oracle JavaVM Component (Apr2016)" Created on 5 Apr 2016, 08:56:18 hrs PST8PDT Bugs fixed: 22674709, 19176885, 22670413, 19623450, 21566993, 19153980, 19855285 20415564, 21555660, 21047803, 21188537, 22670385, 19699946, 22139226 19909862, 21811517, 19223010, 21068507, 19895326, 19877336, 22118851 22118835, 20408829, 21047766, 19231857, 19895362, 19245191, 20408866, 21566944
Patch 22291127 : applied on Fri May 06 23:03:25 IST 2016 Unique Patch ID: 19694308 Patch description: "Database Patch Set Update : 12.1.0.2.160419 (22291127)" Created on 6 Apr 2016, 03:46:21 hrs PST8PDT Sub-patch 21948354; "Database Patch Set Update : 12.1.0.2.160119 (21948354)" Sub-patch 21359755; "Database Patch Set Update : 12.1.0.2.5 (21359755)" Sub-patch 20831110; "Database Patch Set Update : 12.1.0.2.4 (20831110)" Sub-patch 20299023; "Database Patch Set Update : 12.1.0.2.3 (20299023)" Sub-patch 19769480; "Database Patch Set Update : 12.1.0.2.2 (19769480)" Bugs fixed: 21847223, 19189525, 19075256, 19141838, 22762046, 20117253, 19865345 19791273, 19280225, 18845653, 19248799, 20951038, 19243521, 21756699 18988834, 21281532, 19238590, 18921743, 20245930, 18799063, 19134173 20373598, 19571367, 20476175, 20925795, 19018206, 20711718, 20387265 20509482, 20588502, 19149990, 18849537, 17551063, 18886413, 19183343 19703301, 21917884, 19001390, 18202441, 19189317, 19644859, 19358317 19390567, 19279273, 19706965, 22528741, 19068970, 20825533, 19619732 18607546, 20348653, 19649152, 19670108, 18940497, 18948177, 19315691 19676905, 18964978, 19035573, 20165574, 19176326, 20413820, 20558005 19176223, 19532017, 20904530, 20134339, 19450314, 22353346, 19074147 18411216, 20361671, 20425790, 18966843, 21329301, 20294666, 19333670 19195895, 19307662, 19371175, 20043616, 19154375, 20124446, 18914624 19468991, 19883092, 19382851, 19520602, 19174521, 21875360, 19676012 19326908, 19658708, 19591608, 20093776, 20618595, 21787056, 17835294 19721304, 19791377, 19068610, 22173980, 20746251, 20048359, 19143550 19185876, 19627012, 20281121, 19577410, 22092979, 19001359, 19518079 18610915, 19490948, 18674024, 18306996, 19309466, 19081128, 19915271 20122715, 21188532, 18791688, 20284155, 20890311, 21442094, 20596234 18973548, 19303936, 19597439, 20936905, 20235511, 19888853, 21756677 18964939, 19354335, 19430401, 19044962, 19639483, 21153266, 22353199 19409212, 20657441, 19879746, 19684504, 19024808, 21260431, 21756661 18799993, 20877664, 19028800, 20879889, 19065556, 19723336, 19077215 19604659, 21421886, 19524384, 18288842, 19048007, 19689979, 20446883 18952989, 16870214, 19928926, 19835133, 21526048, 20466628, 19197175 19180770, 19902195, 20318889, 19730508, 19012119, 19067244, 20074391 20356733, 14643995, 19512341, 19841800, 20331945, 19587324, 19547370 19065677, 21225209, 19637186, 20397490, 18967382, 19174430, 19054077 18674047, 19536415, 19708632, 21091431, 19289642, 22168163, 20869721 19335438, 19258504, 20447445, 17365043, 18856999, 19468347, 20471920 19869255, 21620471, 16359751, 18990693, 17890099, 19769480, 19439759 19272708, 18990023, 19978542, 20402832, 20101006, 21300341, 19329654 19873610, 21744290, 13542050, 21517440, 21668627, 19304354, 19052488 20794034, 19291380, 21915719, 18681056, 20952966, 19896336, 19076343 19561643, 19990037, 18618122, 20440930, 18456643, 19699191, 19487147 18909599, 20831538, 18250893, 19016730, 18743542, 20347562, 16619249 18354830, 19777862, 19687159, 19174942, 20424899, 19989009, 20688221 21899588, 20441797, 19157754, 19032777, 19058490, 19399918, 18885870 19434529, 21273804, 19018447, 18893947, 16923858, 18417036, 20919320 19022470, 19284031, 20474192, 22046677, 20173897, 22062026, 19385656 19501299, 17274537, 20899461, 21315084, 19440586, 22374754, 16887946 19606174, 18436647, 17655240, 19023822, 19178851, 19124589, 16439813 19805359, 19597583, 18499088, 19155797, 19050649, 19393542 ---------------------------------------------------------------------- OPatch succeeded. [oracle@CKPT-DBaaS ~]$
Yenugula Venkata Ravikumar é um DBA com mais de 15 anos de experiencia com Oracle e em ambientes de alta disponibilidade (RAC, Data Guard, dentre outros), tuning e desempenho, migrações, backup e recover, Oracle Exadata X2 e X3, é Expert em sistemas operacionais tais como como AIX, HP-UX e Linux. Já participou como conferencista de Oracle pela India, onde mora atualmente. Obteve o título de "Oracle Certified Master (OCM 10g)" em 2009.
Nassyam Basha é um DBA, OCM 11g, Oracle ACE Director e conta com experiência em tecnologias como Oracle Data Guard, RMAN, RAC. Ele já fez mais de 90 configurações do Data Guard em diferentes plataformas, de não-RAC RAC e vice-versa. Ele fez migrações bem-sucedidas com "switchovers" e "failovers" a vários bancos de dados de produção crítica. Ele participa ativamente de fóruns Oracle utilizando o usuário "CKPT" e ganhou mais de 10.000 pontos (nível guru). Publica regularmente artigos em seu blog www.oracle-ckpt.com e é co-autor do livro "Guia de Administração do Oracle Data Guard 11gR2".
Alex Zaballa, formado em Análise de Sistemas, é especialista em Banco de Dados Oracle com sólidos conhecimentos em Servidores de Aplicação e Sistemas Operacionais; trabalha com Oracle há 15 anos, é Oracle ACE Director, certificado OCM Database 12c/11G/Cloud e conta com mais de 200 outras certificações em produtos da Oracle. Alex também é membro do Groupo de Usuários Oracle do Brasil (GUOB), fundador do Grupo de Usuários Oracle de Angola (GUOA) e membro do time OraWorld.
Este artigo foi revisto pela equipe de produtos Oracle e está em conformidade com as normas e práticas para o uso de produtos Oracle.