Oracle 12C RAC 升级
下载最新的OPatch工具
各个版本的opatch
Patch 6880880
Or using the next URL:
https://updates.oracle.com/download/6880880.html
下载补丁
https://support.oracle.com/epmos/faces/PatchSearchResults?_adf.ctrl-state=9lvomvbht_354&_afrLoop=254196006287159
升级准备
注意事项
本文档适用场景-Oracle RAC,其中GI Home和Database Homes未共享且未配置ACFS文件系统
升级前开启集群,关闭监听、ASM实例、数据库实例、退出SQLPLUS,即与实例相关服务全部关闭
如果是首次安装,则先不要安装数据库实例,升级Grid、RDBMS后,再安装实例
RAC多节点升级,一个节点一个节点地操作,不要并发执行
12C升级不再需要emocmrsp命令
实例升级不再使用catbundle.sql(在12C中被废弃),而是使用datapatch,目前12.2.0.1的实例无需升级
临时环境变量配置(升级完毕后可删除)
root .bash_profile
export UNZIPPED_PATCH_LOCATION=/orasoft
export GI_ORACLE_HOME=/u01/app/12.2.0/grid/product/db_1
export ORACLE_DB_HOME=/u01/app/oracle/product/12.2.0/db_1
Grid/oracle .bash_profile
export UNZIPPED_PATCH_LOCATION=/orasoft
更换OPatch目录
root下执行
解压patch包
export UNZIPPED_PATCH_LOCATION=/orasoft
export GI_ORACLE_HOME=/u01/app/12.2.0/grid/product/db_1
export ORACLE_DB_HOME=/u01/app/oracle/product/12.2.0/db_1
scp p6880880_122010_Linux-x86-64.zip crcsn2:/orasoft
cd $UNZIPPED_PATCH_LOCATION
unzip p6880880_122010_Linux-x86-64.zip
更换GI环境OPatch包
mv $GI_ORACLE_HOME/OPatch $GI_ORACLE_HOME/OPatch.old
cp -r $UNZIPPED_PATCH_LOCATION/OPatch $GI_ORACLE_HOME/
chown -R grid:oinstall $GI_ORACLE_HOME/OPatch
chmod -R 755 $GI_ORACLE_HOME/OPatch
ls -lrth $GI_ORACLE_HOME |grep OPatch
注意解压后目录权限,至关重要。
更换Oracle环境下的OPatch包
mv $ORACLE_DB_HOME/OPatch $ORACLE_DB_HOME/OPatch.old
cp -r $UNZIPPED_PATCH_LOCATION/OPatch $ORACLE_DB_HOME/
chown -R oracle:oinstall $ORACLE_DB_HOME/OPatch
chmod -R 755 $ORACLE_DB_HOME/OPatch
ls -lrth $ORACLE_DB_HOME |grep OPatch
解压 PSU
scp p2710* crcsn2:/orasoft
cd $UNZIPPED_PATCH_LOCATION
unzip p27105253_122010_Linux-x86-64.zip
unzip p27100009_122010_Linux-x86-64.zip
chown -R oracle:oinstall $UNZIPPED_PATCH_LOCATION
chmod -R 755 $UNZIPPED_PATCH_LOCATION
冲突检测
su - grid
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir $UNZIPPED_PATCH_LOCATION/27100009/27105253
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir $UNZIPPED_PATCH_LOCATION/27100009/27335416
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir $UNZIPPED_PATCH_LOCATION/27100009/27128906
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir $UNZIPPED_PATCH_LOCATION/27100009/26839277
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir $UNZIPPED_PATCH_LOCATION/27100009/27144050
su - oracle
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir $UNZIPPED_PATCH_LOCATION/27100009/27105253
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir $UNZIPPED_PATCH_LOCATION/27100009/27335416
系统空间检查
grid用户
su - grid
vim /tmp/patch_list_gihome.txt
/orasoft/27100009/27144050
/orasoft/27100009/26839277
/orasoft/27100009/27128906
/orasoft/27100009/27335416
/orasoft/27100009/27105253
$ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt
oracle用户
su - oracle
vim /tmp/patch_list_dbhome.txt
/orasoft/27100009/27335416
/orasoft/27100009/27105253
$ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_dbhome.txt
Oracle RAC,其中GI Home和Database Homes未共享且未配置ACFS文件系统。
启动集群
/u01/app/12.2.0/grid/bin/crsctl start cluster -all
关闭以下服务
srvctl status listener
srvctl stop listener
srvctl status listener
$ sqlplus / as sysasm
SQL> shutdown immediate
关闭所有实例并退出plsql,然后稍等几分钟再开始下面的操作(因为有些进程的关闭不是瞬间的,需要那么一点点时间)
grid升级
预执行分析,无错误后执行
$GI_ORACLE_HOME/OPatch/opatchauto apply $UNZIPPED_PATCH_LOCATION/27100009 -analyze
[root@crcsn1 orasoft]# $GI_ORACLE_HOME/OPatch/opatchauto apply $UNZIPPED_PATCH_LOCATION/27100009 OPatchauto session is initiated at Wed Apr 11 11:11:28 2018 System initialization log file is /u01/app/12.2.0/grid/product/db_1/cfgtoollogs/opatchautodb/systemconfig2018-04-11_11-11-29AM.log. Session log file is /u01/app/12.2.0/grid/product/db_1/cfgtoollogs/opatchauto/opatchauto2018-04-11_11-11-48AM.log The id for this session is 6ETH Executing OPatch prereq operations to verify patch applicability on home /u01/app/12.2.0/grid/product/db_1 Patch applicability verified successfully on home /u01/app/12.2.0/grid/product/db_1 Bringing down CRS service on home /u01/app/12.2.0/grid/product/db_1 Prepatch operation log file location: /u01/app/grid/crsdata/crcsn1/crsconfig/crspatch_crcsn1_2018-04-11_11-12-34AM.log CRS service brought down successfully on home /u01/app/12.2.0/grid/product/db_1 Start applying binary patch on home /u01/app/12.2.0/grid/product/db_1 Binary patch applied successfully on home /u01/app/12.2.0/grid/product/db_1 Starting CRS service on home /u01/app/12.2.0/grid/product/db_1 Postpatch operation log file location: /u01/app/grid/crsdata/crcsn1/crsconfig/crspatch_crcsn1_2018-04-11_11-16-09AM.log CRS service started successfully on home /u01/app/12.2.0/grid/product/db_1 OPatchAuto successful. --------------------------------Summary-------------------------------- Patching is completed successfully. Please find the summary as follows: Host:crcsn1 CRS Home:/u01/app/12.2.0/grid/product/db_1 Summary: ==Following patches were SUCCESSFULLY applied: Patch: /orasoft/27100009/26839277 Log: /u01/app/12.2.0/grid/product/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2018-04-11_11-13-40AM_1.log Patch: /orasoft/27100009/27105253 Log: /u01/app/12.2.0/grid/product/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2018-04-11_11-13-40AM_1.log Patch: /orasoft/27100009/27128906 Log: /u01/app/12.2.0/grid/product/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2018-04-11_11-13-40AM_1.log Patch: /orasoft/27100009/27144050 Log: /u01/app/12.2.0/grid/product/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2018-04-11_11-13-40AM_1.log Patch: /orasoft/27100009/27335416 Log: /u01/app/12.2.0/grid/product/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2018-04-11_11-13-40AM_1.log OPatchauto session completed at Wed Apr 11 11:22:46 2018 Time taken to complete the session 11 minutes, 19 seconds |
[root@crcsn1 orasoft]# su - grid Last login: Wed Apr 11 11:22:45 CST 2018 [grid@crcsn1 ~]$ $ORACLE_HOME/OPatch/opatch lspatches 27335416;OCW JAN 2018 RELEASE UPDATE 12.2.0.1.180116 (27335416) 27144050;Tomcat Release Update 12.2.0.1.0(ID:171023.0830) (27144050) 27128906;ACFS Release Update : 12.2.0.1.0 (27128906) 27105253;Database Release Update : 12.2.0.1.180116 (27105253) 26839277;DBWLM RELEASE UPDATE 12.2.0.1.0(ID:170913) (26839277) |
以下命令查看每个补丁的详细情况
$ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME
执行完第一个节点后,依次执行RAC其他节点
RDBMS升级
预执行分析,无错误后执行
$ORACLE_DB_HOME/OPatch/opatchauto apply $UNZIPPED_PATCH_LOCATION/27100009 -oh $ORACLE_DB_HOME -analyze
[root@crcsn1 orasoft]# $ORACLE_DB_HOME/OPatch/opatchauto apply $UNZIPPED_PATCH_LOCATION/27100009 -oh $ORACLE_DB_HOME OPatchauto session is initiated at Wed Apr 11 13:21:02 2018 System initialization log file is /u01/app/oracle/product/12.2.0/db_1/cfgtoollogs/opatchautodb/systemconfig2018-04-11_01-21-05PM.log. Session log file is /u01/app/oracle/product/12.2.0/db_1/cfgtoollogs/opatchauto/opatchauto2018-04-11_01-21-30PM.log The id for this session is VYDV Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/12.2.0/db_1 Patch applicability verified successfully on home /u01/app/oracle/product/12.2.0/db_1 Verifying SQL patch applicability on home /u01/app/oracle/product/12.2.0/db_1 No step execution required......... SQL patch applicability verified successfully on home /u01/app/oracle/product/12.2.0/db_1 Preparing to bring down database service on home /u01/app/oracle/product/12.2.0/db_1 No step execution required......... Successfully prepared home /u01/app/oracle/product/12.2.0/db_1 to bring down database service Performing prepatch operation on home /u01/app/oracle/product/12.2.0/db_1 Perpatch operation completed successfully on home /u01/app/oracle/product/12.2.0/db_1 Start applying binary patch on home /u01/app/oracle/product/12.2.0/db_1 Binary patch applied successfully on home /u01/app/oracle/product/12.2.0/db_1 Performing postpatch operation on home /u01/app/oracle/product/12.2.0/db_1 Postpatch operation completed successfully on home /u01/app/oracle/product/12.2.0/db_1 Preparing home /u01/app/oracle/product/12.2.0/db_1 after database service restarted No step execution required......... Prepared home /u01/app/oracle/product/12.2.0/db_1 successfully after database service restarted Trying to apply SQL patch on home /u01/app/oracle/product/12.2.0/db_1 No step execution required......... SQL patch applied successfully on home /u01/app/oracle/product/12.2.0/db_1 OPatchAuto successful. --------------------------------Summary-------------------------------- Patching is completed successfully. Please find the summary as follows: Host:crcsn1 RAC Home:/u01/app/oracle/product/12.2.0/db_1 Summary: ==Following patches were SKIPPED: Patch: /orasoft/27100009/27128906 Reason: This patch is not applicable to this specified target type - "rac_database" Patch: /orasoft/27100009/26839277 Reason: This patch is not applicable to this specified target type - "rac_database" Patch: /orasoft/27100009/27144050 Reason: This patch is not applicable to this specified target type - "rac_database" ==Following patches were SUCCESSFULLY applied: Patch: /orasoft/27100009/27105253 Log: /u01/app/oracle/product/12.2.0/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2018-04-11_13-21-45PM_1.log Patch: /orasoft/27100009/27335416 Log: /u01/app/oracle/product/12.2.0/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2018-04-11_13-21-45PM_1.log OPatchauto session completed at Wed Apr 11 13:22:32 2018 Time taken to complete the session 1 minute, 30 seconds |
[root@crcsn1 orasoft]# su - oracle Last login: Wed Apr 11 13:22:32 CST 2018 [oracle@crcsn1 ~]$ $ORACLE_HOME/OPatch/opatch lspatches 27335416;OCW JAN 2018 RELEASE UPDATE 12.2.0.1.180116 (27335416) 27105253;Database Release Update : 12.2.0.1.180116 (27105253) OPatch succeeded. |
以下命令查看每个补丁的详细情况
$ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME
执行完第一个节点后,依次执行RAC其他节点
服务启动
升级完毕后,服务自动启动
实例升级
alter pluggable database all open;
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 CSPDB1 READ WRITE NO
4 CSPDB2 READ WRITE NO
5 CSPDB3 READ WRITE NO
[oracle@crcsn1 ~]$ cd $ORACLE_HOME/OPatch
[oracle@crcsn1 OPatch]$ ./datapatch -verbose
SQL Patching tool version 12.2.0.1.0 Production on Wed Apr 11 14:13:46 2018
Copyright (c) 2012, 2017, Oracle. All rights reserved.
Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_13959_2018_04_11_14_13_46/sqlpatch_invocation.log
Connecting to database...OK
Note: Datapatch will only apply or rollback SQL fixes for PDBs
that are in an open state, no patches will be applied to closed PDBs.
Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation
(Doc ID 1585822.1)
Bootstrapping registry and package to current versions...done
Determining current state...done
Current state of SQL patches:
Bundle series DBRU:
ID 180116 in the binary registry and ID 180116 in PDB CDB$ROOT, ID 180116 in PDB PDB$SEED, ID 180116 in PDB CSPDB1, ID 180116 in PDB CSPDB2, ID 180116 in PDB CSPDB3, ID 180116 in PDB CSPDB4, ID 180116 in PDB CSPDB5, ID 180116 in PDB CSPDB6, ID 180116 in PDB CSPDB7, ID 180116 in PDB CSPDB8, ID 180116 in PDB CSPDB9, ID 180116 in PDB CSPDB10, ID 180116 in PDB CSPDB11, ID 180116 in PDB CSPDB12, ID 180116 in PDB CSPDB13, ID 180116 in PDB CSPDB14, ID 180116 in PDB CSPDB15, ID 180116 in PDB CSPDB16, ID 180116 in PDB CSPDB17, ID 180116 in PDB CSPDB18, ID 180116 in PDB CSPDB19, ID 180116 in PDB CSPDB20
Adding patches to installation queue and performing prereq checks...
Installation queue:
For the following PDBs: CDB$ROOT PDB$SEED CSPDB1 CSPDB2 CSPDB3 CSPDB4 CSPDB5 CSPDB6 CSPDB7 CSPDB8 CSPDB9 CSPDB10 CSPDB11 CSPDB12 CSPDB13 CSPDB14 CSPDB15 CSPDB16 CSPDB17 CSPDB18 CSPDB19 CSPDB20
Nothing to roll back
Nothing to apply
SQL Patching tool complete on Wed Apr 11 14:16:44 2018
什么也没有做,Nothing to apply!
至此,升级完毕!