• Opatching PSU in Oracle Database 11g Release 2 RAC on RHEL6


    Opatching PSU in Oracle Database 11g Release 2(11.2.0.4) RAC on RHEL6

    1) 升级opatch工具

    1.1) For GI home
    su - root
    
    export GI_HOME=$(grep '^+ASM' /etc/oratab |awk -F: '{ print $2 }')
    [[ -d "${GI_HOME}/OPatch" ]] && mv ${GI_HOME}/OPatch ${GI_HOME}/OPatch_$(date +%Y%m%d)
    unzip -q p6880880_*_Linux-x86-64.zip -d ${GI_HOME}
    ls -ld ${GI_HOME}/OPatch*
    chown -R grid:oinstall ${GI_HOME}/OPatch
    chmod -R +x ${GI_HOME}/OPatch
    ls -ld ${GI_HOME}/OPatch*
    su - grid
    ${ORACLE_HOME}/OPatch/opatch version
    # --创建响应文件
    (sleep 3;echo -e '
    ';sleep 3;echo -e 'Y
    ')|${ORACLE_HOME}/OPatch/ocm/bin/emocmrsp -no_banner -output /tmp/ocm.rsp
    
    1.2) For DB home
    su - oracle
    
    [[ -d "${ORACLE_HOME}/OPatch" ]] && mv ${ORACLE_HOME}/OPatch ${ORACLE_HOME}/OPatch_$(date +%Y%m%d)
    ls -ld ${ORACLE_HOME}/OPatch*
    unzip -q p6880880_*_Linux-x86-64.zip -d ${ORACLE_HOME}
    ls -ld ${ORACLE_HOME}/OPatch*
    ${ORACLE_HOME}/OPatch/opatch version

    2) 安装GI PSU补丁

    su - root
    export GI_HOME=$(grep '^+ASM' /etc/oratab |awk -F: '{ print $2 }')
    export DB_HOME=$(grep -Ev '^#|^$|+ASM' /etc/oratab |awk -F: '{ print $2 }')
    # su - grid -c "(sleep 3;echo -e '
    ';sleep 3;echo -e 'Y
    ')|${GI_HOME}/OPatch/ocm/bin/emocmrsp -no_banner -output /tmp/ocm.rsp"
    su - grid -c "unzip -oq p28317141_112040_Linux-x86-64.zip -d /apps/soft"
    export UNZIPPED_PATCH_LOCATION=/apps/soft/28317141
    export LANG=C
    ${GI_HOME}/OPatch/opatch auto ${UNZIPPED_PATCH_LOCATION}/27967757 -ocmrf /tmp/ocm.rsp
    
    -- 检查确认
    su - grid -c "${GI_HOME}/bin/crsctl status res -t"
    su - grid -c "${GI_HOME}/OPatch/opatch lspatches;${GI_HOME}/OPatch/opatch lsinventory"
    su - oracle -c "${DB_HOME}/OPatch/opatch lspatches;${DB_HOME}/OPatch/opatch lsinventory"

    3) 升级数据字典

    su - oracle
    sqlplus /nolog << EOF
    connect / as sysdba
    @?/rdbms/admin/catbundle.sql psu apply
    @?/rdbms/admin/utlrp.sql
    set lines 168 pages 99
    col action_time for a20
    col action for a15
    col namespace for a12
    col version for a18
    col id for 99999999
    col bundle_series for a15
    col comments for a28
    prompt db version
    select to_char(t1.action_time,'yyyy-mm-dd hh24:mi:ss') action_time,t1.action,t1.namespace,t1.version,id,t1.bundle_series,t1.comments from dba_registry_history t1 order by t1.action_time;
    prompt 
    prompt comp info
    col comp_name for a48
    col comp_id for a12
    col version for a16
    col status for a12
    col modified for a20
    select t2.comp_id, t2.comp_name, t2.version, t2.status, to_char(to_date(t2.modified,'dd-mm-yyyy hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') modified from dba_registry t2 order by t2.modified,t2.comp_id;
    quit;
    EOF

    4) 安装OJVM PSU

    su - oracle
    
    # 关闭db home的所有服务
    srvctl stop database -d orcl
    
    # 冲突检查
    PATCH_TOP_DIR=/apps/soft/28317141
    cd ${PATCH_TOP_DIR}/27923163
    opatch prereq CheckConflictAgainstOHWithDetail -ph ./
    
    # 安装补丁
    (sleep 3;echo -e 'Y
    ';sleep 3;echo -e '
    ';sleep 3;echo -e 'Y
    ';sleep 3;echo -e 'Y
    ')|${ORACLE_HOME}/OPatch/opatch apply
    
    # 结果检查确认
    ${ORACLE_HOME}/OPatch/opatch lspatches;${ORACLE_HOME}/OPatch/opatch lsinventory

    5) 升级数据字典

    sqlplus /nolog << EOF
    host srvctl start instance -d orcl -i orcl1
    connect / as sysdba
    alter system set cluster_database=false scope=spfile;
    host srvctl stop instance -d orcl -i orcl1
    connect / as sysdba
    startup upgrade
    @?/sqlpatch/27923163/postinstall.sql
    alter system set cluster_database=true scope=spfile;
    host srvctl stop instance -d orcl -i orcl1
    host srvctl start database -d orcl
    connect / as sysdba
    @?/rdbms/admin/utlrp.sql
    set lines 168 pages 99
    col action_time for a20
    col action for a15
    col namespace for a12
    col version for a24
    col id for 99999999
    col bundle_series for a15
    col comments for a28
    prompt db version
    select to_char(t1.action_time,'yyyy-mm-dd hh24:mi:ss') action_time,t1.action,t1.namespace,t1.version,id,t1.bundle_series,t1.comments from dba_registry_history t1 order by t1.action_time;
    prompt 
    prompt comp info
    col comp_name for a48
    col comp_id for a12
    col version for a16
    col status for a12
    col modified for a20
    select t2.comp_id, t2.comp_name, t2.version, t2.status, to_char(to_date(t2.modified,'dd-mm-yyyy hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss') modified from dba_registry t2 order by t2.modified,t2.comp_id;
    quit;
    EOF
  • 相关阅读:
    剑指offer--50.滑动窗口的最大值
    剑指offer--49.矩阵中的路径
    剑指offer--48.机器人的运动范围
    剑指offer--47.数据流中的中位数
    剑指offer--46.字符流中第一个不重复的字符
    剑指offer--45.二叉树的深度
    剑指offer--44.两个链表的第一个公共结点
    剑指offer--43.连续子数组的最大和
    海盗分宝石问题
    C++数组名退化指针实例
  • 原文地址:https://www.cnblogs.com/binliubiao/p/9609002.html
Copyright © 2020-2023  润新知