quinta-feira, 9 de novembro de 2017

Aplicando RUR 12.2.0.1.171017 em single instance com GRID

Olá pessoal.

Vocês já aplicaram patches na versão 12.2.0.1 do Oracle? 

Naquela pegada de roteiros para tentar facilitar primeiro a minha vida depois a dos amigos DBA's, montei o passo a passo abaixo.

Mas antes de aplicar seria bom você se atentar as mudanças de nomenclatura e mesmo no conceito dos patches.

Bem a grosso modo e somente para traçar um paralelo com a maneira mais antiga já que na verdade as diferenças são bem maiores que essas abaixo, seria mais ou menos assim: 

- No lugar dos antigos PSU's (Patch Set Updates ) entraram os RU's (Release Updates).

- Já no lugar dos famosos BP's (Proactive Bundle Patches) temos agora os RUR's (Release Update Revisions).

Essa seria a nova organização dos patches:

Retirada do blog do Mike Dietrich

Obviamente não é tão simples assim, o conceito dos patches mudaram como eu disse lá no começo e essa minha definição é extremamente simplista e ilustrativa.

No note "Release Update Introduction and FAQ (Doc ID 2285040.1)" você encontra muitas informações sobre as mudanças. 

Se quiser algo mais mastigado, veja o ótimo texto no site do Mike Dietrich: [Differences between PSU/BP and RU/RUR]

Não deixe de ler, vale muito a pena além de ser bastante importante.

Bom, se você já leu ou já sabe das mudanças, vamos ao que interessa e aplicar o RUR 12.2.0.1.171017 que até o momento da escrita desse artigo é o mais recente.

Vamos ao roteiro da atualização (as saídas dos comandos foram editadas somente com as partes importantes):

1) Sempre verificar a última versão do OPATCH. Isso pode ser feito verificando o note abaixo:

Veja o note:
- How To Download And Install The Latest OPatch(6880880) Version (Doc ID 274526.1)

2) Localizar o patch mais atualizado - RUR ou RU
Veja os notes:
- Release Update Introduction and FAQ (Doc ID 2285040.1)
- 12.2.0.1 Base Release - Availability and Known Issues (Doc ID 2239820.1)


3) Baixe os PATCHES.
Patch 6880880: OPatch patch of version 12.2.0.1.11 for Oracle software releases 12.1.0.x (installer) and 12.2.0.x (OCT 2017) (Patch)  


Patch 26878187: GRID INFRASTRUCTURE RELEASE UPDATE REVISION 12.2.0.1.171017


 
4) Agora vamos atualizar o OPATCH do GRID e do DATABASE. Não é obrigatório mas eu acho bastante importante rodar o OPATCH atualizado. Aprendi isso com o meu amigo Portilho e nunca mais deixei de fazer.

-- Como root
su -
cd /home/oracle/PATCH
unzip -q p6880880_122010_Linux-x86-64.zip

-- GRID
cd /oracle/12.2.0.1/grid
mv OPatch OPatch-20171108

mkdir OPatch
cp -rv /home/oracle/PATCH/OPatch/* /oracle/12.2.0.1/grid/OPatch/.
chown -R oracle:oinstall OPatch


-- DATABASE
cd /oracle/app/oracle/product/12.2.0.1/dbhome_1/
mv OPatch OPatch-20171108
mkdir OPatch
cp -rv /home/oracle/PATCH/OPatch/* /oracle/app/oracle/product/12.2.0.1/dbhome_1/OPatch/
chown -R oracle:oinstall OPatch
  


5) Verificando versão do OPatch e os patches já aplicados no ambiente.

su - oracle
-- GRID
$GRID_HOME/OPatch/opatchauto version
Oracle OPatchAuto Version 13.9.2.1.0
Copyright (c) 2016, Oracle Corporation.  All rights reserved.
1. OPatchAuto version 13.9.2.1.0
2. OpatchautoDB version 12.2.0.1.11

$GRID_HOME/OPatch/opatch lsinventory

 Oracle Home       : /oracle/12.2.0.1/grid
Central Inventory : /oracle/app/oraInventory
 from              : /oracle/12.2.0.1/grid/oraInst.loc
OPatch version    : 12.2.0.1.11
OUI version       : 12.2.0.1.4
-------------------------------------------------------------------
Local Machine Information::
Hostname: single122
ARU platform id: 226
ARU platform description:: Linux x86-64

Installed Top-level Products (1): 
Oracle Grid Infrastructure 12c                                       12.2.0.1.0

 There are 1 products installed in this Oracle Home.
There are no Interim PATCH installed in this Oracle Home.
 -------------------------------------------------------------------


-- DATABASE
$ORACLE_HOME/OPatch/opatch lsinventory

 Oracle Home       : /oracle/app/oracle/product/12.2.0.1/dbhome_1
Central Inventory : /oracle/app/oraInventory
from           : /oracle/app/oracle/product/12.2.0.1/dbhome_1/oraInst.loc
OPatch version    : 12.2.0.1.11
OUI version       : 12.2.0.1.4
-------------------------------------------------------------------
Local Machine Information::
Hostname: single122
ARU platform id: 226
ARU platform description:: Linux x86-64

Installed Top-level Products (1): 

Oracle Database 12c                                                 12.2.0.1.0
There are 1 products installed in this Oracle Home.
There are no Interim PATCH installed in this Oracle Home.
 -------------------------------------------------------------------


6) Vamos descompactar o RUR para aplicar no ambiente. 

su - oracle
cd /home/oracle/PATCH
unzip -q p26878187_122010_Linux-x86-64

7) Após a leitura do README do patch, vamos verificar a compatibilidade do patch.

su -
  
cd /home/oracle/PATCH/26878187
export GRID_HOME=/oracle/12.2.0.1/grid
export PATH=$PATH:/oracle/12.2.0.1/grid/OPatch


Abaixo um trecho do README que muitos ignoram mas eu gosto de fazer:

"Determine whether any currently installed one-off patches conflict with the Grid Infrastructure 12.2.0.1.171017 26878187 as follows:"

$GRID_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /home/oracle/PATCH/26878187/26518812
Exemplo de saída:
Oracle Interim Patch Installer version 12.2.0.1.11
Copyright (c) 2017, Oracle Corporation.  All rights reserved.
PREREQ session
Oracle Home       : /oracle/12.2.0.1/grid
Central Inventory : /oracle/app/oraInventory
 from              : /oracle/12.2.0.1/grid/oraInst.loc
OPatch version    : 12.2.0.1.11
OUI version       : 12.2.0.1.4

Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.

Fazer isso para todos os patches contidos no RUR, como informa o README.


-- Executando também o ANALYZE do patch.

$GRID_HOME/OPatch/opatchauto apply /home/oracle/PATCH/26878187 -analyze -oh /oracle/12.2.0.1/grid

Executing OPatch prereq operations to verify patch applicability on home /oracle/12.2.0.1/grid
Patch applicability verified successfully on home /oracle/12.2.0.1/grid
OPatchAuto successful.

--------------------------------Summary-----------------------------
Analysis for applying patches has completed successfully:
Host:single122
SIHA Home:/oracle/12.2.0.1/grid

==Following patches were SUCCESSFULLY analyzed to be applied:

Patch: /home/oracle/PATCH/26878187/26878137
Log: /oracle/12.2.0.1/grid/cfgtoollogs/opatchauto/core/opatch/opatch2017-11-08_15-17-24PM_1.log

Patch: /home/oracle/PATCH/26878187/25586399
Log: /oracle/12.2.0.1/grid/cfgtoollogs/opatchauto/core/opatch/opatch2017-11-08_15-17-24PM_1.log

Patch: /home/oracle/PATCH/26878187/26839277
Log: /oracle/12.2.0.1/grid/cfgtoollogs/opatchauto/core/opatch/opatch2017-11-08_15-17-24PM_1.log

Patch: /home/oracle/PATCH/26878187/26928563
Log: /oracle/12.2.0.1/grid/cfgtoollogs/opatchauto/core/opatch/opatch2017-11-08_15-17-24PM_1.log

Patch: /home/oracle/PATCH/26878187/26518812
Log: /oracle/12.2.0.1/grid/cfgtoollogs/opatchauto/core/opatch/opatch2017-11-08_15-17-24PM_1.log

OPatchauto session completed at Wed Nov  8 15:18:25 2017
Time taken to complete the session 1 minute, 30 seconds


8) Após verificar a compatibilidade, podemos aplicar o patch.
su - oracle
$GRID_HOME/OPatch/opatchauto apply /home/oracle/PATCH/26878187

Exemplo de saída:
OPatchauto session is initiated at Wed Nov  8 15:50:25 2017

 ...
Preparing to bring down database service on home /oracle/app/oracle/product/12.2.0.1/dbhome_1
Successfully prepared home /oracle/app/oracle/product/12.2.0.1/dbhome_1 to bring down database service

Bringing down database service on home /oracle/app/oracle/product/12.2.0.1/dbhome_1
Following database has been stopped and will be restarted later during the session: hulk
Database service successfully brought down on home /oracle/app/oracle/product/12.2.0.1/dbhome_1

Bringing down CRS service on home /oracle/12.2.0.1/grid
Prepatch operation log file location: /oracle/app/oracle/crsdata/single122/crsconfig/hapatch_2017-11-08_03-52-57PM.log
CRS service brought down successfully on home /oracle/12.2.0.1/grid

Start applying binary patch on home /oracle/app/oracle/product/12.2.0.1/dbhome_1
Binary patch applied successfully on home /oracle/app/oracle/product/12.2.0.1/dbhome_1

Start applying binary patch on home /oracle/12.2.0.1/grid
Binary patch applied successfully on home /oracle/12.2.0.1/grid

Starting CRS service on home /oracle/12.2.0.1/grid
Postpatch operation log file location: /oracle/app/oracle/crsdata/single122/crsconfig/hapatch_2017-11-08_04-03-13PM.log
CRS service started successfully on home /oracle/12.2.0.1/grid

Starting database service on home /oracle/app/oracle/product/12.2.0.1/dbhome_1
Database service successfully started on home /oracle/app/oracle/product/12.2.0.1/dbhome_1

Preparing home /oracle/app/oracle/product/12.2.0.1/dbhome_1 after database service restarted
No step execution required.........
Prepared home /oracle/app/oracle/product/12.2.0.1/dbhome_1 successfully after database service restarted

Trying to apply SQL patch on home /oracle/app/oracle/product/12.2.0.1/dbhome_1
SQL patch applied successfully on home /oracle/app/oracle/product/12.2.0.1/dbhome_1

OPatchAuto successful.

--------------------------------Summary----------------------------
Patching is completed successfully. Please find the summary as follows:

Host:single122
SIDB Home:/oracle/app/oracle/product/12.2.0.1/dbhome_1
Summary:

==Following patches were SKIPPED:
Patch: /home/oracle/PATCH/26878187/25586399
Reason: This patch is not applicable to this specified target type - "oracle_database"

Patch: /home/oracle/PATCH/26878187/26839277
Reason: This patch is not applicable to this specified target type - "oracle_database"

Patch: /home/oracle/PATCH/26878187/26928563
Reason: This patch is not applicable to this specified target type - "oracle_database"


==Following patches were SUCCESSFULLY applied:
Patch: /home/oracle/PATCH/26878187/26518812
Log: /oracle/app/oracle/product/12.2.0.1/dbhome_1/cfgtoollogs/opatchauto/core/opatch/opatch2017-11-08_15-53-23PM_1.log

Patch: /home/oracle/PATCH/26878187/26878137
Log: /oracle/app/oracle/product/12.2.0.1/dbhome_1/cfgtoollogs/opatchauto/core/opatch/opatch2017-11-08_15-53-23PM_1.log


Host:single122
SIHA Home:/oracle/12.2.0.1/grid
Summary:

==Following patches were SUCCESSFULLY applied:
Patch: /home/oracle/PATCH/26878187/25586399
Log: /oracle/12.2.0.1/grid/cfgtoollogs/opatchauto/core/opatch/opatch2017-11-08_15-56-27PM_1.log

Patch: /home/oracle/PATCH/26878187/26518812
Log: /oracle/12.2.0.1/grid/cfgtoollogs/opatchauto/core/opatch/opatch2017-11-08_15-56-27PM_1.log

Patch: /home/oracle/PATCH/26878187/26839277
Log: /oracle/12.2.0.1/grid/cfgtoollogs/opatchauto/core/opatch/opatch2017-11-08_15-56-27PM_1.log

Patch: /home/oracle/PATCH/26878187/26878137
Log: /oracle/12.2.0.1/grid/cfgtoollogs/opatchauto/core/opatch/opatch2017-11-08_15-56-27PM_1.log

Patch: /home/oracle/PATCH/26878187/26928563
Log: /oracle/12.2.0.1/grid/cfgtoollogs/opatchauto/core/opatch/opatch2017-11-08_15-56-27PM_1.log

OPatchauto session completed at Wed Nov  8 16:06:49 2017
Time taken to complete the session 16 minutes, 24 seconds


9) Agora basta fazer as verificações.

su - oracle

-- Verificar se todos os serviços e databases estão no ar
####################################### CRSSTAT OUTPUT ###############################################
DATE: Wed Nov  8 16:54:38 BRST 2017  
######################################################################################################
COLOR CODES: HEADER  CONTENT  ALERT  ORACLE_SID 
######################################################################################################
  NAME               TYPE        VERSION        STATE                TARGET   LAST_RESTART         STATE 
  ----               ----        -------        -----                ------   ------------         --------
  ora.asm            asm         asm            ONLINE on single122  ONLINE   11/08/2017 16:04:34  STABLE 
  ora.cssd           cssd        SERVER_POOLS=  ONLINE on single122  ONLINE   11/08/2017 16:04:19  STABLE 
  ora.hulk.db        database    SERVER_POOLS=  ONLINE on single122  ONLINE   11/08/2017 16:05:00  STABLE 
  ora.FRA.dg         diskgroup   diskgroup      ONLINE on single122  ONLINE   11/08/2017 16:04:33  STABLE 
  ora.REDO.dg        diskgroup   diskgroup      ONLINE on single122  ONLINE   11/08/2017 16:04:33  STABLE 
  ora.DATA.dg        diskgroup   diskgroup      ONLINE on single122  ONLINE   11/08/2017 16:04:34  STABLE 
  ora.TESTE.dg       diskgroup   diskgroup      ONLINE on single122  ONLINE   11/08/2017 16:04:34  STABLE 
  ora.diskmon        diskmon     SERVER_POOLS=  OFFLINE              OFFLINE  11/08/2017 16:04:07  STABLE 
  ora.driver.afd     driver.afd  SERVER_POOLS=  ONLINE on single122  ONLINE   NEVER                STABLE 
  ora.evmd           evm         SERVER_POOLS=  ONLINE on single122  ONLINE   11/08/2017 16:04:03  STABLE 
  ora.LISTENER.lsnr  listener    listener       ONLINE on single122  ONLINE   11/08/2017 16:04:07  STABLE 
  ora.ons            ons         ons            OFFLINE              OFFLINE  NEVER                STABLE 
  

10) Verificando a aplicação do patch 

$ORACLE_HOME/OPatch/opatch lsinventory
Oracle Interim Patch Installer version 12.2.0.1.11
Copyright (c) 2017, Oracle Corporation.  All rights reserved.

Oracle Home       : /oracle/app/oracle/product/12.2.0.1/dbhome_1

Central Inventory : /oracle/app/oraInventory
   from           : /oracle/app/oracle/product/12.2.0.1/dbhome_1/oraInst.loc
OPatch version    : 12.2.0.1.11
OUI version       : 12.2.0.1.4
Log file location : /oracle/app/oracle/product/12.2.0.1/dbhome_1/cfgtoollogs/opatch/opatch2017-11-08_16-56-29PM_1.log

Lsinventory Output file location : /oracle/app/oracle/product/12.2.0.1/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2017-11-08_16-56-29PM.txt


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

Local Machine Information::
Hostname: single122
ARU platform id: 226
ARU platform description:: Linux x86-64

Installed Top-level Products (1): 


Oracle Database 12c                                                  12.2.0.1.0

There are 1 products installed in this Oracle Home.

Interim patches (2) :


Patch  26878137     : applied on Wed Nov 08 15:56:17 BRST 2017

Unique Patch ID:  21594430
Patch description:  "OCW JUL2017 RELEASE UPDATE REVISION : 12.2.0.1.171017  (26878137)"
   Created on 27 Sep 2017, 06:10:39 hrs PST8PDT
   Bugs fixed:
26144044, 25541343, 25715179, 25493588, 24932026, 24801915, 25832375
25728787, 25825732, 24578464, 25832312, 25742471, 25790699, 25655495
25307145, 25485737, 25505841, 25697364, 24663993, 25026470, 25591658
25537905, 24451580, 25409838, 25371632, 25569634, 25245759, 24665035
25646592, 25025157, 24732650, 24664849, 24584419, 24423011, 24831158
25037836, 25556203, 24464953, 24657753, 25197670, 24796183, 20559126
25197395, 24808260, 26546632

Patch  26518812     : applied on Wed Nov 08 15:55:18 BRST 2017

Unique Patch ID:  21611172
Patch description:  "Database Jul 2017 Release Update Revision : 12.2.0.1.171017 (26518812)"
   Created on 4 Oct 2017, 18:39:53 hrs PST8PDT
   Bugs fixed:
23026585, 24336249, 24929210, 24942749, 25036474, 25110233, 25410877
25417050, 25427662, 25459958, 25547901, 25569149, 25600342, 25600421
25606091, 25655390, 25662088, 24385983, 24923215, 25099758, 25429959
25662101, 25728085, 25823754, 22594071, 23665623, 23749454, 24326846
24334708, 24560906, 24573817, 24578797, 24609996, 24624166, 24668398
24674955, 24744686, 24811725, 24827228, 24831514, 24908321, 24976007
25184555, 25210499, 25211628, 25223839, 25262869, 25316758, 25337332
25455795, 25457409, 25539063, 25546608, 25612095, 25643931, 25410017
22729345, 24485174, 24509056, 24714096, 25329664, 25410180, 25607726
25957038, 25973152, 26024732, 24376878, 24589590, 24676172, 23548817
24796092, 24907917, 25044977, 25736747, 25766822, 25856821, 25051628
24534401, 24835919, 25050160, 25395696, 25430120, 25616359, 25715167
25967985, 26546754, 26546664, 26544823, 26575788, 25489607, 25654936
25947799, 26271001, 26526726, 25980770
--------------------------------------------------------------------------------
OPatch succeeded.


E é isso, agora estamos com o último RUR aplicado em nosso ambiente.

Espero que ajude.

Abraço
Mario

Postagem em destaque

[ORACLE] Batch change EDITIONABLE property.

Hello everyone. Hope you're doing well! Today, I have a simple case.   A test database had many database objects with the EDITIONABLE pr...