Cum să facem patch manual de o baza de date Oracle

In acest tutorial, vom cum o putem patch colecțiilor de date Oracle nostru folosind instrumentul manual opatch.

  • 1 - Trebui sa facem download de patch-uri pe care vrem să se il aplicam in baza noastră de date. Copie patch-ul în dir tmp.
  • 2 - Opriți baza de date pentru a putea instala patch-ul. Amintiți-vă că toate celelalte instanțe care fac uz de aceeași ORACLE_HOME vor trebui să fie oprite în caz contrar va primi un "OPatch a eșuat cu codul de eroare 41" de eroare.
  •  [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
    
    <#Acum hai să oprim baza de date.
    
    [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- Dezarhiveaza patch și intra în interiorul acestuia.
  •  [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- Lista patch-urile existente aplicate la baza de date.
  •  [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- Aplicați patch cu ajutorul optinuni "apply" din interiorul directorul dezarhivat.
  • [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- Verificați patch-ul aplicat.
  •  [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- Startup baza de date.
  •  [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.