Focus On Oracle

Installing, Backup & Recovery, Performance Tuning,
Troubleshooting, Upgrading, Patching

Oracle Engineered System


当前位置: 首页 » 技术文章 » Oracle

如何使用oplan?

什么是oplan?

OPlan是一个很有用的工具,她会自动收集客户系统的信息,并够针对客户的环境,生成一个非常详细的应用补丁/回滚补丁的操作手册。和传统的应用补丁方式相比,她很大程度上简化了DBA的工作量,还能给出多种方案:包含'In place','out-of-place', rolling, non-rolling等。

A.'Out-of-Place':通过clone一个ORACLE_HOME,然后再应用

B.'In place':就是在现有的ORACLE_HOME上应用,又可以分为两种
     1.Rolling Mode: 按顺序将补丁应用到群集中的每个节点
         a.自动打补丁(opatchauto)
         b.手动打补丁(opatch)
     2.Non-Rolling Mode: 同时对所有群集节点应用补丁


oplan帮助
[oracle@ohs1 ~]$ $ORACLE_HOME/OPatch/oplan/oplan
from oplan /pgold/ordb/oracle/product/121/OPatch/oplan/../auto/core/bin/../../core/modules/features/oracle.glcm.oplan.core.classpath.jar:/pgold/ordb/oracle/product/121/OPatch/oplan/../auto/core/bin/../../core/modules/features/oracle.glcm.osys.core.classpath.jar:/pgold/ordb/oracle/product/121/OPatch/oplan/../auto/core/bin/../../database/modules/oplan_db.jar
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128M; support was removed in 8.0

Error: Invalid or insufficient command line argument. 0

usage: oplan  [-h] [-v] { generateSteps <patch> | generateApplySteps
             <patch> | generateRollbackSteps <patch> |
             saveConfigurationSnapshot <configXML> | configurationCompare
             <configXML1> [<configXML2>] } [-RACPatches <Comma separated
             list of patches to be applied to Database Homes>] [-GIPatches
             <Comma separated list of patches to be applied to Grid
             Infrastructure Homes>] [-NodeNumberPerReadme <Node Number for
             each readme file for a execution plan>]
 -customLogPath <customLogPath>               Location for OPatch core
                                              logs. Pass parameter as
                                              $ORACLE_HOME/path if to be
                                              logged inside OH
 -GIPatches <gipatches>                       Comma separated list of
                                              patches to be applied to
                                              Grid Infrastructure Homes
 -h,--help                                    Prints help message.
 -logDir <logDir>                             Directory for logging and
                                              output
 -MoveConfigToOH <MoveConfigToOH>             Database Home to migrate the
                                              config
 -NodeNumberPerReadme <NodeNumberPerReadme>   Node Number for each readme
                                              file for a execution plan
 -RACPatches <racpatches>                     Comma separated list of
                                              patches to be applied to
                                              Database Homes
 -v,--version                                 Prints OPlan's version
                                              information.

generateSteps
    - Generate apply and rollback instructions for the patch
generateApplySteps
    - Generate apply instructions for the patch
generateRollbackSteps
    - Generate rollback instructions for the patch
saveConfigurationSnapshot
    - Save current configuration information to XML file
configurationCompare
    - Compares two system configurations for any changes

Examples:
    
# Note: Always set ORACLE_HOME environment variable to Grid Infrastructure
    home before executing oplan command
export ORACLE_HOME=<path to GI home>

# Generate steps to apply and rollback patch
oplan generateSteps <path to GI bundle patch>

# Save the configuration of the system running from ORACLE_HOME to XML
oplan saveConfigurationSnapshot <path to save configuration xml file>

# Compare given configuration xml with the current configuration
oplan configurationCompare <configuration.xml>

# Compare two configuration xmls
oplan configurationCompare <configuration1.xml> <configuration2.xml>

# Generate steps to apply and rollback bundle patch with RAC/GI one-off
    patches
oplan generateSteps <path to GI bundle patch> -RACPatches <path to patch
    one>,....,<path to patch x> -GIPatches <path to patch one>,....,<path
    to patch x>
[oracle@ohs1 ~]$

如何获取oplan?
oplan包含在opatch里,可通过下载补丁6880880获得

查看oplan的版本
[oracle@ohs1 ~]$ /pgold/orgrid/oracle/product/121/OPatch/oplan/oplan -v
from oplan /pgold/orgrid/oracle/product/121/OPatch/oplan/../auto/core/bin/../../core/modules/features/oracle.glcm.oplan.core.classpath.jar:/pgold/orgrid/oracle/product/121/OPatch/oplan/../auto/core/bin/../../core/modules/features/oracle.glcm.osys.core.classpath.jar:/pgold/orgrid/oracle/product/121/OPatch/oplan/../auto/core/bin/../../database/modules/oplan_db.jar
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128M; support was removed in 8.0

oplan version: 12.2.0.1.8

Minimum OPatch version required for 11.2 targets: 11.2.0.3.0
Minimum OPatch version required for 12.1 targets: 12.1.0.1.0

[oracle@ohs1 ~]$
支持的配置
  产品名称 Patch类型 版本 平台
Oracle Database Oracle Exadata Database Machine Recommended Bundle Patches  11.2.0.2 Linux x86-64, Solaris x86-64
  Oracle GI/RAC running on normal clusters GI PSU and DB PSU 11.2.0.2 Linux x86-64, Solaris x86-64, Solaris SPARC (64 bit)
  Oracle SIHA/SIDB GI PSU and DB PSU 11.2.0.2 Linux x86-64, Solaris x86-64, Solaris SPARC (64 bit)
Oracle Database Oracle Exadata Database Machine Recommended Bundle Patches 11.2.0.3 Linux x86-64, Solaris x86-64, Solaris SPARC (64 bit)
  Oracle GI/RAC running on normal clusters GI PSU and DB PSU 11.2.0.3 Linux x86-64, Solaris x86-64, Solaris SPARC (64 bit)
  Oracle SIHA/SIDB GI PSU and DB PSU 11.2.0.3 Linux x86-64, Solaris x86-64, Solaris SPARC (64 bit)
Oracle Database Oracle Exadata Database Machine Recommended Bundle Patches 11.2.0.4 Linux x86-64, Solaris x86-64, Solaris SPARC (64 bit)
  Oracle SIHA/SIDB GI PSU and DB PSU 11.2.0.4 Linux x86-64, Solaris x86-64, Solaris SPARC (64 bit)
Oracle Database Oracle Exadata Database Machine Recommended Bundle Patches 12.1.0.2 Linux x86-64, Solaris x86-64, Solaris SPARC (64 bit)
12.1.0.1
  Oracle GI/RAC running on normal clusters GI PSU and DB PSU 12.1.0.2 Linux x86-64, Solaris x86-64, Solaris SPARC (64 bit)
12.1.0.1
  Oracle SIHA/SIDB GI PSU and DB PSU 12.1.0.2 Linux x86-64, Solaris x86-64, Solaris SPARC (64 bit)
12.1.0.1

oplan的限制
oplan并不是支持所有的数据库环境。有以下的限制
  A.oplan不支持共享ORACLE_HOME的配置
  B.oplan不支持单实例的数据库
  C.Data Guard也是不被支持的,oplan可以帮助生成计划,但是不会判断是否是'Data Guard Standby-First Patch Apply'

如何使用oplan
1.安装oplan
   下载补丁6880880
   备份当前的OPatch目录,并解压补丁6880880到所有节点的GI和DB的ORACLE_HOME
2.生成patch安装向导
[root@ohs1 121]# /pgold/orgrid/oracle/product/121/OPatch/oplan/oplan generateApplySteps /mnt/24448103
from oplan /pgold/orgrid/oracle/product/121/OPatch/oplan/../auto/core/bin/../../core/modules/features/oracle.glcm.oplan.core.classpath.jar:/pgold/orgrid/oracle/product/121/OPatch/oplan/../auto/core/bin/../../core/modules/features/oracle.glcm.osys.core.classpath.jar:/pgold/orgrid/oracle/product/121/OPatch/oplan/../auto/core/bin/../../database/modules/oplan_db.jar
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128M; support was removed in 8.0

Processing request...

Review the log messages captured in the following file: /pgold/orgrid/oracle/product/121/cfgtoollogs/oplan/2017-01-03-19-56-31/log.txt

Success!

Follow the instructions outlined in the following Installation Instructions document and patch your system:  

Apply Instructions (HTML)    : /pgold/orgrid/oracle/product/121/cfgtoollogs/oplan/2017-01-03-19-56-31/ApplyInstructions.html
Apply Instructions (TEXT)    : /pgold/orgrid/oracle/product/121/cfgtoollogs/oplan/2017-01-03-19-56-31/ApplyInstructions.txt

[root@ohs1 121]#
3.应用补丁
根据上一步生成的ApplyInstructions.html/ApplyInstructions.txt文件,结合实际环境去应用补丁
4.回滚补丁(可选步骤)
如果需要回滚补丁,可以先生成回滚向导,然后根据实际情况去操作
$ORACLE_HOME/OPatch/oplan/oplan generateRollbackSteps <bundle patch location>

点击浏览oplan样例


Reference
http://docs.oracle.com/database/121/HABPT/schedule_outage.htm#HABPT5402
https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&id=1306814.1
      
        

关键词:oplan opatch patch 

相关文章

如何在oracle 12c中正确的应用补丁?
如何使用opatchauto应用补丁?
如何使用oplan?
How to Apply Oracle Database Patch?
Oracle数据库补丁的分类和用途
12c新特性-OPatch Automation Tool(opatchauto)
Oracle数据库PSU/SPU/Bundle Patch号的变化
Top