码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2018-09-08 15:19:55      阅读:276      评论:0      收藏:0      [点我收藏+]

标签:sof   sqlplus   undle   字典   ges   ase   amp   odi   name   

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 \n;sleep 3;echo -e Y\n)|${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 ‘\n‘;sleep 3;echo -e ‘Y\n‘)|${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\n;sleep 3;echo -e \n;sleep 3;echo -e Y\n;sleep 3;echo -e Y\n)|${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

 

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

标签:sof   sqlplus   undle   字典   ges   ase   amp   odi   name   

原文地址:https://www.cnblogs.com/wandering-mind/p/9609002.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!