手动升级:
软件包解压在新建的/home/grid/update 目录下
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
GRID_HOME=/u01/app/11.2.0/grid/

一、ORACLE 11G R2 RAC 备份

DB: 11.2.0.4
OS: REDHAT 6.X
PATCH: 20170718

建议:操作前停止所有应用服务,停止所有中间件服务,关闭监听。

1.1 数据库RMAN 全备,【见备份脚本】;

rman target / nocatalog log /home/oracle/rman_full.log <<EOF
run
{crosscheck backup;
crosscheck archivelog all;
delete noprompt expired archivelog all;
delete noprompt expired backup;
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
backup filesperset 6 database format '/backup/full_%d_%T_%s_%p.dbf';
sql 'alter system archive log current';
sql 'alter system archive log current';
backup archivelog from time 'sysdate-1/24' format '/backup/arch_%d_%T_%s_%p.arc';
backup current controlfile format '/backup/ctl_%d_%T_%s_%p.ctl';
backup spfile format '/backup/spfile_%d_%U';
restore database validate;
restore controlfile validate;
}
EOF

1.2 OCR 备份 【root用户执行备份】

OCR的自动备份:使用ocrconfig -showbackup查看ocr备份所在节点及路径
/u01/app/11.2.0/grid/bin/ocrconfig -showbackup

OCR的手动备份:
/u01/app/11.2.0/grid/bin/ocrconfig -manualbackup

备份完后查看新的备份:
/u01/app/11.2.0/grid/bin/ocrconfig -showbackup

如果OCR需要改变路径,建议导出这种方式:
/u01/app/11.2.0/grid/bin/ocrconfig -export /u01/ocr_20180124.ocr

1.3 OLR 备份
查看路径: /u01/app/11.2.0/grid/bin/ocrcheck -local
手工备份OLR: /u01/app/11.2.0/grid/bin/ocrconfig -local -manualbackup

1.4 备份安装软件目录
1、分别关闭实例
sqlplus / as sysdba
alter system checkpoint;
shutdown immediate;

2、分别 crsctl stop has
/u01/app/11.2.0/grid/bin/crsctl stop has

3、备份数据库所有安装目录(注意,保留权限)
先查看软件目录空间多大,再根目录空间是否足够。(root用户)

cd /
du -sm * | sort

备份安装软件目录:tar cvpzf oracle.tgz /u01
使用下面的命令来恢复系统:# tar xvpfz backup.tgz -C /

备份完后,两边开启集群资源。

/u01/app/11.2.0/grid/bin/crsctl start has

二、替换原有的grid用户和oracle用户下的Opatch

1、新建补丁包目录【2个节点都执行,都需要补丁包和opatch软件包】
mkdir -p /home/grid/update
chown -R grid:oinstall /home/grid/update
chmod 777 /home/grid/update

软件包解压在/home/grid/update 目录下

解压补丁包(root 用户)

unzip p27107360_112040_Linux-x86-64.zip

把解压的目录命名为:27107360

chown -R grid:oinstall /home/grid/update/27107360
unzip p6880880_112000_Linux-x86-64.zip

备份原有Opatch
mv /u01/app/11.2.0/grid/OPatch/ /u01/app/11.2.0/grid/OPatch.bak
mv /u01/app/oracle/product/11.2.0/dbhome_1/OPatch /u01/app/oracle/product/11.2.0/dbhome_1/OPatch.bak

copy新的OPatch到相应用户路径下
cp -R /home/grid/update/OPatch /u01/app/11.2.0/grid/OPatch
cp -R /home/grid/update/OPatch /u01/app/oracle/product/11.2.0/dbhome_1/OPatch

赋予新的OPatch文件权限。
chown -R grid:oinstall /u01/app/11.2.0/grid/OPatch
chmod 755 /u01/app/11.2.0/grid/OPatch

chown -R oracle:oinstall /u01/app/oracle/product/11.2.0/dbhome_1/OPatch
chmod 755 /u01/app/oracle/product/11.2.0/dbhome_1/OPatch

查看替换后的 OPatch

ls -lh /u01/app/11.2.0/grid/
ls -lh /u01/app/oracle/product/11.2.0/dbhome_1

3、预检查
grid:
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /home/grid/update/27107360/26609929
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /home/grid/update/27107360/22502505
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /home/grid/update/27107360/26925576

oracle:
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /home/grid/update/27107360/26925576
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /home/grid/update/27107360/26609929/custom/server/26609929

三、手工补丁升级

Manual Steps for Apply Patch

3.1、Stop the CRS managed resources running from DB homes. If this is a GI Home environment, as the database home owner execute:

oracle 两个节点执行:

$ORACLE_HOME/bin/srvctl stop home -o $ORACLE_HOME -s /home/oracle/update/1.txt -n rac1
$ORACLE_HOME/bin/srvctl stop home -o $ORACLE_HOME -s /home/oracle/update/2.txt -n rac2

3.2、Run the pre root script. If this is a GI Home, as the root user execute:

root 两节点执行:

/u01/app/11.2.0/grid/crs/install/rootcrs.pl -unlock

3.3、Apply the CRS patch using. As the GI home owner execute:

grid 两节点执行:

$ORACLE_HOME/OPatch/opatch napply -oh $ORACLE_HOME -local /home/grid/update/27107360/26609929

$ORACLE_HOME/OPatch/opatch napply -oh $ORACLE_HOME -local /home/grid/update/27107360/22502505

$ORACLE_HOME/OPatch/opatch apply -oh $ORACLE_HOME -local /home/grid/update/27107360/26925576

3.4、Run the pre script for DB component of the patch. As the database home owner execute:

oracle 两节点执行:

/home/grid/update/27107360/26609929/custom/server/26609929/custom/scripts/prepatch.sh -dbhome $ORACLE_HOME

3.5、Apply the DB patch. As the database home owner execute:

oracle 两节点执行:

$ORACLE_HOME/OPatch/opatch napply -oh $ORACLE_HOME -local /home/grid/update/27107360/26609929/custom/server/26609929
$ORACLE_HOME/OPatch/opatch apply -oh $ORACLE_HOME -local /home/grid/update/27107360/26925576

3.6、Run the post script for DB component of the patch. As the database home owner execute:

oracle 两节点执行:

/home/grid/update/27107360/26609929/custom/server/26609929/custom/scripts/postpatch.sh -dbhome $ORACLE_HOME

3.7、Run the post script. As the root user execute:

root:

/u01/app/11.2.0/grid/rdbms/install/rootadd_rdbms.sh
/u01/app/11.2.0/grid/crs/install/rootcrs.pl -patch

3.8、Start the CRS managed resources that were earlier running from DB homes. If this is a GI Home environment, as the database home owner execute:

oracle 两节点执行:

$ORACLE_HOME/bin/srvctl start home -o $ORACLE_HOME -s /home/oracle/update/1.txt -n rac1
$ORACLE_HOME/bin/srvctl start home -o $ORACLE_HOME -s /home/oracle/update/2.txt -n rac2

3.9、检查

As the Oracle Grid Infrastructure owner, run the following command:

grid:

/u01/app/11.2.0/grid/OPatch/opatch lsinventory

oracle:

/u01/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch lsinventory

3.11、数据库的应用PSU
在任意一台节点用oracle用户连接到数据库上(只需在一台节点执行一次,不需要所有节点都执行):

cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @?/rdbms/admin/catbundle.sql psu apply

查看应用的psu

set line 150
col ACTION_TIME for a30
col ACTION for a8
col NAMESPACE for a8
col VERSION for a10
col BUNDLE_SERIES for a5
col COMMENTS for a20
select * from dba_registry_history;

编译无效的对象:

SQL>@?/rdbms/admin/utlrp.sql

如果升级的补丁有报错,查看一下日志:

cd $ORACLE_BASE/cfgtoollogs/catbundle

catbundle_PSU_<database SID>_APPLY_<TIMESTAMP>.log
catbundle_PSU_<database SID>_GENERATE_<TIMESTAMP>.log

3.12、如果使用了RMAN,需要将RMAN catalog库升级一下,执行:
$ rman catalog username/password@alias
RMAN> UPGRADE CATALOG;

最新文章

  1. MVP模式
  2. http://www.cnblogs.com/20135131zxy/
  3. 高级屏幕空间反射: Screen Space Reflection (SSSR)
  4. MyEclipse 使用快捷键
  5. 夺命雷公狗ThinkPHP项目之----企业网站18之网站配置列表页的完成
  6. c语言typedef关键字的理解
  7. OCP读书笔记(3) - 使用RMAN恢复目录
  8. IIS7或IIS7.5 ISAPI和CGI限制找不到的问题记录
  9. Android带有粘性头部的ScrollView
  10. x64内核HOOK技术之拦截进程.拦截线程.拦截模块
  11. java中面试可能会问的问题
  12. UmengShareDemo【友盟分享SDK集成,基于V6.9.3版本】
  13. openstack第二章:glance
  14. shell 日常技巧
  15. WPF 自定义Command
  16. 基础教程:Mac 电脑小白应该了解哪些东西?
  17. Spring cloud和Dubbo
  18. PHPMyWind5.4存储XSS(CVE-2017-12984)
  19. 从零开始写一个发送h264的rtsp服务器(下)
  20. 能力成熟度模型(CMM)

热门文章

  1. QT4使用HDF5 类型错误
  2. THREE.js代码备份——webgl - materials - cube refraction [balls](以上下左右前后6张图片构成立体场景、透明球体效果)
  3. Lazarus开发环境编译选项配置
  4. jstl与el结合常见用法
  5. windows 下安装mysql 成功版
  6. 关于vuex
  7. idea整合eclipse后快捷键
  8. (36)Spring Boot Cache理论篇【从零开始学Spring Boot】
  9. eclipse jvm调优
  10. BA-WG-调试经验