Como aplicar patch manualmente no banco Oracle

Neste tutorial vamos como podemos corrigir nosso banco de dados Oracle usando a ferramenta opatch manual.

  • 1- Precisamos baixar o patch que deseja aplicar ao nosso banco de dados. Isso é com você a partir de onde você consegue seus patches.
  • Coloque o patch no dir tmp.
  • 2- Pare os bancos de dados que são até receber o patch. Lembre-se que todas as outras instâncias que fazem uso do mesmo Oracle_Home precisará ser interrompido caso contrário, você vai ter uma "opatch falhou com o código de erro 41" erro.
  •  [oracle@DCG023 8828328]$ opatch apply
    Oracle Interim Patch Installer version 11.2.0.3.4
    Copyright (c) 2012, Oracle Corporation.  All rights reserved.
    
    
    Oracle Home       : /u00/product/11.2.0/dbhome_1
    Central Inventory : /u00/oraInventory
       from           : /u00/product/11.2.0/dbhome_1/oraInst.loc
    OPatch version    : 11.2.0.3.4
    OUI version       : 11.2.0.1.0
    Log file location : /u00/product/11.2.0/dbhome_1/cfgtoollogs/opatch/8828328_Nov_13_2013_14_00_02/apply2013-11-13_14-00-02PM_1.log
    
    Applying interim patch '8828328' to OH '/u00/product/11.2.0/dbhome_1'
    Verifying environment and performing prerequisite checks...
    Prerequisite check "CheckActiveFilesAndExecutables" failed.
    The details are:
    
    
    Following executables are active :
    /u00/product/11.2.0/dbhome_1/bin/oracle
    Log file location: /u00/product/11.2.0/dbhome_1/cfgtoollogs/opatch/8828328_Nov_13_2013_14_00_02/apply2013-11-13_14-00-02PM_1.log
    
    Recommended actions: OPatch needs to modify files which are being used by some processes.
    
    OPatch failed with error code 41
    
    #Right now let's stop the database.
    
    [oracle@DCG023 8828328]$ sqlplus / as sysdba
    SQL*Plus: Release 11.2.0.1.0 Production on Wed Nov 13 14:00:27 2013
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    
    SQL> shutdown immediate;
    
     
  • 3- Descompacte o patch e ir para dentro dela.
  •  [oracle@DCG023 patch]$ unzip p8828328_112010_Linux-x86-64.zip
    Archive:  p8828328_112010_Linux-x86-64.zip
       creating: 8828328/
       creating: 8828328/files/
       creating: 8828328/files/lib/
       creating: 8828328/files/lib/libserver11.a/
      inflating: 8828328/files/lib/libserver11.a/kks.o
      inflating: 8828328/files/lib/libserver11.a/kksc.o
       creating: 8828328/etc/
       creating: 8828328/etc/config/
      inflating: 8828328/etc/config/inventory.xml
      inflating: 8828328/etc/config/actions.xml
       creating: 8828328/etc/xml/
      inflating: 8828328/etc/xml/GenericActions.xml
      inflating: 8828328/etc/xml/ShiphomeDirectoryStructure.xml
      inflating: 8828328/README.txt
    
    [oracle@DCG023 patch]$ cd 8828328/
    
     
  • 4- Liste os patch existentes aplicados ao seu banco de dados.
  •  [oracle@DCG023 8828328]$ opatch lsinventory
    Oracle Interim Patch Installer version 11.2.0.3.4
    Copyright (c) 2012, Oracle Corporation.  All rights reserved.
    
    Oracle Home       : /u00/product/11.2.0/dbhome_1
    Central Inventory : /u00/oraInventory
       from           : /u00/product/11.2.0/dbhome_1/oraInst.loc
    OPatch version    : 11.2.0.3.4
    OUI version       : 11.2.0.1.0
    Log file location : /u00/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2013-11-13_13-55-22PM_1.log
    Lsinventory Output file location : /u00/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2013-11-13_13-55-22PM.txt
    
    --------------------------------------------------------------------------------
    Installed Top-level Products (1):
    Oracle Database 11g                                                  11.2.0.1.0
    There are 1 products installed in this Oracle Home.
    
    Interim patches (1) :
    Patch  8405205      : applied on Mon Aug 19 15:18:04 BRT 2013
    Unique Patch ID:  11805160
       Created on 23 Sep 2009, 02:41:32 hrs PST8PDT
       Bugs fixed:
         8405205
    --------------------------------------------------------------------------------
    OPatch succeeded.
    
     
  • 5- Aplique o patch usando a opção "apply" dentro do diretório de patch descompactado.
  • [oracle@DCG023 8828328]$ opatch apply
    Oracle Interim Patch Installer version 11.2.0.3.4
    Copyright (c) 2012, Oracle Corporation.  All rights reserved.
    Oracle Home        : /u00/product/11.2.0/dbhome_1
    Central Inventory : /u00/oraInventory from  : /u00/product/11.2.0/dbhome_1/oraInst.loc
    OPatch version    : 11.2.0.3.4
    OUI version       : 11.2.0.1.0
    Log file location : /u00/product/11.2.0/dbhome_1/cfgtoollogs/opatch/8828328_Nov_13_2013_14_03_40/apply2013-11-13_14-03-39PM_1.log
    Applying interim patch '8828328' to OH '/u00/product/11.2.0/dbhome_1'
    Verifying environment and performing prerequisite checks...
     All checks passed.
     Provide your email address to be informed of security issues, install and
     initiate Oracle Configuration Manager. Easier for you if you use your My
     Oracle Support Email address/User Name.
     Visit http://www.oracle.com/support/policies.html for details.
     Email address/User Name:
    You have not provided an email address for notification of security issues.
     Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]:  Y
     Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
     (Oracle Home = '/u00/product/11.2.0/dbhome_1')
     Is the local system ready for patching? [y|n]
     y
     User Responded with: Y
     Backing up files...
     Patching component oracle.rdbms, 11.2.0.1.0...
     Verifying the update...
     .....
    Patch 8828328 successfully applied
    Log file location: /u00/product/11.2.0/dbhome_1/cfgtoollogs/opatch/8828328_Nov_13_2013_14_03_40/apply2013-11-13_14-03-39PM_1.log
    
    OPatch succeeded.
    
    
     
  • 6- Verifique o patch aplicado.
  •  [oracle@DCG023 8828328]$ opatch lsinventory
    Oracle Interim Patch Installer version 11.2.0.3.4
    Copyright (c) 2012, Oracle Corporation.  All rights reserved.
    
    
    Oracle Home       : /u00/product/11.2.0/dbhome_1
    Central Inventory : /u00/oraInventory
       from           : /u00/product/11.2.0/dbhome_1/oraInst.loc
    OPatch version    : 11.2.0.3.4
    OUI version       : 11.2.0.1.0
    Log file location : /u00/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2013-11-13_14-06-48PM_1.log
    
    Lsinventory Output file location : /u00/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2013-11-13_14-06-48PM.txt
    
    --------------------------------------------------------------------------------
    Installed Top-level Products (1):
    Oracle Database 11g                                                  11.2.0.1.0
    There are 1 products installed in this Oracle Home.
    Interim patches (2) :
    
    Patch  8828328      : applied on Wed Nov 13 14:04:35 BRST 2013
    Unique Patch ID:  11870171
       Created on 14 Oct 2009, 10:15:56 hrs PST8PDT
       Bugs fixed:
         8828328
    Patch  8405205      : applied on Mon Aug 19 15:18:04 BRT 2013
    Unique Patch ID:  11805160
       Created on 23 Sep 2009, 02:41:32 hrs PST8PDT
       Bugs fixed:
         8405205
    --------------------------------------------------------------------------------
    OPatch succeeded.
    
     

    Patch applyed.

  • 7- Iniciar o seu banco de dados.
  •  [oracle@DCG023 ~]$ sqlplus / as sysdba
    
    SQL*Plus: Release 11.2.0.1.0 Production on Wed Nov 13 14:05:13 2013
    
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    
    Connected to an idle instance.
    
    SQL> startup;
    ORACLE instance started.
    
    Total System Global Area 2505338880 bytes
    Fixed Size                  2215944 bytes
    Variable Size            1879052280 bytes
    Database Buffers          603979776 bytes
    Redo Buffers               20090880 bytes
    Database mounted.
    Database opened.