Introdução
Out-Of-Place Patching é a abordagem onde criamos um Oracle Home secundário e instalamos o patch neste novo Oracle Home, usando o OPatch ou OPacthAuto. Após isso, os serviços do Oracle podem ser baixados (shutdown) no Oracle Home antigo e reiniciados (startup) no Oracle Home novo, já com os patches instalados no binário.
Essa estratégia diminui o downtime no banco de dados durante a aplicação de patches, tendo indisponibilidade apenas por alguns segundos durante o restart dos serviços. Essa estratégia aplica-se mesmo para os cenários envolvendo patch OJVM, onde não há mais o requisito de colocar o banco em modo upgrade para executar o Pós-Install desde Jan2017. A nota 2217053.1 apresenta algumas recomendações adcionais para instalação de patch OJVM com downtime mínimo (Obrigado pela dica, Rodrigo Jorge!).
Para entender melhor, considere os seguintes tempos de downtime associados com os exemplos a seguir.
Cenário 1: Uma aplicação de patch In-Place (direto no Oracle Home existente), considerando que o processo do OPatch levaria aproximadamente 18 minutos:
- 19:00h –> Shutdown no banco (início downtime)
- 19:01h –> Início sessão do OPatch instalando patch no binário ORIGINAL
- 19:19h –> Fim da sessão do OPatch
- 19:20h –> Startup no banco (fim do downtime)
- 19:21h –> Execução do SQL Patch (datapatch)
Cenário 2: Uma aplicação de patch Out-Of-Place, considerando que o tempo para clonar o Oracle Home seria de aproximadamente 30 minutos e o tempo de execução do OPatch seria de 18 minutos:
- 18:30h –> Inicio da clonagem do Oracle Home (cria um novo, clonando o original)
- 19:00h –> Inicia a sessão do OPatch instalando o patch no binário NOVO
- 19:19h –> Shutdown no banco rodando no Oracle Home ANTIGO (início do downtime)
- 19:20h –> Startup no banco usando o Oracle Home NOVO (fim do downtime)
- 19:21h –> Execução do SQL Patch (datapatch)
Note que na estratégia Out-Of-Place há um aumento no tempo total da atividade, mas há uma redução considerável no tempo que o banco de dados fica indisponível. Idealmente, afim de ter mais controle sobre a janela de manutenção, uma boa estratégia é realizar a clonagem do Oracle Home e instalação do patch nos binários com algumas horas (ou dias) de antecedência, deixando apenas a reinicialização da instância e execução do pós patch dentro da janela de manutenção.
Etapas 1 e 2 executadas antes da janela:


Este post apresenta alguns exemplos práticos sobre como usar essa estratégia em aplicação de patches no Oracle Grid Infrastructure e no Oracle Database, abordando a opção de automação nativa do OPatchAuto, disponível a partir da versão 12cR2. Também será demonstrado como realizar o procedimento de forma manual em versões que não há a opção de Out-Of-Place automatizada.
Pré Requisitos
Para executar os passos a seguir, assume-se que o leitor possui conhecimento básico sobre aplicação de patches em Oracle Database na sua forma mais simples, dessa forma, não será mostrado os seguintes passos básicos:
- Download do patch do My Oracle Support
- Cópia do patch para o servidor
- Descompactação do patch em um diretório no servidor
- Atualização de versão do OPatch dentro do Oracle Home (nos exemplos, os OPatch já estão atualizados)
Out-Of-Place Patching no Grid Infrastructure com OPatchAuto (automação)
Tradicionalmente, o processo de Out-Of-Place Patching é realizado por um processo manual de clonar o Oracle Home existente (cópia do diretório existente para um novo) e execução do script clone.pl ou runInstaller.sh para registrar o novo Oracle Home no invetário de software Oracle (OraInventory), além do processo para aplicar o patch em si. Por outro lado, o OPatchAuto (automação do OPatch) já possui uma opção nativa “-outofplace” para automatizar todo esse procedimento, a apartir da versão 12cR2 do Grid Infrastructure.
Setando as variáveis de ambiente para o Home do Grid Infrastructure:
[root@lab01 ~]# . oraenv <<< +ASM
ORACLE_SID = [+ASM] ? The Oracle base remains unchanged with value /u01/app/grid
[root@lab01 ~]#
[root@lab01 ~]# export PATH=$ORACLE_HOME/OPatch:$PATH
[root@lab01 ~]#
[root@lab01 ~]# echo $ORACLE_HOME
/u01/app/product/19.0.0.0/grid
[root@lab01 ~]# echo $ORACLE_BASE
/u01/app/grid
[root@lab01 ~]#
Checando o Release Update atual (19.3.0.0.0):
[root@lab01 ~]# crsctl query has releasepatch
Oracle Clusterware release patch level is [724960844] and the complete list of patches [29401763 29517242 29517247 29585399 ] have been applied on the local node. The release patch string is [19.3.0.0.0].
Executando o precheck do patch usando o parâmetro -outofplace e o diretório do Grid Home atual sendo informado no parâmetro -oh. Note que logo após a mensagem “The id for this session is”, o opatchauto apresenta o caminho do novo Grid Home que será criado, podemos pressionar ENTER para aceitar a sugestão ou informar um outro diretório desejado, aqui estou informando “/u01/app/product/19.12.0.0/grid” como novo Grid Home a ser criado.
Comando:
opatchauto apply -outofplace -oh /u01/app/product/19.0.0.0/grid -analyze
Exemplo:
[root@lab01 ~]# cd /tmp/32895426/
[root@lab01 32895426]#
[root@lab01 32895426]# opatchauto apply -outofplace -oh /u01/app/product/19.0.0.0/grid -analyze
OPatchauto session is initiated at Tue Dec 28 21:50:35 2021
System initialization log file is /u01/app/product/19.0.0.0/grid/cfgtoollogs/opatchautodb/systemconfig2021-12-28_09-50-38PM.log.
Session log file is /u01/app/product/19.0.0.0/grid/cfgtoollogs/opatchauto/opatchauto2021-12-28_09-50-42PM.log
The id for this session is UDKG
Please press ENTER button to accept system generated default clone path.
Please enter clone path [/u01/app/product/19.0.0.0/grid_2 ] :
/u01/app/product/19.12.0.0/grid
Executing OPatch prereq operations to verify patch applicability on home /u01/app/product/19.0.0.0/grid
Patch applicability verified successfully on home /u01/app/product/19.0.0.0/grid
Executing patch validation checks on home /u01/app/product/19.0.0.0/grid
Patch validation checks successfully completed on home /u01/app/product/19.0.0.0/grid
OPatchAuto successful.
--------------------------------Summary--------------------------------
Out of place patching clone home(s) summary
____________________________________________
Host : lab01
Actual Home : /u01/app/product/19.0.0.0/grid
Version:19.0.0.0.0
Clone Home Path : /u01/app/product/19.12.0.0/grid
Analysis for applying patches has completed successfully:
Host:lab01
SIHA Home:/u01/app/product/19.0.0.0/grid
Version:19.0.0.0.0
==Following patches were SUCCESSFULLY analyzed to be applied:
Patch: /tmp/32895426/32916816
Log: /u01/app/product/19.0.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-12-28_21-51-14PM_1.log
Patch: /tmp/32895426/32915586
Log: /u01/app/product/19.0.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-12-28_21-51-14PM_1.log
Patch: /tmp/32895426/32585572
Log: /u01/app/product/19.0.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-12-28_21-51-14PM_1.log
Patch: /tmp/32895426/32918050
Log: /u01/app/product/19.0.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-12-28_21-51-14PM_1.log
Patch: /tmp/32895426/32904851
Log: /u01/app/product/19.0.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-12-28_21-51-14PM_1.log
OPatchauto session completed at Tue Dec 28 21:51:30 2021
Time taken to complete the session 0 minute, 55 seconds
Precheck realizado com sucesso, podemos seguir com a aplicação do patch, o comando utilizado é o mesmo, removendo apenas o -analyze :
opatchauto apply -outofplace -oh /u01/app/product/19.0.0.0/grid
Exemplo:
[root@lab01 32895426]# opatchauto apply -outofplace -oh /u01/app/product/19.0.0.0/grid
OPatchauto session is initiated at Tue Dec 28 21:51:55 2021
System initialization log file is /u01/app/product/19.0.0.0/grid/cfgtoollogs/opatchautodb/systemconfig2021-12-28_09-51-57PM.log.
Session log file is /u01/app/product/19.0.0.0/grid/cfgtoollogs/opatchauto/opatchauto2021-12-28_09-52-01PM.log
The id for this session is J4WP
Please press ENTER button to accept system generated default clone path.
Please enter clone path [/u01/app/product/19.0.0.0/grid_2 ] :
/u01/app/product/19.12.0.0/grid
Executing OPatch prereq operations to verify patch applicability on home /u01/app/product/19.0.0.0/grid
Patch applicability verified successfully on home /u01/app/product/19.0.0.0/grid
Executing patch validation checks on home /u01/app/product/19.0.0.0/grid
Patch validation checks successfully completed on home /u01/app/product/19.0.0.0/grid
Copying the files from the existing oracle home /u01/app/product/19.0.0.0/grid to a new location. Please wait...
Clone of oracle home /u01/app/product/19.0.0.0/grid is /u01/app/product/19.12.0.0/grid on host lab01
Copying the files from the existing oracle home /u01/app/product/19.0.0.0/grid to a new location is successful.
Unlocking CRS clone home for home /u01/app/product/19.0.0.0/grid.
Prepatch operation log file location: /u01/app/grid/crsdata/lab01/crsconfig/hapatch_2021-12-28_09-53-21PM.log
Unlocked CRS clone home successfully for home /u01/app/product/19.0.0.0/grid.
Creating clone for oracle home /u01/app/product/19.0.0.0/grid.
Clone operation successful for oracle home /u01/app/product/19.0.0.0/grid.
Performing post clone operation for oracle home /u01/app/product/19.0.0.0/grid.
Performing post clone operation was successful for oracle home /u01/app/product/19.12.0.0/grid.
Start applying binary patch on home /u01/app/product/19.12.0.0/grid
Binary patch applied successfully on home /u01/app/product/19.12.0.0/grid
Update nodelist in the inventory for oracle home /u01/app/product/19.12.0.0/grid.
Update nodelist in the inventory is completed for oracle home /u01/app/product/19.12.0.0/grid.
Performing postpatch operations on CRS - starting CRS service on home /u01/app/product/19.12.0.0/grid
Postpatch operation log file location: /u01/app/grid/crsdata/lab01/crsconfig/hapatch_2021-12-28_10-00-49PM.log
CRS service started successfully on home /u01/app/product/19.12.0.0/grid
Confirm that all resources have been started from home /u01/app/product/19.12.0.0/grid.
All resources have been started successfully from home /u01/app/product/19.12.0.0/grid.
OPatchAuto successful.
--------------------------------Summary--------------------------------
Patching is completed successfully. Please find the summary as follows:
Host:lab01
SIHA Home:/u01/app/product/19.0.0.0/grid
Version:19.0.0.0.0
Summary:
==Following patches were SUCCESSFULLY applied:
Patch: /tmp/32895426/32585572
Log: /u01/app/product/19.12.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-12-28_21-54-01PM_1.log
Patch: /tmp/32895426/32904851
Log: /u01/app/product/19.12.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-12-28_21-54-01PM_1.log
Patch: /tmp/32895426/32915586
Log: /u01/app/product/19.12.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-12-28_21-54-01PM_1.log
Patch: /tmp/32895426/32916816
Log: /u01/app/product/19.12.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-12-28_21-54-01PM_1.log
Patch: /tmp/32895426/32918050
Log: /u01/app/product/19.12.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-12-28_21-54-01PM_1.log
Patching session reported following warning(s):
_________________________________________________
[Note]: Please verify the database is running from the desired Oracle home, if not then manually execute
$ORACLE_HOME/bin/srvctl modify database command to fix the problem
Out of place patching clone home(s) summary
____________________________________________
Host : lab01
Actual Home : /u01/app/product/19.0.0.0/grid
Version:19.0.0.0.0
Clone Home Path : /u01/app/product/19.12.0.0/grid
OPatchauto session completed at Tue Dec 28 22:02:16 2021
Apply finalizado com sucesso. Validando o ambiente, verificando que o arquivo /etc/oratab já foi atualizado automaticamente durante o processo:
[root@lab01 32895426]# grep +ASM /etc/oratab
+ASM:/u01/app/product/19.12.0.0/grid:N # line added by Agent
Consultando o release update registrado no Grid:
[root@lab01 32895426]# . oraenv <<< +ASM
ORACLE_SID = [+ASM] ? The Oracle base remains unchanged with value /u01/app/grid
[root@lab01 32895426]#
[root@lab01 32895426]# crsctl query has releasepatch
Oracle Clusterware release patch level is [3998055650] and the complete list of patches [32585572 32904851 32915586 32916816 32918050 ] have been applied on the local node. The release patch string is [19.12.0.0.0].
NOTA: É possível criar um responsefile contendo o mapeamento dos Oracle Home e executar o comando opatchauto com o parâmetro -silent.
Out-Of-Place Patching no Oracle Database com OPatchAuto (automação)
Também é possível usar o OPatchAuto para automatizar a aplicação de patch nos DB homes usando a abordagem Out-Of-Place. Na verdade, se não for especificado o parâmetro “-oh”, o OPatchAuto tentará aplicar o patch em todos os Oracle Homes registrados no servidor e que sejam da versão para o qual o patch foi lançado.
O comando utilizado é o mesmo que para o Grid, mudando apenas o diretório do Oracle Home:
opatchauto apply -outofplace -oh /u01/app/oracle/product/19.0.0.0/db_1 -analyze
Exemplo do precheck:
[root@lab01 32895426]# opatchauto apply -outofplace -oh /u01/app/oracle/product/19.0.0.0/db_1 -analyze
OPatchauto session is initiated at Tue Dec 28 22:45:03 2021
System initialization log file is /u01/app/oracle/product/19.0.0.0/db_1/cfgtoollogs/opatchautodb/systemconfig2021-12-28_10-45-06PM.log.
Session log file is /u01/app/oracle/product/19.0.0.0/db_1/cfgtoollogs/opatchauto/opatchauto2021-12-28_10-45-09PM.log
The id for this session is ADIA
Please press ENTER button to accept system generated default clone path.
Please enter clone path [/u01/app/oracle/product/19.0.0.0/db_3 ] :
/u01/app/oracle/product/19.12.0.0/db_1
Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/19.0.0.0/db_1
Patch applicability verified successfully on home /u01/app/oracle/product/19.0.0.0/db_1
Executing patch validation checks on home /u01/app/oracle/product/19.0.0.0/db_1
Patch validation checks successfully completed on home /u01/app/oracle/product/19.0.0.0/db_1
Verifying SQL patch applicability on home /u01/app/oracle/product/19.0.0.0/db_1
SQL patch applicability verified successfully on home /u01/app/oracle/product/19.0.0.0/db_1
OPatchAuto successful.
--------------------------------Summary--------------------------------
Out of place patching clone home(s) summary
____________________________________________
Host : lab01
Actual Home : /u01/app/oracle/product/19.0.0.0/db_1
Version:19.0.0.0.0
Clone Home Path : /u01/app/oracle/product/19.12.0.0/db_1
Analysis for applying patches has completed successfully:
Host:lab01
SIDB Home:/u01/app/oracle/product/19.0.0.0/db_1
Version:19.0.0.0.0
==Following patches were SKIPPED:
Patch: /tmp/patch/32895426/32915586
Reason: This patch is not applicable to this specified target type - "oracle_database"
Patch: /tmp/patch/32895426/32585572
Reason: This patch is not applicable to this specified target type - "oracle_database"
Patch: /tmp/patch/32895426/32918050
Reason: This patch is not applicable to this specified target type - "oracle_database"
==Following patches were SUCCESSFULLY analyzed to be applied:
Patch: /tmp/patch/32895426/32916816
Log: /u01/app/oracle/product/19.0.0.0/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2021-12-28_22-45-39PM_1.log
Patch: /tmp/patch/32895426/32904851
Log: /u01/app/oracle/product/19.0.0.0/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2021-12-28_22-45-39PM_1.log
OPatchauto session completed at Tue Dec 28 22:46:34 2021
Time taken to complete the session 1 minute, 31 seconds
Exemplo do apply (sem o parâmetro -analyze)
[root@lab01 32895426]# opatchauto apply -outofplace -oh /u01/app/oracle/product/19.0.0.0/db_1
OPatchauto session is initiated at Tue Dec 28 23:03:49 2021
System initialization log file is /u01/app/oracle/product/19.0.0.0/db_1/cfgtoollogs/opatchautodb/systemconfig2021-12-28_11-03-52PM.log.
Session log file is /u01/app/oracle/product/19.0.0.0/db_1/cfgtoollogs/opatchauto/opatchauto2021-12-28_11-03-55PM.log
The id for this session is L46L
Please press ENTER button to accept system generated default clone path.
Please enter clone path [/u01/app/oracle/product/19.0.0.0/db_3 ] :
/u01/app/oracle/product/19.12.0.0/db_1
Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/19.0.0.0/db_1
Patch applicability verified successfully on home /u01/app/oracle/product/19.0.0.0/db_1
Executing patch validation checks on home /u01/app/oracle/product/19.0.0.0/db_1
Patch validation checks successfully completed on home /u01/app/oracle/product/19.0.0.0/db_1
Verifying SQL patch applicability on home /u01/app/oracle/product/19.0.0.0/db_1
SQL patch applicability verified successfully on home /u01/app/oracle/product/19.0.0.0/db_1
Copying the files from the existing oracle home /u01/app/oracle/product/19.0.0.0/db_1 to a new location. Please wait...
Clone of oracle home /u01/app/oracle/product/19.0.0.0/db_1 is /u01/app/oracle/product/19.12.0.0/db_1 on host lab01
Copying the files from the existing oracle home /u01/app/oracle/product/19.0.0.0/db_1 to a new location is successful.
Creating clone for oracle home /u01/app/oracle/product/19.0.0.0/db_1.
Clone operation successful for oracle home /u01/app/oracle/product/19.0.0.0/db_1.
Performing post clone operation for oracle home /u01/app/oracle/product/19.0.0.0/db_1.
Performing post clone operation was successful for oracle home /u01/app/oracle/product/19.12.0.0/db_1.
Start applying binary patch on home /u01/app/oracle/product/19.12.0.0/db_1
Binary patch applied successfully on home /u01/app/oracle/product/19.12.0.0/db_1
Bringing down database service on home /u01/app/oracle/product/19.12.0.0/db_1
Database service successfully brought down on home /u01/app/oracle/product/19.12.0.0/db_1
Bringing down database service on home /u01/app/oracle/product/19.12.0.0/db_1
Following database has been stopped and will be restarted later during the session: db19c
Database service successfully brought down on home /u01/app/oracle/product/19.12.0.0/db_1
Starting database service on home /u01/app/oracle/product/19.12.0.0/db_1
Database service successfully started on home /u01/app/oracle/product/19.12.0.0/db_1
Preparing home /u01/app/oracle/product/19.12.0.0/db_1 after database service restarted
No step execution required.........
Modifying the database(s) to use new location home /u01/app/oracle/product/19.12.0.0/db_1.
All database(s) modified successfully to run from new location home /u01/app/oracle/product/19.12.0.0/db_1.
Trying to apply SQL patch on home /u01/app/oracle/product/19.12.0.0/db_1
"/bin/sh -c 'cd /u01/app/oracle/product/19.12.0.0/db_1;ORACLE_HOME=/u01/app/oracle/product/19.12.0.0/db_1 ORACLE_SID=db19c /u01/app/oracle/product/19.12.0.0/db_1/OPatch/datapatch -verbose'" command failed with errors. Please refer to logs for more details. SQL changes, if any, can be applied by manually retrying the same command.
SQL patch applied successfully on home /u01/app/oracle/product/19.12.0.0/db_1
OPatchAuto successful.
--------------------------------Summary--------------------------------
Patching is completed successfully. Please find the summary as follows:
Host:lab01
SIDB Home:/u01/app/oracle/product/19.0.0.0/db_1
Version:19.0.0.0.0
Summary:
==Following patches were SKIPPED:
Patch: /tmp/patch/32895426/32915586
Reason: This patch is not applicable to this specified target type - "oracle_database"
Patch: /tmp/patch/32895426/32585572
Reason: This patch is not applicable to this specified target type - "oracle_database"
Patch: /tmp/patch/32895426/32918050
Reason: This patch is not applicable to this specified target type - "oracle_database"
==Following patches were SUCCESSFULLY applied:
Patch: /tmp/patch/32895426/32904851
Log: /u01/app/oracle/product/19.12.0.0/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2021-12-28_23-06-27PM_1.log
Patch: /tmp/patch/32895426/32916816
Log: /u01/app/oracle/product/19.12.0.0/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2021-12-28_23-06-27PM_1.log
Out of place patching clone home(s) summary
____________________________________________
Host : lab01
Actual Home : /u01/app/oracle/product/19.0.0.0/db_1
Version:19.0.0.0.0
Clone Home Path : /u01/app/oracle/product/19.12.0.0/db_1
OPatchauto session completed at Tue Dec 28 23:30:51 2021
Time taken to complete the session 27 minutes, 2 seconds
Validando o banco de dados:
[root@lab01 32895426]# su - oracle
[oracle@lab01 ~]$ . oraenv <<< db19c
ORACLE_SID = [cdbsoe] ? The Oracle base remains unchanged with value /u01/app/oracle
[oracle@lab01 ~]$
[oracle@lab01 ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Dec 28 23:40:43 2021
Version 19.12.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.12.0.0.0
SQL>
O Oracle Home foi atualizado no recurso do banco de dados no Grid:
[oracle@lab01 ~]$ srvctl config database -d db19c | grep home
Oracle home: /u01/app/oracle/product/19.12.0.0/db_1
O arquivo /etc/oratab foi atualizado:
[oracle@lab01 ~]$ grep db19c /etc/oratab
db19c:/u01/app/oracle/product/19.12.0.0/db_1:N # line added by Agent
Out-Of-Place Patching no Grid Infrastructure 12cR1 (manual)
O processo de Out-Of-Place patching em DB Home é relativamente simples, por outro lado, executar essa abordagem no Grid Infrastructure envolve um pouco mais de complexidade e requer mais atenção nos passos sendo realizados. O exemplo abaixo é baseado em uma instalação Standalone do Grid, no caso de uma instalação FullStack (exemplo, quando usando RAC), deve ser utilizado o script “rootcrs” ao invés de “roothas”.
| Tipo de instalação | Standalone Server |
| Oracle Home original | /u01/app/product/12.1.0.2/grid |
| Oracle Home que será criado | /u01/app/product/12.1.0.2/grid_2 |
| Diretório do patch | /u01/29699244/29698592/29494060 |
Durante a clonagem do Grid Home e DB home, é necessário informar o caminho do oraInventory em alguns comandos, você pode identificar o caminho correto consultando o arquivo /etc/oraInst.loc, exemplo:
cat /etc/oraInst.loc
inventory_loc=/u01/app/oraInventory
inst_group=oinstall
G1) Com o usuário root, crie uma cópia do diretório do Grid Home atual:
# cd $ORACLE_HOME/..
# cp -r grid grid_2
G2) Altere as permissões do diretório recém criado:
# chown -R grid.oinstall grid_2
# chmod -R 775 grid_2
G3) Com usuário grid, execute o script clone.pl a partir do novo Grid Home sendo clonado:
$ export ORACLE_BASE=/u01/app/grid
$ export ORACLE_HOME=/u01/app/product/12.1.0.2/grid_2
$ cd $ORACLE_HOME/clone/bin
$ $ORACLE_HOME/perl/bin/perl clone.pl ORACLE_BASE=$ORACLE_BASE ORACLE_HOME=$ORACLE_HOME INVENTORY_LOCATION=/u01/app/oraInventory -defaultHomeName
NOTA: Não é necessário executar o script root.sh ao final do processo.
G4) Aplique o patch desejado no novo Grid Home:
$ export PATH=$ORACLE_HOME/OPatch:$PATH
$ opatch apply /u01/29699244/29698592/29494060
Dica: No caso de um 12cR1, essa etapa pode seria ser realizada como OPatchAuto, usando a opção “-binary” para aplicar um System Patch completo no Grid Home (RDBMS, ACFS, OCW, etc). Nesta demonstração, estamos aplicando apenas um patch e usando o OPatch para tornar o exemplo mais simples.
G5) Com o usuário root, ajuste as variáveis de ambiente para o Grid Home atual e pare os serviços do Grid com o script roothas.sh, usando a opção “-prepatch“:
# . oraenv <<< +ASM
# $ORACLE_HOME/crs/install/roothas.sh -prepatch
G6) Com usuário root, inicie os serviços do Grid no novo Oracle Home:
# export ORACLE_BASE=/u01/app/grid
# export ORACLE_HOME=/u01/app/product/12.1.0.2/grid_2
# $ORACLE_HOME/rdbms/install/rootadd_rdbms.sh
# cd $ORACLE_HOME/crs/install
# $ORACLE_HOME/perl/bin/perl roothas.pl -postpatch -dstcrshome $ORACLE_HOME
Exemplo:
[root@lab05 u01]# ps -ef | grep d.bin
grid 1473 1 0 22:15 ? 00:00:01 /u01/app/product/12.1.0.2/grid/bin/ohasd.bin reboot
grid 1916 1 0 22:15 ? 00:00:01 /u01/app/product/12.1.0.2/grid/bin/oraagent.bin
grid 1930 1 0 22:15 ? 00:00:00 /u01/app/product/12.1.0.2/grid/bin/evmd.bin
grid 1951 1930 0 22:15 ? 00:00:00 /u01/app/product/12.1.0.2/grid/bin/evmlogger.bin -o /u01/app/product/12.1.0.2/grid/log/[HOSTNAME]/evmd/evmlogger.info -l /u01/app/product/12.1.0.2/grid/log/[HOSTNAME]/evmd/evmlogger.log
grid 1956 1 0 22:15 ? 00:00:00 /u01/app/product/12.1.0.2/grid/bin/tnslsnr LISTENER -no_crs_notify -inherit
grid 1968 1 0 22:15 ? 00:00:00 /u01/app/product/12.1.0.2/grid/bin/cssdagent
grid 1991 1 0 22:15 ? 00:00:00 /u01/app/product/12.1.0.2/grid/bin/ocssd.bin
grid 6706 2447 0 22:20 pts/1 00:00:00 grep --color=auto d.bin
[root@lab05 u01]# cd /u01/app/product/12.1.0.2/
[root@lab05 12.1.0.2]#
[root@lab05 12.1.0.2]# cp -r grid grid_2
[root@lab05 12.1.0.2]#
[root@lab05 12.1.0.2]# chown -R grid.oinstall grid_2
[root@lab05 12.1.0.2]# chmod -R 775 grid_2
[root@lab05 12.1.0.2]#
[root@lab05 12.1.0.2]# su - grid
Last login: Wed Dec 29 22:16:47 -03 2021 on pts/1
[grid@lab05 ~]$
[grid@lab05 ~]$ export ORACLE_BASE=/u01/app/grid
[grid@lab05 ~]$ export ORACLE_HOME=/u01/app/product/12.1.0.2/grid_2
[grid@lab05 ~]$
[grid@lab05 ~]$ cd $ORACLE_HOME/clone/bin
[grid@lab05 bin]$
[grid@lab05 bin]$ $ORACLE_HOME/perl/bin/perl clone.pl ORACLE_BASE=$ORACLE_BASE ORACLE_HOME=$ORACLE_HOME INVENTORY_LOCATION=/u01/app/oraInventory -defaultHomeName
./runInstaller -clone -waitForCompletion "ORACLE_BASE=/u01/app/grid" "ORACLE_HOME=/u01/app/product/12.1.0.2/grid_2" "INVENTORY_LOCATION=/u01/app/oraInventory" -defaultHomeName -silent -paramFile /u01/app/product/12.1.0.2/grid_2/clone/clone_oraparam.ini
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 500 MB. Actual 3810 MB Passed
Checking swap space: must be greater than 500 MB. Actual 3071 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2021-12-29_10-17-25PM. Please wait ...You can find the log of this install session at:
/u01/app/oraInventory/logs/cloneActions2021-12-29_10-17-25PM.log
.................................................. 5% Done.
.................................................. 10% Done.
.................................................. 15% Done.
.................................................. 20% Done.
.................................................. 25% Done.
.................................................. 30% Done.
.................................................. 35% Done.
.................................................. 40% Done.
.................................................. 45% Done.
.................................................. 50% Done.
.................................................. 55% Done.
.................................................. 60% Done.
.................................................. 65% Done.
.................................................. 70% Done.
.................................................. 75% Done.
.................................................. 80% Done.
.................................................. 85% Done.
..........
Copy files in progress.
Copy files successful.
Link binaries in progress.
Link binaries successful.
Setup files in progress.
Setup files successful.
Setup Inventory in progress.
Setup Inventory successful.
Finish Setup successful.
The cloning of OraHome1 was successful.
Please check '/u01/app/oraInventory/logs/cloneActions2021-12-29_10-17-25PM.log' for more details.
Setup Oracle Base in progress.
Setup Oracle Base successful.
.................................................. 95% Done.
As a root user, execute the following script(s):
1. /u01/app/product/12.1.0.2/grid_2/root.sh
.................................................. 100% Done.
[grid@lab05 bin]$ echo $ORACLE_HOME
/u01/app/product/12.1.0.2/grid_2
[grid@lab05 bin]$ export PATH=$ORACLE_HOME/OPatch:$PATH
[grid@lab05 ~]$ opatch apply /u01/29699244/29698592/29494060
Oracle Interim Patch Installer version 12.2.0.1.17
Copyright (c) 2021, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/product/12.1.0.2/grid_2
Central Inventory : /u01/app/oraInventory
from : /u01/app/product/12.1.0.2/grid_2/oraInst.loc
OPatch version : 12.2.0.1.17
OUI version : 12.1.0.2.0
Log file location : /u01/app/product/12.1.0.2/grid_2/cfgtoollogs/opatch/opatch2021-12-29_23-19-21PM_1.log
Verifying environment and performing prerequisite checks...
--------------------------------------------------------------------------------
Start OOP by Prereq process.
Launch OOP...
Oracle Interim Patch Installer version 12.2.0.1.17
Copyright (c) 2021, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/product/12.1.0.2/grid_2
Central Inventory : /u01/app/oraInventory
from : /u01/app/product/12.1.0.2/grid_2/oraInst.loc
OPatch version : 12.2.0.1.17
OUI version : 12.1.0.2.0
Log file location : /u01/app/product/12.1.0.2/grid_2/cfgtoollogs/opatch/opatch2021-12-29_23-19-27PM_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 19769480 20299023 20831110 21359755 21948354 22291127 23054246 24006101 24732082 25171037 25755742 26609783 26713565 26925311 27338041 27547329 28259833 28729169 29141015 29494060
Do you want to proceed? [y|n]
Y (auto-answered by -silent)
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/product/12.1.0.2/grid_2')
Is the local system ready for patching? [y|n]
Y (auto-answered by -silent)
User Responded with: Y
Backing up files...
Applying sub-patch '19769480' to OH '/u01/app/product/12.1.0.2/grid_2'
ApplySession: Optional component(s) [ oracle.xdk, 12.1.0.2.0 ] , [ oracle.oraolap, 12.1.0.2.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.rdbms.deconfig, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.rdbms.util, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.xdk.parser.java, 12.1.0.2.0...
Patching component oracle.xdk.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.ldap.rsf, 12.1.0.2.0...
Patching component oracle.ldap.rsf.ic, 12.1.0.2.0...
Applying sub-patch '20299023' to OH '/u01/app/product/12.1.0.2/grid_2'
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.rdbms.deconfig, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.has.crs, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.rdbms.rsf.ic, 12.1.0.2.0...
Patching component oracle.ldap.rsf, 12.1.0.2.0...
Patching component oracle.ldap.rsf.ic, 12.1.0.2.0...
Applying sub-patch '20831110' to OH '/u01/app/product/12.1.0.2/grid_2'
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.oraolap.dbscripts, 12.1.0.2.0...
Patching component oracle.ldap.rsf, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Applying sub-patch '21359755' to OH '/u01/app/product/12.1.0.2/grid_2'
Patching component oracle.assistants.server, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Applying sub-patch '21948354' to OH '/u01/app/product/12.1.0.2/grid_2'
ApplySession: Optional component(s) [ oracle.xdk, 12.1.0.2.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.rdbms.deconfig, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.xdk.parser.java, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.xdk.rsf, 12.1.0.2.0...
Applying sub-patch '22291127' to OH '/u01/app/product/12.1.0.2/grid_2'
ApplySession: Optional component(s) [ oracle.oid.client, 12.1.0.2.0 ] , [ oracle.oraolap, 12.1.0.2.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.ldap.rsf, 12.1.0.2.0...
Patching component oracle.ldap.client, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.oraolap.dbscripts, 12.1.0.2.0...
Applying sub-patch '23054246' to OH '/u01/app/product/12.1.0.2/grid_2'
ApplySession: Optional component(s) [ oracle.rdbms.dv, 12.1.0.2.0 ] , [ oracle.ctx, 12.1.0.2.0 ] , [ oracle.xdk, 12.1.0.2.0 ] , [ oracle.ctx.atg, 12.1.0.2.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.ldap.rsf, 12.1.0.2.0...
Patching component oracle.install.deinstalltool, 12.1.0.2.0...
Patching component oracle.ldap.rsf.ic, 12.1.0.2.0...
Patching component oracle.oracore.rsf, 12.1.0.2.0...
Patching component oracle.nlsrtl.rsf, 12.1.0.2.0...
Patching component oracle.xdk.parser.java, 12.1.0.2.0...
Applying sub-patch '24006101' to OH '/u01/app/product/12.1.0.2/grid_2'
ApplySession: Optional component(s) [ oracle.rdbms.dv, 12.1.0.2.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.sqlplus, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.network.listener, 12.1.0.2.0...
Patching component oracle.network.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.sqlplus.ic, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Applying sub-patch '24732082' to OH '/u01/app/product/12.1.0.2/grid_2'
Patching component oracle.rdbms.install.plugins, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Applying sub-patch '25171037' to OH '/u01/app/product/12.1.0.2/grid_2'
Patching component oracle.sqlplus.ic, 12.1.0.2.0...
Patching component oracle.sqlplus, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.ordim.client, 12.1.0.2.0...
Patching component oracle.ordim.client, 12.1.0.2.0...
Patching component oracle.ordim.jai, 12.1.0.2.0...
Patching component oracle.ordim.server, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.rdbms.install.plugins, 12.1.0.2.0...
Patching component oracle.javavm.containers, 12.1.0.2.0...
Applying sub-patch '25755742' to OH '/u01/app/product/12.1.0.2/grid_2'
ApplySession: Optional component(s) [ oracle.oid.client, 12.1.0.2.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.network.rsf, 12.1.0.2.0...
Patching component oracle.ldap.rsf, 12.1.0.2.0...
Patching component oracle.ldap.client, 12.1.0.2.0...
Patching component oracle.oracore.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.deconfig, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.network.listener, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.has.crs, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Applying sub-patch '26609783' to OH '/u01/app/product/12.1.0.2/grid_2'
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.oracore.rsf, 12.1.0.2.0...
Applying sub-patch '26713565' to OH '/u01/app/product/12.1.0.2/grid_2'
ApplySession: Optional component(s) [ oracle.xdk, 12.1.0.2.0 ] , [ oracle.oid.client, 12.1.0.2.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.ldap.client, 12.1.0.2.0...
Patching component oracle.rdbms.crs, 12.1.0.2.0...
Patching component oracle.rdbms.deconfig, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.has.crs, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.xdk.parser.java, 12.1.0.2.0...
Patching component oracle.xdk.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Applying sub-patch '26925311' to OH '/u01/app/product/12.1.0.2/grid_2'
Patching component oracle.network.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Applying sub-patch '27338041' to OH '/u01/app/product/12.1.0.2/grid_2'
Patching component oracle.network.rsf, 12.1.0.2.0...
Patching component oracle.assistants.server, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.sqlplus.rsf, 12.1.0.2.0...
Patching component oracle.assistants.asm, 12.1.0.2.0...
Applying sub-patch '27547329' to OH '/u01/app/product/12.1.0.2/grid_2'
ApplySession: Optional component(s) [ oracle.ctx, 12.1.0.2.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.network.rsf, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.ldap.rsf, 12.1.0.2.0...
Patching component oracle.ctx.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.oracore.rsf, 12.1.0.2.0...
Patching component oracle.nlsrtl.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Applying sub-patch '28259833' to OH '/u01/app/product/12.1.0.2/grid_2'
Patching component oracle.oracore.rsf, 12.1.0.2.0...
Patching component oracle.has.crs, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.rdbms.crs, 12.1.0.2.0...
Applying sub-patch '28729169' to OH '/u01/app/product/12.1.0.2/grid_2'
Patching component oracle.ldap.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Applying sub-patch '29141015' to OH '/u01/app/product/12.1.0.2/grid_2'
Patching component oracle.ldap.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.deconfig, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.crs, 12.1.0.2.0...
Patching component oracle.has.crs, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Applying sub-patch '29494060' to OH '/u01/app/product/12.1.0.2/grid_2'
ApplySession: Optional component(s) [ oracle.ctx, 12.1.0.2.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.ldap.rsf, 12.1.0.2.0...
Patching component oracle.network.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.sqlplus.ic, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.has.crs, 12.1.0.2.0...
Patching component oracle.ldap.rsf.ic, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.rdbms.crs, 12.1.0.2.0...
Patching component oracle.oracore.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.deconfig, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.sqlplus, 12.1.0.2.0...
Patching component oracle.ctx.rsf, 12.1.0.2.0...
Composite patch 29494060 successfully applied.
Log file location: /u01/app/product/12.1.0.2/grid_2/cfgtoollogs/opatch/opatch2021-12-29_23-19-27PM_1.log
OPatch succeeded.
[grid@lab05 ~]$ exit
logout
[root@lab05 12.1.0.2]#
[root@lab05 12.1.0.2]# . oraenv <<< +ASM
ORACLE_SID = [root] ? The Oracle base has been set to /u01/app/grid
[root@lab05 12.1.0.2]# cd $ORACLE_HOME/crs/install
[root@lab05 install]# $ORACLE_HOME/crs/install/roothas.sh -prepatch
Using configuration parameter file: /u01/app/product/12.1.0.2/grid/crs/install/crsconfig_params
2021/12/29 22:22:29 CLSRSC-347: Successfully unlock /u01/app/product/12.1.0.2/grid
[root@lab05 install]#
[root@lab05 install]# export ORACLE_BASE=/u01/app/grid
[root@lab05 install]# export ORACLE_HOME=/u01/app/product/12.1.0.2/grid_2
[root@lab05 install]#
[root@lab05 install]#
[root@lab05 install]# $ORACLE_HOME/rdbms/install/rootadd_rdbms.sh
[root@lab05 install]# cd $ORACLE_HOME/crs/install
[root@lab05 install]# $ORACLE_HOME/perl/bin/perl roothas.pl -postpatch -dstcrshome $ORACLE_HOME
Using configuration parameter file: ./crsconfig_params
CRS-4123: Oracle High Availability Services has been started.
[root@lab05 install]# ps -ef | grep d.bin
grid 9464 1 2 22:29 ? 00:00:00 /u01/app/product/12.1.0.2/grid_2/bin/ohasd.bin reboot
grid 9559 1 0 22:29 ? 00:00:00 /u01/app/product/12.1.0.2/grid_2/bin/evmd.bin
grid 9621 1 0 22:29 ? 00:00:00 /u01/app/product/12.1.0.2/grid_2/bin/ocssd.bin
root 9648 2400 0 22:29 pts/1 00:00:00 grep --color=auto d.bin
Out-Of-Place Patching no Oracle Database com OPatch (manual)
O procedimento a seguir apresenta os passos necessários para aplicação de patch usando a abordagem Out-Of-Place de forma manual, quando não for possível a usar a automação nativa do OPatchAuto.
| Nome do banco de dados | marte |
| Oracle Home original | /u01/app/oracle/product/12.1.0.2/db_1 |
| Oracle Home que será criado | /u01/app/oracle/product/12.1.0.2/db_2 |
| Diretório do patch | /tmp/29494060 |
D1) Com root, cria uma cópia do diretório do Oracle Home original:
# . oraenv <<< marte
# cd $ORACLE_HOME/..
# cp -r db_1 db_2
D2) Ajusta as permissões para o usuário oracle:
# chown -R oracle.oinstall db_2
# chmod -R 775 db_2
D3) Com usuário oracle, executa o script clone.pl:
$ export ORACLE_BASE=/u01/app/oracle
$ export ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_2
$ cd $ORACLE_HOME/clone/bin
$ $ORACLE_HOME/perl/bin/perl clone.pl ORACLE_BASE=$ORACLE_BASE ORACLE_HOME=$ORACLE_HOME INVENTORY_LOCATION=/u01/app/oraInventory -defaultHomeName
Execute o script <ORACLE_HOME>/root.sh com o usuário root ao final do processo.
D4) Aplica o patch no novo binário com o OPatch:
$ mv $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch.old
$ unzip /tmp/opatch_12102_1220117.zip -d $ORACLE_HOME
$ export PATH=$ORACLE_HOME/OPatch:$PATH
$ opatch apply /tmp/29494060
D5) Altera o profile do banco no Grid para usar o novo Oracle Home a partir do próximo startup:
$ srvctl modify database -d marte -o /u01/app/oracle/product/12.1.0.2/db_2
D6) Reinicia o banco, deve ser iniciado no novo Oracle Home automaticamente:
$ srvctl stop database -d marte
$ srvctl start database -d marte
D7) Atualiza as variáveis de ambiente com oraenv e executa o SQL Patch no banco (o oratab já foi atualizado):
$ . oraenv <<< marte
$ $ORACLE_HOME/OPatch/datapatch -verbose
Exemplo:
[root@lab05 ~]# cd /u01/app/oracle/product/12.1.0.2/
[root@lab05 12.1.0.2]#
[root@lab05 12.1.0.2]# cp -r db_1 db_2
[root@lab05 12.1.0.2]#
[root@lab05 12.1.0.2]# chown -R oracle.oinstall db_2
[root@lab05 12.1.0.2]# chmod -R 775 db_2
[root@lab05 12.1.0.2]#
[root@lab05 12.1.0.2]# su - oracle
Last login: Wed Dec 29 23:06:08 -03 2021 on pts/1
[oracle@lab05 ~]$
[oracle@lab05 ~]$
[oracle@lab05 ~]$ export ORACLE_BASE=/u01/app/oracle
[oracle@lab05 ~]$ export ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_2
[oracle@lab05 ~]$
[oracle@lab05 ~]$
[oracle@lab05 ~]$ cd $ORACLE_HOME/clone/bin
[oracle@lab05 bin]$
[oracle@lab05 bin]$ $ORACLE_HOME/perl/bin/perl clone.pl ORACLE_BASE=$ORACLE_BASE ORACLE_HOME=$ORACLE_HOME INVENTORY_LOCATION=/u01/app/oraInventory -defaultHomeName
./runInstaller -clone -waitForCompletion "ORACLE_BASE=/u01/app/oracle" "ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_2" "INVENTORY_LOCATION=/u01/app/oraInventory" -defaultHomeName -silent -paramFile /u01/app/oracle/product/12.1.0.2/db_2/clone/clone_oraparam.ini
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 500 MB. Actual 1684 MB Passed
Checking swap space: must be greater than 500 MB. Actual 3071 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2021-12-29_11-09-53PM. Please wait ...You can find the log of this install session at:
/u01/app/oraInventory/logs/cloneActions2021-12-29_11-09-53PM.log
.................................................. 5% Done.
.................................................. 10% Done.
.................................................. 15% Done.
.................................................. 20% Done.
.................................................. 25% Done.
.................................................. 30% Done.
.................................................. 35% Done.
.................................................. 40% Done.
.................................................. 45% Done.
.................................................. 50% Done.
.................................................. 55% Done.
.................................................. 60% Done.
.................................................. 65% Done.
.................................................. 70% Done.
.................................................. 75% Done.
.................................................. 80% Done.
.................................................. 85% Done.
..........
Copy files in progress.
Copy files successful.
Link binaries in progress.
Link binaries successful.
Setup files in progress.
Setup files successful.
Setup Inventory in progress.
Setup Inventory successful.
Finish Setup successful.
The cloning of OraHome2 was successful.
Please check '/u01/app/oraInventory/logs/cloneActions2021-12-29_11-09-53PM.log' for more details.
Setup Oracle Base in progress.
Setup Oracle Base successful.
.................................................. 95% Done.
As a root user, execute the following script(s):
1. /u01/app/oracle/product/12.1.0.2/db_2/root.sh
.................................................. 100% Done.
[oracle@lab05 bin]$
[oracle@lab05 bin]$
[oracle@lab05 bin]$ exit
logout
[root@lab05 12.1.0.2]#
[root@lab05 12.1.0.2]# /u01/app/oracle/product/12.1.0.2/db_2/root.sh
Check /u01/app/oracle/product/12.1.0.2/db_2/install/root_lab05_2021-12-29_23-11-19.log for the output of root script
[root@lab05 12.1.0.2]#
[root@lab05 12.1.0.2]# su - oracle
Last login: Wed Dec 29 23:07:58 -03 2021 on pts/1
[oracle@lab05 ~]$
[oracle@lab05 ~]$ export ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_2
[oracle@lab05 ~]$ export PATH=$ORACLE_HOME/OPatch:$PATH
[oracle@lab05 ~]$ opatch apply /tmp/29494060
Oracle Interim Patch Installer version 12.2.0.1.17
Copyright (c) 2021, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/12.1.0.2/db_2
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/12.1.0.2/db_2/oraInst.loc
OPatch version : 12.2.0.1.17
OUI version : 12.1.0.2.0
Log file location : /u01/app/oracle/product/12.1.0.2/db_2/cfgtoollogs/opatch/opatch2021-12-30_00-15-33AM_1.log
Verifying environment and performing prerequisite checks...
--------------------------------------------------------------------------------
Start OOP by Prereq process.
Launch OOP...
Oracle Interim Patch Installer version 12.2.0.1.17
Copyright (c) 2021, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/12.1.0.2/db_2
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/12.1.0.2/db_2/oraInst.loc
OPatch version : 12.2.0.1.17
OUI version : 12.1.0.2.0
Log file location : /u01/app/oracle/product/12.1.0.2/db_2/cfgtoollogs/opatch/opatch2021-12-30_00-15-39AM_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 19769480 20299023 20831110 21359755 21948354 22291127 23054246 24006101 24732082 25171037 25755742 26609783 26713565 26925311 27338041 27547329 28259833 28729169 29141015 29494060
Do you want to proceed? [y|n]
Y (auto-answered by -silent)
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/12.1.0.2/db_2')
Is the local system ready for patching? [y|n]
Y (auto-answered by -silent)
User Responded with: Y
Backing up files...
Applying sub-patch '19769480' to OH '/u01/app/oracle/product/12.1.0.2/db_2'
Patching component oracle.rdbms.deconfig, 12.1.0.2.0...
Patching component oracle.xdk, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.rdbms.util, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.xdk.parser.java, 12.1.0.2.0...
Patching component oracle.oraolap, 12.1.0.2.0...
Patching component oracle.xdk.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.ldap.rsf, 12.1.0.2.0...
Patching component oracle.ldap.rsf.ic, 12.1.0.2.0...
Applying sub-patch '20299023' to OH '/u01/app/oracle/product/12.1.0.2/db_2'
ApplySession: Optional component(s) [ oracle.has.crs, 12.1.0.2.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.rdbms.deconfig, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.rdbms.rsf.ic, 12.1.0.2.0...
Patching component oracle.ldap.rsf, 12.1.0.2.0...
Patching component oracle.ldap.rsf.ic, 12.1.0.2.0...
Applying sub-patch '20831110' to OH '/u01/app/oracle/product/12.1.0.2/db_2'
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.oraolap.dbscripts, 12.1.0.2.0...
Patching component oracle.ldap.rsf, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Applying sub-patch '21359755' to OH '/u01/app/oracle/product/12.1.0.2/db_2'
Patching component oracle.assistants.server, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Applying sub-patch '21948354' to OH '/u01/app/oracle/product/12.1.0.2/db_2'
Patching component oracle.rdbms.deconfig, 12.1.0.2.0...
Patching component oracle.xdk, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.xdk.parser.java, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.xdk.rsf, 12.1.0.2.0...
Applying sub-patch '22291127' to OH '/u01/app/oracle/product/12.1.0.2/db_2'
ApplySession: Optional component(s) [ oracle.oid.client, 12.1.0.2.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.ldap.rsf, 12.1.0.2.0...
Patching component oracle.ldap.client, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.oraolap, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.oraolap.dbscripts, 12.1.0.2.0...
Applying sub-patch '23054246' to OH '/u01/app/oracle/product/12.1.0.2/db_2'
Patching component oracle.rdbms.dv, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.ldap.rsf, 12.1.0.2.0...
Patching component oracle.install.deinstalltool, 12.1.0.2.0...
Patching component oracle.ldap.rsf.ic, 12.1.0.2.0...
Patching component oracle.oracore.rsf, 12.1.0.2.0...
Patching component oracle.ctx, 12.1.0.2.0...
Patching component oracle.xdk, 12.1.0.2.0...
Patching component oracle.nlsrtl.rsf, 12.1.0.2.0...
Patching component oracle.xdk.parser.java, 12.1.0.2.0...
Patching component oracle.ctx.atg, 12.1.0.2.0...
Applying sub-patch '24006101' to OH '/u01/app/oracle/product/12.1.0.2/db_2'
Patching component oracle.sqlplus, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.network.listener, 12.1.0.2.0...
Patching component oracle.network.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.dv, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.sqlplus.ic, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Applying sub-patch '24732082' to OH '/u01/app/oracle/product/12.1.0.2/db_2'
Patching component oracle.rdbms.install.plugins, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Applying sub-patch '25171037' to OH '/u01/app/oracle/product/12.1.0.2/db_2'
Patching component oracle.sqlplus.ic, 12.1.0.2.0...
Patching component oracle.sqlplus, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.ordim.client, 12.1.0.2.0...
Patching component oracle.ordim.client, 12.1.0.2.0...
Patching component oracle.ordim.jai, 12.1.0.2.0...
Patching component oracle.ordim.server, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.rdbms.install.plugins, 12.1.0.2.0...
Patching component oracle.javavm.containers, 12.1.0.2.0...
Applying sub-patch '25755742' to OH '/u01/app/oracle/product/12.1.0.2/db_2'
ApplySession: Optional component(s) [ oracle.oid.client, 12.1.0.2.0 ] , [ oracle.has.crs, 12.1.0.2.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.network.rsf, 12.1.0.2.0...
Patching component oracle.ldap.rsf, 12.1.0.2.0...
Patching component oracle.ldap.client, 12.1.0.2.0...
Patching component oracle.oracore.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.deconfig, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.network.listener, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Applying sub-patch '26609783' to OH '/u01/app/oracle/product/12.1.0.2/db_2'
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.oracore.rsf, 12.1.0.2.0...
Applying sub-patch '26713565' to OH '/u01/app/oracle/product/12.1.0.2/db_2'
ApplySession: Optional component(s) [ oracle.oid.client, 12.1.0.2.0 ] , [ oracle.has.crs, 12.1.0.2.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.ldap.client, 12.1.0.2.0...
Patching component oracle.rdbms.crs, 12.1.0.2.0...
Patching component oracle.rdbms.deconfig, 12.1.0.2.0...
Patching component oracle.xdk, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.xdk.parser.java, 12.1.0.2.0...
Patching component oracle.xdk.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Applying sub-patch '26925311' to OH '/u01/app/oracle/product/12.1.0.2/db_2'
Patching component oracle.network.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Applying sub-patch '27338041' to OH '/u01/app/oracle/product/12.1.0.2/db_2'
ApplySession: Optional component(s) [ oracle.assistants.asm, 12.1.0.2.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.network.rsf, 12.1.0.2.0...
Patching component oracle.assistants.server, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.sqlplus.rsf, 12.1.0.2.0...
Applying sub-patch '27547329' to OH '/u01/app/oracle/product/12.1.0.2/db_2'
Patching component oracle.network.rsf, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.ldap.rsf, 12.1.0.2.0...
Patching component oracle.ctx.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.oracore.rsf, 12.1.0.2.0...
Patching component oracle.ctx, 12.1.0.2.0...
Patching component oracle.nlsrtl.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Applying sub-patch '28259833' to OH '/u01/app/oracle/product/12.1.0.2/db_2'
ApplySession: Optional component(s) [ oracle.has.crs, 12.1.0.2.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.oracore.rsf, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.rdbms.crs, 12.1.0.2.0...
Applying sub-patch '28729169' to OH '/u01/app/oracle/product/12.1.0.2/db_2'
Patching component oracle.ldap.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Applying sub-patch '29141015' to OH '/u01/app/oracle/product/12.1.0.2/db_2'
ApplySession: Optional component(s) [ oracle.has.crs, 12.1.0.2.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.ldap.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.deconfig, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.crs, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Applying sub-patch '29494060' to OH '/u01/app/oracle/product/12.1.0.2/db_2'
ApplySession: Optional component(s) [ oracle.has.crs, 12.1.0.2.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.ldap.rsf, 12.1.0.2.0...
Patching component oracle.network.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.rsf, 12.1.0.2.0...
Patching component oracle.rdbms, 12.1.0.2.0...
Patching component oracle.ctx, 12.1.0.2.0...
Patching component oracle.sqlplus.ic, 12.1.0.2.0...
Patching component oracle.tfa, 12.1.0.2.0...
Patching component oracle.ldap.rsf.ic, 12.1.0.2.0...
Patching component oracle.rdbms.rman, 12.1.0.2.0...
Patching component oracle.rdbms.crs, 12.1.0.2.0...
Patching component oracle.oracore.rsf, 12.1.0.2.0...
Patching component oracle.rdbms.deconfig, 12.1.0.2.0...
Patching component oracle.rdbms.dbscripts, 12.1.0.2.0...
Patching component oracle.sqlplus, 12.1.0.2.0...
Patching component oracle.ctx.rsf, 12.1.0.2.0...
OPatch found the word "error" in the stderr of the make command.
Please look at this stderr. You can re-run this make command.
Stderr output:
chmod: changing permissions of ‘/u01/app/oracle/product/12.1.0.2/db_2/bin/extjobO’: Operation not permitted
make: [iextjob] Error 1 (ignored)
Composite patch 29494060 successfully applied.
OPatch Session completed with warnings.
Log file location: /u01/app/oracle/product/12.1.0.2/db_2/cfgtoollogs/opatch/opatch2021-12-30_00-15-39AM_1.log
[oracle@lab05 ~]$ srvctl modify database -d marte -o /u01/app/oracle/product/12.1.0.2/db_2
[oracle@lab05 ~]$
[oracle@lab05 ~]$
[oracle@lab05 ~]$ srvctl stop database -d marte
[oracle@lab05 ~]$ srvctl start database -d marte
[oracle@lab05 ~]$ . oraenv <<< marte
ORACLE_SID = [marte] ? The Oracle base remains unchanged with value /u01/app/oracle
[oracle@lab05 ~]$
[oracle@lab05 ~]$ $ORACLE_HOME/OPatch/datapatch -verbose
SQL Patching tool version 12.1.0.2.0 Production on Wed Dec 29 23:22:27 2021
Copyright (c) 2012, 2016, Oracle. All rights reserved.
Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_19140_2021_12_29_23_22_27/sqlpatch_invocation.log
Connecting to database...OK
Bootstrapping registry and package to current versions...done
Determining current state...done
Current state of SQL patches:
Bundle series PSU:
ID 190716 in the binary registry and not installed in the SQL registry
Adding patches to installation queue and performing prereq checks...
Installation queue:
Nothing to roll back
The following patches will be applied:
29494060 (DATABASE PATCH SET UPDATE 12.1.0.2.190716)
Installing patches...
Patch installation complete. Total patches installed: 1
Validating logfiles...
Patch 29494060 apply: SUCCESS
logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/29494060/22993235/29494060_apply_MARTE_2021Dec29_23_22_37.log (no errors)
SQL Patching tool complete on Wed Dec 29 23:23:03 2021
Validando o patch no banco:

O mesmo procedimento pode ser aplicado em um banco de dados 11gR2, a diferença é que seria executado o script $ORACLE_HOME/rdbms/admin/catbundle.sql ao invés do datapatch na etapa de SQL Patch.
Atualizando Grid Home e DB Home Sumultaneamente
Apesar da abordagem Out-Of-Place permitir uma atualização do binário com alguns segundos de indisponibilidade dos serviços, em um cenário de atualização do Grid Home e do DB home separadamente podem requerer dois períodos de indisponibilidade. Em um cenário de aplicação de patch em ambiente Single Instance, pode ser preferível organizar a sequência de atividades de modo que diminua e necessidade de múltiplas reinicializações no banco de dados, afim de diminuir o intervalo que a instância pode apresentar indisponibilidade.
Quando usando a automação do OPatchAuto, esse requisito pode ser facilmente atendido da seguinte forma:
1) Cria um arquivo de resposta contendo o mapeamento de Oracle Home que devem ser atualizados, exemplo:
/u01/app/product/19.3.0.0/grid_1=/u01/app/product/19.12.0.0/grid_2
/u01/app/oracle/product/19.3.0.0/db_1=/u01/app/oracle/product/19.12.0.0/db_2
2) Executa o comando opatchauto com o parâmetro -silent e informando o caminho do arquivo de resposta, exemplo:
opatchauto apply /tmp/patch/XXXXXXXXX -outofplace -silent /tmp/ru1912.rsp
Se for um cenário de Out-Of-Place manual (12cR1 ou inferior), é possível atualizar o Grid Home e DB Home com um único restart, executando o procedimento na seguinte ordem:
- A) Clone primeiro o DB home e aplique o patch no binário (etapa D1 a D4)
- B) Altere o Oracle Home do (ou dos) banco de dados no profile do Grid (etapa D5)
- C) Clone o Grid Home e aplique o patch no binário (etapa G1 a G4)
- D) Reinicie os serviços do Grid no novo Grid Home (etapa G5 e G6)
- E) Execute o Datapatch no banco de dados (etapa D7)
Nota: As etapas com prefixo “G” fazem referência ao procedimento de clonagem manual do Grid Home, enquanto as etapas com prefixo “D”, fazem referência ao procedimento de clonagem manual do DB Home
Seguindo essa ordem durante a aplicação de patch manualmente, o banco de dados deve ter apenas uma indisponibilidade, que ocorre no momento em que o Grid Infrastructure é reiniciado no novo Grid Home (passo D) . Alerando o Oracle Home do banco via “srvctl modify database” antes de clonar o Grid, isso faz com que o a instância RDBMS seja iniciada no novo DB home automaticamente quando o Grid Infrastructure for reiniciado.
Considerações Adicionais
Nos casos em que não há Grid Infrastructure, o procedimento manual para DB Home é praticamente o mesmo, mas as etapas D5 e D6 seriam um pouco diferentes, pois a troca do Oracle Home não teria o auxilio do srvctl. Exemplo:
- Shutdown da instância no DB home original com SQLPLUS
- Ajuste manual nas variáveis de ambiente (export, oratab, bash_profile, etc)
- Startup da instância no DB Home novo com SQLPLUS
Em um ambiente com Oracle RAC, a etapa de reiniciar o banco no novo Oracle Home pode ser em um node de cada vez, dessa modo seria utilizado “stop instance” e “start instance” nos comandos com srvctl. Também, em cenários com OPatchAuto, ele faz o restart um node por vez, a menos que seja especificado o parâmetro -nonrolling.
No eventual caso de rollback do patch no banco de dados, se for a versão 12cR2 ou superior, basta voltar para o Oracle Home antigo e executar o datapatch a partir do DB Home original (ele fará o rollback automaticamente ao verificar que o patch existe no banco, mas não no binário). Se for 12cR1, pode ser necessário rodar o datapatch ainda no DB home atual, forçando o rollback do patch explicitamente antes de voltar o banco para o DB Home original. Apresentarei alguns exemplos em um post específico sobre rollback.
Conclusão
Este post apresentou uma introdução sobre a estratégia de aplicação de patch com a abordagem Out-Of-Place nos softwares Oracle Grid Infrastructure e Oracle Database, assim como exemplos práticos da execução dos procedimentos usando a opção nativa do utilitário OPatchAuto, assim como a abordagem manual com OPatch.
Essa estratégia é a mesma utilizada pelo Fleet Patching and Provisioning (FPP), uma tecnologia que permite automatizar todas as atividades de provisionamento e aplicação de patches no banco de dados Oracle, conheça mais sobre o FPP no post Oracle Fleet Patching & Provisioning (FPP): Configuração do FPP Server 19c.
Referências:
Grid Infrastructure Out of Place ( OOP ) Patching using opatchauto (Doc ID 2419319.1)
[…] Como Aplicar Patch no Grid Infrastructure e Oracle Database Usando a Estratégia “Out-Of-Place Pat… […]