环境介绍:
Oracle RAC版本:12.2.0.1(两节点)
操作系统版本:CentOS7.4 64bit
一、补丁环境准备
1.1 上传安装包
p6880880_122010_Linux-x86-64
p30920127_122010_Linux-x86-64
1.2 确保OPatch utility版本
Patch 30920127要求Opatch工具为12.2.0.1.19及更高(gird和Oracle用户均需要确认)
1.2.1备份原来的OPatch utility
root用户执行,两节点均需执行
```mv /u01/app/12.2.0/grid/OPatch /u01/app/12.2.0/grid/OPatch_bak
mv /u01/app/oracle/product/12.2.0/db_1/OPatch /u01/app/oracle/product/12.2.0/db_1/OPatch_bak
##### 1.2.2 安装新的OPatch utility
> root用户执行,两节点均需执行
unzip /tmp/p6880880_122010_Linux-x86-64.zip -d /u01/app/12.2.0/grid
unzip /tmp/p6880880_122010_Linux-x86-64.zip -d /u01/app/oracle/product/12.2.0/db_1/
chown grid:oinstall -R /u01/app/12.2.0/grid/OPatch
chown oracle:oinstall -R /u01/app/oracle/product/12.2.0/db_1/OPatch
##### 1.2.3 确认版本
> grid用户执行,两节点均需执行
$ORACLE_HOME/OPatch/opatch version
#### 1.2 验证Oracle Inventory并保存(打完补丁之后对比)
> 分别用户Oracle和grid用户在两个节点执行,
$ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME
#### 1.3 解压补丁包到指定目录
> root用户在两个节点执行
unzip /tmp/p30920127_122010_Linux-x86-64.zip -d /PSU/
chmod 777 -R /PSU/
#### 1.4冲突检查
> 在两个节点执行,确保没用补丁冲突
检查grid补丁(grid用户)
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /PSU/30920127/30886680
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /PSU/30920127/30882603
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /PSU/30920127/30869447
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /PSU/30920127/26839277
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /PSU/30920127/30888810
检查db补丁(oracle用户)
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /PSU/30920127/30886680
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /PSU/30920127/30882603
#### 1.5空间检查
检查Grid空间(grid用户),确保空间足够
cat /tmp/patch_list_gihome.txt
/PSU/30920127/30886680
/PSU/30920127/30882603
/PSU/30920127/30869447
/PSU/30920127/26839277
/PSU/30920127/30888810
$ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt
检查db空间(oracle用户),确保空间足够
cat /tmp/patch_list_dbhome.txt
/PSU/30920127/30886680
/PSU/30920127/30882603
$ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_dbhome.txt
### 二、安装补丁
#### 2.1打补丁
> Grid home和db home均安装在对应的节点上,没用配置ACFS
>
> root用户分别在两个节点执行,需要等到一个节点执行完成并确认成功后再在第二个节点执行
>
>
/u01/app/12.2.0/grid/OPatch/opatchauto apply /PSU/30920127
OPatchauto session is initiated at Tue May 5 07:40:47 2020
System initialization log file is /u01/app/12.2.0/grid/cfgtoollogs/opatchautodb/systemconfig2020-05-05_07-40-53AM.log.
Session log file is /u01/app/12.2.0/grid/cfgtoollogs/opatchauto/opatchauto2020-05-05_07-43-06AM.log
The id for this session is WLQR
Executing OPatch prereq operations to verify patch applicability on home /u01/app/12.2.0/grid
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
Patch applicability verified successfully on home /u01/app/12.2.0/grid
Verifying SQL patch applicability on home /u01/app/oracle/product/12.2.0/db_1
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
Successfully prepared home /u01/app/oracle/product/12.2.0/db_1 to bring down database service
Bringing down CRS service on home /u01/app/12.2.0/grid
Prepatch operation log file location: /u01/app/grid/crsdata/rac1/crsconfig/crspatch_rac1_2020-05-05_07-43-54AM.log
CRS service brought down successfully on home /u01/app/12.2.0/grid
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
Start applying binary patch on home /u01/app/12.2.0/grid
Binary patch applied successfully on home /u01/app/12.2.0/grid
Starting CRS service on home /u01/app/12.2.0/grid
Postpatch operation log file location: /u01/app/grid/crsdata/rac1/crsconfig/crspatch_rac1_2020-05-05_08-03-46AM.log
CRS service started successfully on home /u01/app/12.2.0/grid
Preparing home /u01/app/oracle/product/12.2.0/db_1 after database service restarted
No step execution required.........
Trying to apply SQL patch on home /u01/app/oracle/product/12.2.0/db_1
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:rac1
RAC Home:/u01/app/oracle/product/12.2.0/db_1
Version:12.2.0.1.0
Summary:
==Following patches were SKIPPED:
Patch: /PSU/30920127/30869447
Reason: This patch is not applicable to this specified target type - "rac_database"
Patch: /PSU/30920127/26839277
Reason: This patch is not applicable to this specified target type - "rac_database"
Patch: /PSU/30920127/30888810
Reason: This patch is not applicable to this specified target type - "rac_database"
==Following patches were SUCCESSFULLY applied:
Patch: /PSU/30920127/30882603
Log: /u01/app/oracle/product/12.2.0/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2020-05-05_07-45-26AM_1.log
Patch: /PSU/30920127/30886680
Log: /u01/app/oracle/product/12.2.0/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2020-05-05_07-45-26AM_1.log
Host:rac1
CRS Home:/u01/app/12.2.0/grid
Version:12.2.0.1.0
Summary:
==Following patches were SKIPPED:
Patch: /PSU/30920127/26839277
Reason: This patch is already been applied, so not going to apply again.
==Following patches were SUCCESSFULLY applied:
Patch: /PSU/30920127/30869447
Log: /u01/app/12.2.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2020-05-05_07-52-27AM_1.log
Patch: /PSU/30920127/30882603
Log: /u01/app/12.2.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2020-05-05_07-52-27AM_1.log
Patch: /PSU/30920127/30886680
Log: /u01/app/12.2.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2020-05-05_07-52-27AM_1.log
Patch: /PSU/30920127/30888810
Log: /u01/app/12.2.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2020-05-05_07-52-27AM_1.log
Patching session reported following warning(s):
[WARNING] The database instance 'orcl1' from '/u01/app/oracle/product/12.2.0/db_1', in host'rac1' is not running. SQL changes, if any, will not be applied.
To apply. the SQL changes, bring up the database instance and run the command manually from any one node (run as oracle).
Refer to the readme to get the correct steps for applying the sql changes.
OPatchauto session completed at Tue May 5 08:17:22 2020
Time taken to complete the session 36 minutes, 35 seconds
#### 2.2执行对应的sql
> 由于是sql语句,所有只需要在一个节点(oracle用户)执行
>
> 我们环境是**Standalone DB**,没用使用**CDB/PDB**
补丁打完之后,数据库已经启动
% cd $ORACLE_HOME/OPatch
% ./datapatch -verbose
检查补丁日志信息确认日志没用异常
$ORACLE_BASE/cfgtoollogs/sqlpatch/30886680/
执行对应的sql
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @utlrp.sql
SQL > @dbmsjdev.sql
SQL > exec dbms_java_dev.disable
如果配置了rman的环境,还需要UPGRADE CATALOG;
### 三、验证补丁集及集群状态
#### 3.1 确认补丁集
> grid和oracle用户分别在两个节点执行,并和之前的做对比
$ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME
/u01/12.2.0/grid/bin/crsctl query crs releasepatch
#### 3.2确认集群状态
crsctl stat res -t
### 四、遇到的问题
#### 4.1 CRS-6706 Patch leve不一致
1.Run the following command as the root user to complete the patching set up behind the scenes:
#GI_HOME/bin:> ./clscfg -localpatch
2.Run the following command as the root user to lock the GI home:
#GI_HOME/crs/install:> ./rootcrs.sh -lock
3.Run the following command as the root user to start the GI:
#GI_HOME/bin:> ./crsctl start crs
#### 4.2 GSMADMIN_INTERNAL.DBMS_GSM_POOLADMIN is invalid
错误信息:
Error at line 503: Warning: Package Body created with compilation errors.
Error at line 6801: Warning: Package Body created with compilation errors.
Error at line 6808: 4675/4 PL/SQL: Statement ignored
Error at line 6809: 4675/23 PLS-00302: component 'ISNONORACLECLOUD' must be declared
Error at line 6831: 4675/4 PL/SQL: Statement ignored
Error at line 6832: 4675/23 PLS-00302: component 'ISNONORACLECLOUD' must be declared
Error at line 7485: Warning: Trigger created with compilation errors.
Error at line 7492: 0/0 PLS-00905: object GSMADMIN_INTERNAL.DBMS_GSM_POOLADMIN is invalid
Error at line 7509: Warning: Trigger created with compilation errors.
Error at line 7516: 0/0 PLS-00905: object GSMADMIN_INTERNAL.DBMS_GSM_POOLADMIN is invalid
Error at line 7523: Warning: Trigger created with compilation errors.
Error at line 7530: 0/0 PLS-00905: object GSMADMIN_INTERNAL.DBMS_GSM_POOLADMIN is invalid
解决方法:
GDS Objects are Invalid - GSMADMIN_INTERN (文档 ID 2425776.1)
GSMADMIN and LBACSYS Objects Invalid After Create New 12c Database (文档 ID 2284611.1)
Execute following steps to compile the invalid objects:
$sqlplus "/as sysdba"
SQL> spool fix_cat_logfile.txt
SQL> startup upgrade
SQL > @?/rdbms/admin/catalog.sql
SQL > @?/rdbms/admin/catproc.sql
SQL > @?/rdbms/admin/utlrp.sql
SQL> spool off