多实例数据库一个用PSU
作者:互联网
背景:
现在Oracle 11gR2 扩展补丁最新已经到20200714了,今天给生产系统打了几个系统补丁,有很多设备上是一台服务器创建了十几个数据库,这样涉及到后面跑脚本和启停数据库是一件非常麻烦的事,特写这篇博客在这里记录今天的完整处理过程。
1.解压替换OPatch
cd psu
cd $ORACLE_HOME/
mv OPatch/ OPatch_bak
cd ~/psu
unzip p6880880_112000_Linux-x86-64.zip -d $ORACLE_HOME/
unzip p31326405_112040_Linux-x86-64.zip
2.关闭数据库和监听
lsnrctl stop
sqlplus / as sysdba
shut immediate
3.应用补丁
cd 31326405/31103343
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
$ORACLE_HOME/OPatch/opatch apply
cd …/31219953
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
$ORACLE_HOME/OPatch/opatch apply
4.检查补丁是否已经打上
[oracle@pjs-jypt 31103343]$ $ORACLE_HOME/OPatch/opatch lspatches
31219953;OJVM PATCH SET UPDATE 11.2.0.4.200714
31103343;Database Patch Set Update : 11.2.0.4.200714 (31103343)
OPatch succeeded.
5.跑升级脚本
sqlplus / as sysdba
@?/rdbms/admin/catbundle.sql psu apply
@?/rdbms/admin/utlrp.sql
多库环境操作步骤:
1.获取所有数据库的SID信息
[db-oracle@CXDB~/psu]$ps -ef|grep pmon |grep -v grep
oracle 1194 1 0 18:39 ? 00:00:00 ora_pmon_dsgmon
oracle 1296 1 0 18:39 ? 00:00:00 ora_pmon_zzdb
oracle 1411 1 0 18:40 ? 00:00:00 ora_pmon_db
oracle 1525 1 0 18:40 ? 00:00:00 ora_pmon_SKDB
oracle 1645 1 0 18:40 ? 00:00:00 ora_pmon_ZXDB
oracle 1801 1 0 18:40 ? 00:00:00 ora_pmon_OADB
oracle 1908 1 0 18:40 ? 00:00:00 ora_pmon_QCDB
grid 10471 1 0 Jul03 ? 00:07:03 asm_pmon_+ASM
2.配置停库脚本
#!/bin/ksh
ORACLE_SID="$1"
echo $i
sqlplus / as sysdba << EOF
shut immediate;
exit
EOF
sh shut.sh dsgmon
sh shut.sh zzdb
sh shut.sh db
sh shut.sh SKDB
sh shut.sh ZXDB
sh shut.sh OADB
sh shut.sh QCDB
3.应用补丁
cd 31326405/31103343
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
$ORACLE_HOME/OPatch/opatch apply
cd …/31219953
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
$ORACLE_HOME/OPatch/opatch apply
4.跑升级脚本
#!/bin/ksh
ORACLE_SID="$1"
echo $i
sqlplus / as sysdba << EOF
startup
@?/rdbms/admin/catbundle.sql psu apply;
@?/rdbms/admin/utlrp.sql;
shutdown immediate;
exit
EOF
sh exec_psu.sh dsgmon
sh exec_psu.sh zzdb
sh exec_psu.sh db
sh exec_psu.sh SKDB
sh exec_psu.sh ZXDB
sh exec_psu.sh OADB
sh exec_psu.sh QCDB
5.重启数据库:
lsnrctl start
#!/bin/ksh
ORACLE_SID="$1"
echo $i
sqlplus / as sysdba << EOF
startup force
exit
EOF
sh restart.sh dsgmon
sh restart.sh zzdb
sh restart.sh db
sh restart.sh SKDB
sh restart.sh ZXDB
sh restart.sh OADB
sh restart.sh QCDB
来自 “ 开源世界 ” ,链接:http://ym.baisou.ltd/?id=516,如需转载,请注明出处,否则将追究法律责任。
标签:00,数据库,OPatch,sh,实例,ORACLE,HOME,psu,PSU 来源: https://blog.csdn.net/qq_39221436/article/details/116786431