Standby-First Patch Apply em DataGuard com Rolling Patch em Oracle RAC 12c

Por Franky Weber
Publicado en Mayo 2017


Revisado por Marcelo Pivovar

Objetivo:

Aplicar o PSU no Standby com RAC database utilizando o método standby-first patch apply.

Neste artigo apresento como aplicar patch utilizando o método standby-firstpatch apply num ambiente DataGuard com Oracle RAC 12c, onde aplicamos com Rolling Patch. Resumindo, primeiro aplicaremos o patch no standby e como o banco de dados é um RAC de 2 nós, aplicamos em um nó primeiro e depois no outro.

Cenário:

  1. Primary:
      Exadata Database Machine:
      srv-pmy1 → pmy1
      srv-pmy2 → pmy2
  2. Standby:
      Exadata Database Machine:
      srv-stb1 → stb1
      srv-stb2 → stb2

Antes de qualquer coisa leia o README do patch que será aplicado e verifique se o patch pode ser aplicado da maneira que estou fazendo aqui.

Inicialmente verifique os patches aplicados.

[stb1.oracle@srv-stb1 patch]$ cd /u01/app/oracle/product/12.1.0.2/dbhome_1/OPatch/
[stb1.oracle@srv-stb1 OPatch]$ ./opatch lspatches
23177536;Database PSU 12.1.0.2.160719, Oracle JavaVM Component (JUL2016)
21923026;
23520664;OCW Interim patch for 23520664
23144544;DATABASE BUNDLE PATCH: 12.1.0.2.160719 (23144544)

OPatch succeeded.

No cenário que estou há uma incompatibilidade do patch 21923026 com o patch 24448103 que vou aplicar, sendo assim é necessário fazer rollback do patch 21923026 antes de aplicar o outro.

Verifique as instâncias em execução.

[stb1.oracle@srv-stb1 OPatch]$ ps -ef|grep pmon
oracle    19819      1  0  2016 ?        00:02:59 asm_pmon_+ASM1
oracle    36065      1  0  2016 ?        00:03:12 ora_pmon_stb1
oracle    41740   2198  0 18:31 pts/1    00:00:00 grep pmon

Conecte-se ao Broker e verifique a configuração atual do Standby.

[stb1.oracle@srv-stb1 u01]$ dgmgrl /
DGMGRL for Linux: Version 12.1.0.2.0 - 64bit Production

Copyright (c) 2000, 2013, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
Connected as SYSDG.
DGMGRL> show configuration;

Configuration - dg

  Protection Mode: MaxAvailability
  Members:
  pmy - Primary database
  stb - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS   (status updated 58 seconds ago)

DGMGRL> show database stb;

Database - stb

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      0 seconds (computed 0 seconds ago)
  Apply Lag:          0 seconds (computed 0 seconds ago)
  Average Apply Rate: 626.00 KByte/s
  Real Time Query:    OFF
  Instance(s):
    stb1
    stb2 (apply instance)

Database Status:
SUCCESS

Assim constatou-se que o redoapply está ocorrendo no nó 2, o que nos permite aplicar o patch no nó 1.
Pare todos os serviços do Oracle Home onde será aplicado o patch. No meu caso há somente uma instância neste OH.

[stb1.oracle@srv-stb1 OPatch]$ srvctl stop instance -i stb1 -d stb

Faça o rollback do patch 21923026. A opção -verbose traz mais logs na tela.

[stb1.oracle@srv-stb1 OPatch]$ ./opatch rollback -id 21923026 
-local -verbose

Oracle Interim Patch Installer version 12.1.0.1.12
Copyright (c) 2017, Oracle Corporation.  All rights reserved.

Environment:
   OPatch.ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_1

   oracle.installer.invPtrLoc=/u01/app/oracle/product/12.1.0.2/
   dbhome_1/oraInst.loc

   oracle.installer.oui_loc=/u01/app/oracle/product/12.1.0.2/
   dbhome_1/oui
   
   oracle.installer.library_loc=/u01/app/oracle/product/12.1.0.2/
   dbhome_1/oui/lib/linux64
   
   oracle.installer.startup_location=/u01/app/oracle/product/
   12.1.0.2/dbhome_1/oui
   
   OPatch.PLATFORM_ID=
   os.name=Linux
   OPatch.NO_FUSER=
   OPatch.SKIP_VERIFY=null
   OPatch.SKIP_VERIFY_SPACE=null
   oracle.installer.clusterEnabled=false
   TRACING.ENABLED=null
   TRACING.LEVEL=null
   OPatch.DEBUG=false
   OPATCH_VERSION=12.1.0.1.12
   Bundled OPatch Property File=properties
   Minimum OUI version: 10.2
   
   OPatch.PATH=/u01/app/oracle/product/12.1.0.2/dbhome_1/bin:/
   usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/
   sbin:.:/usr/java/bin::/u01/app/oracle/product/12.1.0.2/
   dbhome_1/OPatch:/u01/app/12.1.0.2/grid/bin

   OPatch.MW_HOME=
   OPatch.WL_HOME=
   OPatch.COMMON_COMPONENTS_HOME=



Oracle Home       : /u01/app/oracle/product/12.1.0.2/dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/12.1.0.2/dbhome_1/
   oraInst.loc
OPatch version    : 12.1.0.1.12
OUI version       : 12.1.0.2.0
Log file location : /u01/app/oracle/product/12.1.0.2/dbhome_1/
cfgtoollogs/opatch/opatch2017-01-11_18-39-53PM_1.log

Patch to roll back: 21923026
Lock the home to access inventory.
Running pre-requisite checks on patches to be rolled back.

All the specified patches are present in the Oracle Home.
Construct a list of patch objects to roll back...
Loading patches from Oracle Home inventory.

Patches will be rolled back in the following order:
   21923026
Create a merged patch using patch 21923026
Add component oracle.rdbms, 12.1.0.2.0
  add ArchiveAction for libserver12.a
  add ArchiveAction for libserver12.a
  add ArchiveAction for libserver12.a
  add MakeAction for ioracle

NRollback: backed-up files are under "/u01/app/oracle/product/
12.1.0.2/dbhome_1/.patch_storage/NRollback/2017-01-11_18-39-53PM"


Running prerequisite check "CheckForInputValues" ...
Input values is present for the all the actions of the given patches.

Running prerequisite check "CheckSystemCommandAvailable" ...

Fuser command is needed

Archive command is needed

Make commands is needed

All the required commands are available.
All the required system commands are present.

Running prerequisite check "CheckActiveFilesAndExecutables" ...

Invoking fuser on the executable list...
Invoking fuser on "/u01/app/oracle/product/12.1.0.2/dbhome_1/
bin/oracle"

There are no active executables.
None of the executables are active.

Running prerequisite check "CheckRollbackSid"...

Running prerequisite check "CheckRollbackable" ...
All the input rollback patches can be rolled back together.

Patch 21923026:
All the actions are rollbackable.

All the specified patches can be rolled back.
All the actions of the given patches are rollbackable.

Running prerequisite check "CheckPatchRollbackDependents" ...
All the required patch(es) are present in the Oracle Home.

Running prerequisite check "CheckMinimumOPatchVersion" ...

All patches can be applied using this OPatch.
Prerequisite check "CheckMinimumOPatchVersion" passed.
The following patch(es) will be rolled back: 21923026

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


Is the local system ready for patching? [y|n]
y
User Responded with: Y

Back up patch inventory from "/u01/app/oracle/product/12.1.0.2/
dbhome_1/inventory/oneoffs" to "/u01/app/oracle/

product/12.1.0.2/dbhome_1/.patch_storage/NRollback/
2017-01-11_18-39-53PM/backup/inventory/oneoffs".

Creating directory "/u01/app/oracle/product/12.1.0.2/dbhome_1/
.patch_storage/NRollback/2017-01-11_18-39-53PM/backup/
inventory/oneoffs"

Back up Oracle Home Inventory from "/u01/app/oracle/product/
12.1.0.2/dbhome_1/inventory/ContentsXML/comps.xml" to "/u01/
app/oracle/product/12.1.0.2/dbhome_1/.patch_storage/NRollback/
2017-01-11_18-39-53PM/backup/inventory/ContentsXML/
comps.xml".

Create restore file "/u01/app/oracle/product/12.1.0.2/dbhome_1/
.patch_storage/NRollback/2017-01-11_18-39-53PM/
restore.sh".

Creating script "/u01/app/oracle/product/12.1.0.2/dbhome_1/
.patch_storage/NRollback/2017-01-11_18-39-53PM/restore.sh"...



Rolling back patch 21923026...



Patch Location in Inventory    : /u01/app/oracle/product/
12.1.0.2/dbhome_1/inventory/oneoffs/21923026

Patch Location in Storage area : /u01/app/oracle/product/
12.1.0.2/dbhome_1/.patch_storage/21923026_Jun_7_2016_23_33_21


RollbackSession rolling back interim patch '21923026' from OH '/
u01/app/oracle/product/12.1.0.2/dbhome_1'

Bugs fixed by this patch 21923026:
   21923026: ORA-600 [OLTP COMPRESSION SANITY CHECK]

Creating mode file for rollback

Patching component oracle.rdbms, 12.1.0.2.0...
     ArchiveAction:rollback() on "/u01/app/oracle/product/
     12.1.0.2/dbhome_1/lib/libserver12.a"

Executing '/usr/bin/ar -rc /u01/app/oracle/product/12.1.0.2/
dbhome_1/lib/libserver12.a /u01/app/oracle/product/12.1.0.2/
dbhome_1/.patch_storage/21923026_Jun_7_2016_23_33_21/files/
lib/libserver12.a/kd9ir2c.o /u01/app/oracle/product/12.1.0.2/
dbhome_1/.patch_storage/21923026_Jun_7_2016_23_33_21/files/
lib/libserver12.a/kdblc.o /u01/app/oracle/product/12.1.0.2/
dbhome_1/.patch_storage/21923026_Jun_7_2016_23_33_21/files/
lib/libserver12.a/kdo.o'

     Archive Action done

Re-link for the target oracle.rdbms, 12.1.0.2.0 is delayed. 
It will be done in the end.

RollbackSession removing interim patch '21923026' from inventory

Deleting the directory "/u01/app/oracle/product/12.1.0.2/
dbhome_1/inventory/oneoffs/21923026"

Deleted the directory "/u01/app/oracle/product/12.1.0.2/
dbhome_1/inventory/oneoffs/21923026"

Verifying if inventory updation has gone fine....

Inventory is updated with the patch details.



Done with rolling back all patches.



     MakeAction: makeFile = "/u01/app/oracle/product/
     12.1.0.2/dbhome_1/rdbms/lib/ins_rdbms.mk", target = 
     "ioracle", directory = "/u01/app/oracle/product/
     12.1.0.2/dbhome_1/rdbms/lib", makeCmd = "/usr/bin/
     make -f ins_rdbms.mk 

     ioracle ORACLE_HOME=/u01/app/oracle/product/
     12.1.0.2/dbhome_1"


Make result:

  Command: /usr/bin/make -f ins_rdbms.mk ioracle ORACLE_HOME=
  /u01/app/oracle/product/12.1.0.2/dbhome_1

  Returned code: 0
  Stdout output:
chmod 755 /u01/app/oracle/product/12.1.0.2/dbhome_1/bin

 - Linking Oracle
rm -f /u01/app/oracle/product/12.1.0.2/dbhome_1/rdbms/lib/oracle
/u01/app/oracle/product/12.1.0.2/dbhome_1/bin/orald  -o /u01/app/
oracle/product/12.1.0.2/dbhome_1/rdbms/lib/oracle -m64 -z 
noexecstack -Wl,--disable-new-dtags -L/u01/app/oracle/product/
12.1.0.2/dbhome_1/rdbms/lib/ -L/u01/app/oracle/product/12.1.0.2/
dbhome_1/lib/ -L/u01/app/oracle/product/12.1.0.2/dbhome_1/lib/
stubs/   -Wl,-E /u01/app/oracle/product/12.1.0.2/dbhome_1/rdbms/
lib/opimai.o /u01/app/oracle/product/12.1.0.2/dbhome_1/rdbms/
lib/ssoraed.o /u01/app/oracle/product/12.1.0.2/dbhome_1/rdbms/
lib/ttcsoi.o -Wl,--whole-archive -lperfsrv12 -Wl,--no-whole-archive
/u01/app/oracle/product/12.1.0.2/dbhome_1/lib/nautab.o /u01/app/
oracle/product/12.1.0.2/dbhome_1/lib/naeet.o /u01/app/oracle/
product/12.1.0.2/dbhome_1/lib/naect.o /u01/app/oracle/product/
12.1.0.2/dbhome_1/lib/naedhs.o /u01/app/oracle/product/
12.1.0.2/dbhome_1/rdbms/lib/config.o  -lserver12 -lodm12 
-lcell12 -lnnet12 -lskgxp12 -lsnls12 -lnls12  -lcore12 -lsnls12
-lnls12 -lcore12 -lsnls12 -lnls12 -lxml12 -lcore12 -lunls12 
-lsnls12 -lnls12 -lcore12 -lnls12 -lclient12  -lvsn12 -lcommon12
-lgeneric12 -lknlopt `if /usr/bin/ar tv /u01/app/oracle/
product/12.1.0.2/dbhome_1/rdbms/lib/libknlopt.a | grep 
xsyeolap.o > /dev/null 2>&1 ; then echo "-loraolap12" ; 
fi` -lskjcx12 -lslax12 -lpls12  -lrt -lplp12 -lserver12 
-lclient12  -lvsn12 -lcommon12 -lgeneric12 `if [ -f /u01/
app/oracle/product/12.1.0.2/dbhome_1/lib/libavserver12.a ] ;
then echo "-lavserver12" ; else echo "-lavstub12"; fi` `if 
[ -f /u01/app/oracle/product/12.1.0.2/dbhome_1/lib/
libavclient12.a ] ; then echo "-lavclient12" ; fi` -lknlopt 
-lslax12 -lpls12  -lrt -lplp12 -ljavavm12 -lserver12  
-lwwg  `cat /u01/app/oracle/product/12.1.0.2/dbhome_1/lib/
ldflags`    -lncrypt12 -lnsgr12 -lnzjs12 -ln12 -lnl12 -lnro12
`cat /u01/app/oracle/product/12.1.0.2/dbhome_1/lib/ldflags`
-lncrypt12 -lnsgr12 -lnzjs12 -ln12 -lnl12 -lnnzst12 -lzt12 
-lztkg12 -lmm -lsnls12 -lnls12  -lcore12 -lsnls12 -lnls12 
-lcore12 -lsnls12 -lnls12 -lxml12 -lcore12 -lunls12 -lsnls12 
-lnls12 -lcore12 -lnls12 -lztkg12 `cat /u01/app/oracle/product
/12.1.0.2/dbhome_1/lib/ldflags`    -lncrypt12 -lnsgr12 
-lnzjs12 -ln12 -lnl12 -lnro12 `cat /u01/app/oracle/product/
12.1.0.2/dbhome_1/lib/ldflags`    -lncrypt12 -lnsgr12 -lnzjs12
-ln12 -lnl12 -lnnzst12 -lzt12 -lztkg12   -lsnls12 -lnls12  
-lcore12 -lsnls12 -lnls12 -lcore12 -lsnls12 -lnls12 -lxml12 
-lcore12 -lunls12 -lsnls12 -lnls12 -lcore12 -lnls12 `if /
usr/bin/ar tv /u01/app/oracle/product/12.1.0.2/dbhome_1/
rdbms/lib/libknlopt.a | grep "kxmnsd.o" > /dev/null 2>&1 ;
then echo " " ; else echo "-lordsdo12 -lserver12"; fi` 
-L/u01/app/oracle/product/12.1.0.2/dbhome_1/ctx/lib/ 
-lctxc12 -lctx12 -lzx12 -lgx12 -lctx12 -lzx12 -lgx12 
-lordimt12 -lclsra12 -ldbcfg12 -lhasgen12 -lskgxn2 -lnnzst12
-lzt12 -lxml12 -locr12 -locrb12 -locrutl12 -lhasgen12 
-lskgxn2 -lnnzst12 -lzt12 -lxml12  -lgeneric12 -loraz 
-llzopro -lorabz2 -lipp_z -lipp_bz2 -lippdcemerged 
-lippsemerged -lippdcmerged  -lippsmerged -lippcore  
-lippcpemerged -lippcpmerged  -lsnls12 -lnls12  -lcore12
-lsnls12 -lnls12 -lcore12 -lsnls12 -lnls12 -lxml12 
-lcore12 -lunls12 -lsnls12 -lnls12 -lcore12 -lnls12 
-lsnls12 -lunls12  -lsnls12 -lnls12  -lcore12 -lsnls12 
-lnls12 -lcore12 -lsnls12 -lnls12 -lxml12 -lcore12 -lunls12
-lsnls12 -lnls12 -lcore12 -lnls12 -lasmclnt12 -lcommon12
-lcore12  -laio -lons    `cat /u01/app/oracle/product/
12.1.0.2/dbhome_1/lib/sysliblist` -Wl,-rpath,/u01/app/
oracle/product/12.1.0.2/dbhome_1/lib -lm    `cat /u01/
app/oracle/product/12.1.0.2/dbhome_1/lib/sysliblist` 
-ldl -lm   -L/u01/app/oracle/product/12.1.0.2/dbhome_1/lib
test ! -f /u01/app/oracle/product/12.1.0.2/dbhome_1/bin/oracle ||\
mv -f /u01/app/oracle/product/12.1.0.2/dbhome_1/bin/oracle 
/u01/app/oracle/product/12.1.0.2/dbhome_1/bin/oracleO
mv /u01/app/oracle/product/12.1.0.2/dbhome_1/rdbms/lib/oracle /
u01/app/oracle/product/12.1.0.2/dbhome_1/bin/oracle
chmod 6751 /u01/app/oracle/product/12.1.0.2/dbhome_1/bin/oracle

  Stderr output:


     Make Action done
Log file location: /u01/app/oracle/product/12.1.0.2/dbhome_1/
cfgtoollogs/opatch/opatch2017-01-11_18-39-53PM_1.log

OPatch succeeded.

Com o usuário root defina as variáveis de ambiente para o Grid Infrastructure Home.

[stb1.root@srv-stb1 24448103]$ . /home/oracle/.profile_infra

Execute o opatchauto analyze para verificar os pré-requisitos.

[+ASM1.root@srv-stb1 ~]$ $ORACLE_HOME/OPatch/opatchauto 
apply /u01/patch/24448103 -analyze

System initialization log file is /u01/app/12.1.0.2/grid/
cfgtoollogs/opatchautodb/systemconfig2017-01-11_07-17-30PM.log.


Session log file is /u01/app/12.1.0.2/grid/cfgtoollogs/
opatchauto/opatchauto2017-01-11_07-17-54PM.log
The id for this session is G5TU
[init:init] Executing OPatchAutoBinaryAction action on home 
/u01/app/oracle/product/12.1.0.2/dbhome_1
[init:init] Executing OPatchAutoBinaryAction action on home 
/u01/app/12.1.0.2/grid

Executing OPatch prereq operations to verify patch applicability 
on RAC Home........


Executing OPatch prereq operations to verify patch applicability 
on CRS Home........

[init:init] OPatchAutoBinaryAction action completed on home /
u01/app/12.1.0.2/grid successfully

[init:init] OPatchAutoBinaryAction action completed on home /
u01/app/oracle/product/12.1.0.2/dbhome_1 successfully
[init:init] Executing GIRACPrereqAction action on home /u01/
app/oracle/product/12.1.0.2/dbhome_1
[init:init] Executing GIRACPrereqAction action on home /u01/
app/12.1.0.2/grid

Executing prereq operations before applying on CRS Home........


Executing prereq operations before applying on RAC Home........

[init:init] GIRACPrereqAction action completed on home /u01/app/
oracle/product/12.1.0.2/dbhome_1 successfully
[init:init] GIRACPrereqAction action completed on home /u01/app/
12.1.0.2/grid successfully
[init:init] Executing RACDBPrereqAction action on home /u01/app/
oracle/product/12.1.0.2/dbhome_1

Executing prereq operations before applying on RAC Home........

[init:init] RACDBPrereqAction action completed on home /u01/app/
oracle/product/12.1.0.2/dbhome_1 successfully

-------------------------Summary-------------------------

Analysis for applying patches has completed successfully:

Host:srv-stb1
CRS Home:/u01/app/12.1.0.2/grid


==Following patches were SKIPPED:

Patch: /u01/patch/24448103/21436941
Reason: This patch is already been applied, so not going to 
apply again.


==Following patches were SUCCESSFULLY analyzed to be applied:

Patch: /u01/patch/24448103/24007012
Log: /u01/app/12.1.0.2/grid/cfgtoollogs/opatchauto/core/opatch/
opatch2017-01-11_19-18-00PM_1.log

Patch: /u01/patch/24448103/24340679
Log: /u01/app/12.1.0.2/grid/cfgtoollogs/opatchauto/core/opatch/
opatch2017-01-11_19-18-00PM_1.log

Patch: /u01/patch/24448103/24846605
Log: /u01/app/12.1.0.2/grid/cfgtoollogs/opatchauto/core/opatch/
opatch2017-01-11_19-18-00PM_1.log


Host:srv-stb1
RAC Home:/u01/app/oracle/product/12.1.0.2/dbhome_1


==Following patches were SKIPPED:

Patch: /u01/patch/24448103/21436941
Reason: This patch is not applicable to this specified target 
type - "rac_database"

Patch: /u01/patch/24448103/24007012
Reason: This patch is not applicable to this specified target 
type - "rac_database"


==Following patches were SUCCESSFULLY analyzed to be applied:

Patch: /u01/patch/24448103/24340679
Log: /u01/app/oracle/product/12.1.0.2/dbhome_1/cfgtoollogs/
opatchauto/core/opatch/opatch2017-01-11_19-18-01PM_1.log

Patch: /u01/patch/24448103/24846605
Log: /u01/app/oracle/product/12.1.0.2/dbhome_1/cfgtoollogs/
opatchauto/core/opatch/opatch2017-01-11_19-18-01PM_1.log


OPatchAutosuccessful.

Passando todos os pré-requisitos, siga com a aplicação do patch 24448103.

[+ASM1.root@srv-stb1 ~]$ $ORACLE_HOME/OPatch/opatchauto apply 
/u01/patch/24448103

System initialization log file is /u01/app/12.1.0.2/grid/
cfgtoollogs/opatchautodb/systemconfig2017-01-11_07-24-29PM.log.

Session log file is /u01/app/12.1.0.2/grid/cfgtoollogs/
opatchauto/opatchauto2017-01-11_07-24-46PM.log
The id for this session is WM33
[init:init] Executing OPatchAutoBinaryAction action on home /
u01/app/12.1.0.2/grid
[init:init] Executing OPatchAutoBinaryAction action on home /
u01/app/oracle/product/12.1.0.2/dbhome_1

Executing OPatch prereq operations to verify patch 
applicability on CRS Home........


Executing OPatch prereq operations to verify patch 
applicability on RAC Home........

[init:init] OPatchAutoBinaryAction action completed on home /
u01/app/12.1.0.2/grid successfully

[init:init] OPatchAutoBinaryAction action completed on home /
u01/app/oracle/product/12.1.0.2/dbhome_1 successfully
[init:init] Executing GIRACPrereqAction action on home /u01/
app/oracle/product/12.1.0.2/dbhome_1
[init:init] Executing GIRACPrereqAction action on home /u01/
app/12.1.0.2/grid

Executing prereq operations before applying on CRS Home........


Executing prereq operations before applying on RAC Home........

[init:init] GIRACPrereqAction action completed on home /u01/app/
oracle/product/12.1.0.2/dbhome_1 successfully
[init:init] GIRACPrereqAction action completed on home /u01/app/
12.1.0.2/grid successfully
[init:init] Executing RACDBPrereqAction action on home /u01/app/
oracle/product/12.1.0.2/dbhome_1

Executing prereq operations before applying on RAC Home........

[init:init] RACDBPrereqAction action completed on home /u01/app/
oracle/product/12.1.0.2/dbhome_1 successfully
[shutdown:prepare-shutdown] Executing RACPrepareShutDownAction 
action on home /u01/app/oracle/product/12.1.0.2/dbhome_1

Preparing RAC Home to bring down database service........

[shutdown:prepare-shutdown] RACPrepareShutDownAction action 
completed on home /u01/app/oracle/product/12.1.0.2/dbhome_1 
successfully

[shutdown:shutdown] Executing RACOneAction action on home /
u01/app/oracle/product/12.1.0.2/dbhome_1

/u01/app/oracle/product/12.1.0.2/dbhome_1 is not a RACOne 
database. No step execution required........

[shutdown:shutdown] RACOneAction action completed on home /
u01/app/oracle/product/12.1.0.2/dbhome_1 successfully
[shutdown:shutdown] Executing GIShutDownAction action on 
home /u01/app/12.1.0.2/grid

Performing prepatch operations on CRS Home........

Prepatch operation log file location: /u01/app/12.1.0.2/
grid/cfgtoollogs/crsconfig/
crspatch_srv-stb1_2017-01-11_07-27-40PM.log

[shutdown:shutdown] GIShutDownAction action completed on 
home /u01/app/12.1.0.2/grid successfully
[offline:prepare] Executing RACPatchingAction action on 
home /u01/app/oracle/product/12.1.0.2/dbhome_1

Performing prepatch operation on RAC Home........

[offline:prepare] RACPatchingAction action completed on home /
u01/app/oracle/product/12.1.0.2/dbhome_1 successfully
[offline:binary-patching] Executing OPatchAutoBinaryAction 
action on home /u01/app/oracle/product/12.1.0.2/dbhome_1

Start applying binary patches on RAC Home........


[offline:binary-patching] OPatchAutoBinaryAction action 
completed on home /u01/app/oracle/product/12.1.0.2/dbhome_1 
successfully

[offline:finalize] Executing RACPatchingAction action on 
home /u01/app/oracle/product/12.1.0.2/dbhome_1

Performing postpatch operation on RAC Home........

[offline:finalize] RACPatchingAction action completed on home /
u01/app/oracle/product/12.1.0.2/dbhome_1 successfully
[offline:binary-patching] Executing OPatchAutoBinaryAction 
action on home /u01/app/12.1.0.2/grid

Start applying binary patches on CRS Home........


[offline:binary-patching] OPatchAutoBinaryAction action 
completed on home /u01/app/12.1.0.2/grid successfully
[startup:startup] Executing GIStartupAction action on home /
u01/app/12.1.0.2/grid

Performing postpatch operations on CRS Home........


Postpatch operation log file location: /u01/app/12.1.0.2/
grid/cfgtoollogs/crsconfig/
crspatch_srv-stb1_2017-01-11_07-34-12PM.log

[startup:startup] GIStartupAction action completed on home /
u01/app/12.1.0.2/grid successfully
[startup:startup] Executing RACOneAction action on home /
u01/app/oracle/product/12.1.0.2/dbhome_1

/u01/app/oracle/product/12.1.0.2/dbhome_1 is not a RACOne 
database. No step execution required........

[startup:startup] RACOneAction action completed on home /
u01/app/oracle/product/12.1.0.2/dbhome_1 successfully
[startup:finalize] Executing RACFinalizeStartAction action 
on home /u01/app/oracle/product/12.1.0.2/dbhome_1

No step execution required.........

[startup:finalize] RACFinalizeStartAction action completed 
on home /u01/app/oracle/product/12.1.0.2/dbhome_1 successfully

[online:product-patching] Executing RACOnlineAction action 
on home /u01/app/oracle/product/12.1.0.2/dbhome_1

Trying to apply SQL patches on RAC Home.

[WARNING] The database instance 'stb1' from '/u01/app/oracle/
product/12.1.0.2/dbhome_1', in host'srv-stb1' is not running. 
SQL changes, if any,  will not be applied.

To apply. the SQL changes, bring up the database instance 
and run the command manually from any one node (run as oracle).

Refer to the readme to get the correct steps for applying 
the sql changes.

[online:product-patching] RACOnlineAction action completed 
on home /u01/app/oracle/product/12.1.0.2/dbhome_1 
successfully

[finalize:finalize] Executing OracleHomeLSInventoryGrepAction 
action on home /u01/app/12.1.0.2/grid

Verifying patches applied on CRS Home.

[finalize:finalize] OracleHomeLSInventoryGrepAction action 
completed on home /u01/app/12.1.0.2/grid successfully
[finalize:finalize] Executing OracleHomeLSInventoryGrepAction 
action on home /u01/app/oracle/product/12.1.0.2/dbhome_1

Verifying patches applied on RAC Home.

[finalize:finalize] OracleHomeLSInventoryGrepAction action 
completed on home /u01/app/oracle/product/12.1.0.2/dbhome_1 
successfully

---------------------Summary--------------------------------

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

Host:srv-stb1
RAC Home:/u01/app/oracle/product/12.1.0.2/dbhome_1
Summary:

==Following patches were SKIPPED:

Patch: /u01/patch/24448103/21436941
Reason: This patch is not applicable to this specified 
target type - "rac_database"

Patch: /u01/patch/24448103/24007012
Reason: This patch is not applicable to this specified 
target type - "rac_database"


==Following patches were SUCCESSFULLY applied:

Patch: /u01/patch/24448103/24340679
Log: /u01/app/oracle/product/12.1.0.2/dbhome_1/cfgtoollogs/
opatchauto/core/opatch/opatch2017-01-11_19-28-50PM_1.log

Patch: /u01/patch/24448103/24846605
Log: /u01/app/oracle/product/12.1.0.2/dbhome_1/cfgtoollogs/
opatchauto/core/opatch/opatch2017-01-11_19-28-50PM_1.log


Host:srv-stb1
CRS Home:/u01/app/12.1.0.2/grid
Summary:

==Following patches were SKIPPED:

Patch: /u01/patch/24448103/21436941
Reason: This patch is already been applied, so not going 
to apply again.


==Following patches were SUCCESSFULLY applied:

Patch: /u01/patch/24448103/24007012
Log: /u01/app/12.1.0.2/grid/cfgtoollogs/opatchauto/core/
opatch/opatch2017-01-11_19-30-22PM_1.log

Patch: /u01/patch/24448103/24340679
Log: /u01/app/12.1.0.2/grid/cfgtoollogs/opatchauto/core/
opatch/opatch2017-01-11_19-30-22PM_1.log

Patch: /u01/patch/24448103/24846605
Log: /u01/app/12.1.0.2/grid/cfgtoollogs/opatchauto/core/
opatch/opatch2017-01-11_19-30-22PM_1.log


OPatchAutosuccessful.

Aplique novamente o patch 21923026 que havíamos feito rollback.

[stb1.oracle@srv-stb1 patch]$ unzip 
p21923026_12102161018ProactiveBP_Linux-x86-64.zip
Archive:  p21923026_12102161018ProactiveBP_Linux-x86-64.zip
   creating: 21923026/
  inflating: 21923026/README.txt
   creating: 21923026/files/
   creating: 21923026/files/lib/
   creating: 21923026/files/lib/libserver12.a/
  inflating: 21923026/files/lib/libserver12.a/kdo.o
  inflating: 21923026/files/lib/libserver12.a/kdblc.o
  inflating: 21923026/files/lib/libserver12.a/kd9ir2c.o
   creating: 21923026/etc/
   creating: 21923026/etc/config/
  inflating: 21923026/etc/config/actions.xml
  inflating: 21923026/etc/config/inventory.xml
replace PatchSearch.xml? [y]es, [n]o, [A]ll, [N]one, [r]ename: A
  inflating: PatchSearch.xml

Antes de aplicar primeiro verifique se há algum conflito.

[stb1.oracle@srv-stb1 21923026]$ opatch prereq 
CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 12.1.0.1.12
Copyright (c) 2017, Oracle Corporation.  All rights reserved.

PREREQ session

Oracle Home       : /u01/app/oracle/product/12.1.0.2/
dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/12.1.0.2/
   dbhome_1/oraInst.loc
OPatch version    : 12.1.0.1.12
OUI version       : 12.1.0.2.0
Log file location : /u01/app/oracle/product/12.1.0.2/
dbhome_1/cfgtoollogs/opatch/opatch2017-01-11_21-01-27PM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatchsucceeded.

Como não vamos usar o opatchauto para este patch, aplique o patch em questão somente no nó local e ao terminar neste nó faça o mesmo procedimento no outro nó.
Aplique o patch com a opção -local.

[stb1.oracle@srv-stb1 21923026]$ opatch apply -local
Oracle Interim Patch Installer version 12.1.0.1.12
Copyright (c) 2017, Oracle Corporation.  All rights 
reserved.


Oracle Home       : /u01/app/oracle/product/12.1.0.2/
dbhome_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/12.1.0.2/
   dbhome_1/oraInst.loc
OPatch version    : 12.1.0.1.12
OUI version       : 12.1.0.2.0
Log file location : /u01/app/oracle/product/12.1.0.2/
dbhome_1/cfgtoollogs/opatch/opatch2017-01-11_21-06-57PM_1.log

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

Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.


Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '21923026' to OH '/u01/app/oracle/
product/12.1.0.2/dbhome_1'

Patching component oracle.rdbms, 12.1.0.2.0...
Patch 21923026 successfully applied.
Log file location: /u01/app/oracle/product/12.1.0.2/
dbhome_1/cfgtoollogs/opatch/
opatch2017-01-11_21-06-57PM_1.log

OPatchsucceeded.

Agora verifique os patches aplicados novamente. Observe que o patch que aplicamos é um Bundle Patch que é composto de 4 patches. O patch aplicado foi o BP 12.1.0.2.161018 que consta com o número 24340679.

[stb1.oracle@srv-stb1 21923026]$ opatch lspatches
21923026;
24846605;OCW Interim patch for 24846605
24340679;DATABASE BUNDLE PATCH: 12.1.0.2.161018 (24340679)
23177536;Database PSU 12.1.0.2.160719, Oracle JavaVM Component (JUL2016)
23520664;OCW Interim patch for 23520664

OPatch succeeded.

Agora suba a instância novamente.

[stb1.oracle@srv-stb1 OPatch]$ srvctl start instance -i stb1 -d stb

Conecte-se no Broker e altere a instância que está com o redoapply em execução.

[stb1.oracle@srv-stb1 u01]$ dgmgrl /

DGMGRL> show database stb;

Database - stb

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      0 seconds (computed 0 seconds ago)
  Apply Lag:          0 seconds (computed 0 seconds ago)
  Average Apply Rate: 1.23 MByte/s
  Real Time Query:    OFF
  Instance(s):
    stb1
    stb2 (apply instance)

Database Status:
SUCCESS

DGMGRL> edit database stb set state=apply-off;
Succeeded.
DGMGRL> edit database stb set state=apply-on with apply 
instance=stb1;

Succeeded.
DGMGRL> show database stb;

Database - stb

  Role:               PHYSICAL STANDBY
  Intended State:     APPLY-ON
  Transport Lag:      0 seconds (computed 0 seconds ago)
  Apply Lag:          0 seconds (computed 0 seconds ago)
  Average Apply Rate: 8.51 MByte/s
  Real Time Query:    OFF
  Instance(s):
    stb1 (apply instance)
stb2 

Database Status:
SUCCESS

Feito isso é só repetir todo o procedimento no nó 2. Não vou apresentar aqui para não ficar repetido, mas o passo a passo é o mesmo.

Espero que este artigo seja útil em algum momento e que agregue conhecimentos a você que o leu.

Abraços e até o próximo artigo.

Referências:

https://docs.oracle.com/database/121/HABPT/schedule_outage.htm#HABPT5321


Franky Weber Faust atua como administrador de banco de dados Oracle e MySQL no PagSeguro, tem 26 anos, é graduado em Tecnologia em Bancos de Dados e iniciou sua carreira trabalhando num projeto internacional da Volkswagen com os bancos de dados DB2 da IBM, SQL Server da Microsoft e também com o Oracle e desde o início direcionou seus estudos para as tecnologias Oracle. É especialista em tecnologias de Alta Disponibilidade como RAC, Dataguard e GoldenGate e compartilha seus conhecimentos no blog loredata.com.br. Possui as certificações OCE SQL, OCA 11g, OCP 12c, OCS RAC 12c e OCS Linux 6.

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.