补丁包目录在/soft
p35643107_190000_Linux-x86-64.zip–db补丁
p35648110_190000_Linux-x86-64.zip–OJVM补丁
p6880880_190000_Linux-x86-64.zip–Opatch40版本
#========================#
# DB补丁 #
#========================#
#root用户给压缩包授权
cd /soft
chmod 777 *
#切换oracle用户
su - oracle
#解压补丁包
cd /soft
ls p*.zip | xargs -n1 unzip -o
#备份并替换OPatch目录并授权
mv $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch.bak
mv OPatch $ORACLE_HOME/
chmod -R 775 $ORACLE_HOME/OPatch
chown -R oracle:oinstall $ORACLE_HOME/OPatch
#给补丁包授权
cd /soft/
chmod -R 775 35643107 35648110
chown -R oracle:oinstall 35643107 35648110
#验证补丁
cd 35643107/
opatch prereq CheckConflictAgainstOHWithDetail -ph ./
cd ../35648110
opatch prereq CheckConflictAgainstOHWithDetail -ph ./
cd 35643107/
#停止监听与数据库
lsnrctl stop
sqlplus / as sysdba
shutdown immediate
quit
#应用补丁
opatch apply
opatch lspatches
#启动数据库
sqlplus / as sysdba
startup
quit
#验证数据字典
cd $ORACLE_HOME/OPatch
./datapatch -verbose
#编译无效对象
cd $ORACLE_HOME/rdbms/admin
sqlplus / as sysdba
@utlrp.sql
#========================#
# OJVM补丁 #
#========================#
#停数据库
shutdown immediate
quit
#应用补丁
cd /soft/35648110
opatch apply
opatch lspatches
#启动数据库
sqlplus / as sysdba
startup
quit
#验证数据字典
cd $ORACLE_HOME/OPatch
./datapatch -verbose
#编译无效对象
cd $ORACLE_HOME/rdbms/admin
sqlplus / as sysdba
@utlrp.sql
quit
#========================#
# 结束,启动监听 #
#========================#
lsnrctl start