check database patch with opatch tools

zhanglei_itput發表於2009-07-20

  
    當給資料庫打完patch以後,如何查詢是否打patch成功?
    或者,剛剛接到一個資料庫伺服器,如何查詢這個資料庫伺服器都曾經打過哪些patch?

1. 下載並安裝opatch工具
   下載:p6880880_102000_LINUX.zip
   解壓:unzip p6880880_102000_LINUX.zip OPatch
   更新環境變數: vi .bash_profile 追加PATH引數
                  export PATH=$ORACLE_HOME/bin:$ORA_CRS_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin:/home/oracle/OPatch
                 
2.opatch的命令
  a.查詢opatch的用法
    [oracle@rac1 ~]$ opatch
    /home/oracle/OPatch/opatch: line 55: [: =: unary operator expected
    Invoking OPatch 10.2.0.4.7     
    Oracle Interim Patch Installer version 10.2.0.4.7
    Copyright (c) 2009, Oracle Corporation.  All rights reserved.     
    Syntax Error... No command specified.     
     Usage: opatch [ -help ] [ -r[eport] ] [ command ]     
                command := auto
                           apply
                           lsinventory
                           napply
                           nrollback
                           rollback
                           query
                           version
                           prereq
                           util     
     := -help       Displays the help message for the command.
                           -report     Print the actions without executing.     
     example:
       'opatch -help'
       'opatch auto -help'
       'opatch apply -help'
       'opatch lsinventory -help'
       'opatch napply -help'
       'opatch nrollback -help'
       'opatch rollback -help'
       'opatch prereq -help'
       'opatch util -help'
    OPatch failed with error code 14

  b.list資料庫patch
    [oracle@rac1 ~]$ opatch lsinventory
    Invoking OPatch 10.2.0.4.7     
    Oracle Interim Patch Installer version 10.2.0.4.7
    Copyright (c) 2009, Oracle Corporation.  All rights reserved.     
    Oracle Home       : /u01/app/oracle/product/10.2.0/db_1
    Central Inventory : /u01/app/oracle/oraInventory
       from           : /etc/oraInst.loc
    OPatch version    : 10.2.0.4.7
    OUI version       : 10.2.0.4.0
    OUI location      : /u01/app/oracle/product/10.2.0/db_1/oui
    Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2009-07-20_17-48-38PM.log     
    Patch history file: /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt     
    Lsinventory Output file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2009-07-20_17-48-38PM.txt     
    --------------------------------------------------------------------------------
    Installed Top-level Products (2):      
    Oracle Database 10g                                                  10.2.0.1.0
    Oracle Database 10g Release 2 Patch Set 3                            10.2.0.4.0

    There are 2 products installed in this Oracle Home.     
    There are no Interim patches installed in this Oracle Home.     
    Rac system comprising of multiple nodes
      Local node = rac1
      Remote node = rac2     
    --------------------------------------------------------------------------------     
    OPatch succeeded.

3. 也可以透過sql語句來查詢
Run the following command to check the status of all the components after the upgrade:

SQL> select comp_name, version, status from sys.dba_registry;
 
COMP_NAME                      VERSION                        STATUS
------------------------------ ------------------------------ ----------------------
Oracle Enterprise Manager      10.2.0.4.0                     VALID
Spatial                        10.2.0.4.0                     VALID
Oracle interMedia              10.2.0.4.0                     VALID
OLAP Catalog                   10.2.0.4.0                     VALID
Oracle XML Database            10.2.0.4.0                     VALID
Oracle Text                    10.2.0.4.0                     VALID
Oracle Expression Filter       10.2.0.4.0                     VALID
Oracle Rules Manager           10.2.0.4.0                     VALID
Oracle Workspace Manager       10.2.0.4.3                     VALID
Oracle Data Mining             10.2.0.4.0                     VALID
Oracle Database Catalog Views  10.2.0.4.0                     VALID
 
COMP_NAME                      VERSION                        STATUS
------------------------------ ------------------------------ ----------------------
Oracle Database Packages and T 10.2.0.4.0                     VALID
ypes
 
JServer JAVA Virtual Machine   10.2.0.4.0                     VALID
Oracle XDK                     10.2.0.4.0                     VALID
Oracle Database Java Packages  10.2.0.4.0                     VALID
OLAP Analytic Workspace        10.2.0.4.0                     VALID
Oracle OLAP API                10.2.0.4.0                     VALID
Oracle Real Application Cluste 10.2.0.4.0                     VALID

In the output of the preceding command, the status of all the components should be VALID for a successful upgrade


參考文獻:

1.  Subject:  Opatch - Where Can I Find the Latest Version of Opatch?
    Doc ID:  224346.1 Type:  BULLETIN
    Modified Date :  28-MAY-2009 Status:  PUBLISHED
   
2. 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9252210/viewspace-609748/,如需轉載,請註明出處,否則將追究法律責任。

相關文章