Oracle 19c rac以及单实例补丁安装笔记

Oracle 19c rac以及单实例补丁安装笔记

Authors:
Kay-2019-10-29

一、RAC两个节点

1、在grid与oracle用户查看opatch版本

$ORACLE_HOME/OPatch/opatch version

2、检查Oracle Inventory有效性
在grid和oracle检查
两个节点操作

 $ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME

查看是否有报错

3、下载19c补丁

MOS ID 2118136.2下载19c补丁

在这里插入图片描述

4、创建一个目录用于放补丁
两个节点操作

mkdir -p /opt/patch/grid

mv p30135696_190000_Linux-x86-64.zip /opt/patch/grid

chown -R grid:oinstall /opt/patch/grid

使用grid用户解压
cd /opt/patch/grid
$ unzip p30135696_190000_Linux-x86-64.zip
解压之后查看readme文档,所需opatch最小版本
附opatch下载地址https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=6880880

5、OPatch冲突检查
两个节点操作
For Grid Infrastructure Home, as home user:

 $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/30135696/30087906
 $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/30135696/29585399
 $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/30135696/29517247
 $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/30135696/
 $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/30135696/29401763

For Database home, as home user:

 $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/30135696/30087906
 $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/30135696/29585399

6、两个节点root用户加入opatch环境变量
两个节点操作

[root@ghoradb-rac1 ~]# export PATH=$PATH:/u01/app/19.0.0/grid/OPatch
[root@ghoradb-rac1 ~]# opatch version
OPatch Version: 12.2.0.1.17

OPatch succeeded.

root用户下
7、使用opatchauto安装补丁
两个节点操作
节点1

[root@ghoradb-rac1 opt]# opatchauto apply /opt/patch/30135696

输出过程:

OPatchauto session is initiated at Tue Oct 29 14:22:06 2019

System initialization log file is /u01/app/19.0.0/grid/cfgtoollogs/opatchautodb/systemconfig2019-10-29_02-22-08PM.log.

Session log file is /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/opatchauto2019-10-29_02-22-50PM.log
The id for this session is 4WVC

Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/19.0.0/db_1

Executing OPatch prereq operations to verify patch applicability on home /u01/app/19.0.0/grid
Patch applicability verified successfully on home /u01/app/19.0.0/grid

Patch applicability verified successfully on home /u01/app/oracle/product/19.0.0/db_1


Verifying SQL patch applicability on home /u01/app/oracle/product/19.0.0/db_1
SQL patch applicability verified successfully on home /u01/app/oracle/product/19.0.0/db_1


Preparing to bring down database service on home /u01/app/oracle/product/19.0.0/db_1
Successfully prepared home /u01/app/oracle/product/19.0.0/db_1 to bring down database service


Bringing down CRS service on home /u01/app/19.0.0/grid
CRS service brought down successfully on home /u01/app/19.0.0/grid


Performing prepatch operation on home /u01/app/oracle/product/19.0.0/db_1
Perpatch operation completed successfully on home /u01/app/oracle/product/19.0.0/db_1


Start applying binary patch on home /u01/app/oracle/product/19.0.0/db_1
Binary patch applied successfully on home /u01/app/oracle/product/19.0.0/db_1


Performing postpatch operation on home /u01/app/oracle/product/19.0.0/db_1
Postpatch operation completed successfully on home /u01/app/oracle/product/19.0.0/db_1


Start applying binary patch on home /u01/app/19.0.0/grid
Binary patch applied successfully on home /u01/app/19.0.0/grid


Starting CRS service on home /u01/app/19.0.0/grid
CRS service started successfully on home /u01/app/19.0.0/grid


Preparing home /u01/app/oracle/product/19.0.0/db_1 after database service restarted
No step execution required.........
 

Trying to apply SQL patch on home /u01/app/oracle/product/19.0.0/db_1
SQL patch applied successfully on home /u01/app/oracle/product/19.0.0/db_1

OPatchAuto successful.

--------------------------------Summary--------------------------------

Patching is completed successfully. Please find the summary as follows:

Host:ghoradb-rac1
RAC Home:/u01/app/oracle/product/19.0.0/db_1
Version:19.0.0.0.0
Summary:

==Following patches were SKIPPED:

Patch: /opt/patch/30135696/29517247
Reason: This patch is not applicable to this specified target type - "rac_database"

Patch: /opt/patch/30135696/29401763
Reason: This patch is not applicable to this specified target type - "rac_database"

Patch: /opt/patch/30135696/29585399
Reason: This patch is already been applied, so not going to apply again.


==Following patches were SUCCESSFULLY applied:

Patch: /opt/patch/30135696/30087906
Log: /u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2019-10-29_14-29-56PM_1.log


Host:ghoradb-rac1
CRS Home:/u01/app/19.0.0/grid
Version:19.0.0.0.0
Summary:

==Following patches were SKIPPED:

Patch: /opt/patch/30135696/29585399
Reason: This patch is already been applied, so not going to apply again.

Patch: /opt/patch/30135696/29517247
Reason: This patch is already been applied, so not going to apply again.

Patch: /opt/patch/30135696/29401763
Reason: This patch is already been applied, so not going to apply again.


==Following patches were SUCCESSFULLY applied:

Patch: /opt/patch/30135696/30087906
Log: /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2019-10-29_14-31-23PM_1.log



OPatchauto session completed at Tue Oct 29 14:36:36 2019
Time taken to complete the session 14 minutes, 30 seconds

节点2:


[root@rac2 ~]# opatchauto apply /opt/patch/30135696


OPatchauto session is initiated at Tue Oct 29 15:14:38 2019

System initialization log file is /u01/app/19.0.0/grid/cfgtoollogs/opatchautodb/systemconfig2019-10-29_03-14-40PM.log.

Session log file is /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/opatchauto2019-10-29_03-15-20PM.log
The id for this session is MI2E

Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/19.0.0/db_1

Executing OPatch prereq operations to verify patch applicability on home /u01/app/19.0.0/grid
Patch applicability verified successfully on home /u01/app/19.0.0/grid

Patch applicability verified successfully on home /u01/app/oracle/product/19.0.0/db_1


Verifying SQL patch applicability on home /u01/app/oracle/product/19.0.0/db_1
SQL patch applicability verified successfully on home /u01/app/oracle/product/19.0.0/db_1


Preparing to bring down database service on home /u01/app/oracle/product/19.0.0/db_1
Successfully prepared home /u01/app/oracle/product/19.0.0/db_1 to bring down database service


Preparing home /u01/app/oracle/product/19.0.0/db_1 after database service restarted
No step execution required.........
 
OPatchAuto successful.

--------------------------------Summary--------------------------------

Patching is completed successfully. Please find the summary as follows:

Host:ghoradb-rac2
CRS Home:/u01/app/19.0.0/grid
Version:19.0.0.0.0
Summary:

==Following patches were SKIPPED:

Patch: /opt/patch/30135696/29585399
Reason: This patch is already been applied, so not going to apply again.

Patch: /opt/patch/30135696/29517247
Reason: This patch is already been applied, so not going to apply again.

Patch: /opt/patch/30135696/29401763
Reason: This patch is already been applied, so not going to apply again.

Patch: /opt/patch/30135696/30087906
Reason: This patch is already been applied, so not going to apply again.


Host:ghoradb-rac2
RAC Home:/u01/app/oracle/product/19.0.0/db_1
Version:19.0.0.0.0
Summary:

==Following patches were SKIPPED:

Patch: /opt/patch/30135696/29517247
Reason: This patch is not applicable to this specified target type - "rac_database"

Patch: /opt/patch/30135696/29401763
Reason: This patch is not applicable to this specified target type - "rac_database"

Patch: /opt/patch/30135696/29585399
Reason: This patch is already been applied, so not going to apply again.

Patch: /opt/patch/30135696/30087906
Reason: This patch is already been applied, so not going to apply again.



OPatchauto session completed at Tue Oct 29 15:16:03 2019
Time taken to complete the session 1 minute, 25 seconds

8、执行sql补丁脚本
在任意其中一个节点执行

[root@rac1 ~]# su - oracle
Last login: Mon Oct 28 20:06:18 CST 2019
[oracle@rac1 ~]$ cd $ORACLE_HOME/OPatch

[oracle@rac1 OPatch]$ ./datapatch -verbose

输出过程:

SQL Patching tool version 19.3.2.0.0 Production on Tue Oct 29 15:21:46 2019
Copyright (c) 2012, 2019, Oracle.  All rights reserved.

Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_456538_2019_10_29_15_21_46/sqlpatch_invocation.log

Connecting to database...OK
Gathering database info...done
Bootstrapping registry and package to current versions...done
Determining current state...done

Current state of interim SQL patches:
  No interim patches found

Current state of release update SQL patches:
  Binary registry:
    19.3.2.0.0 Release_Update_Revision 190829192137: Installed
  SQL registry:
    Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 24-OCT-19 04.54.16.356235 PM

Adding patches to installation queue and performing prereq checks...done
Installation queue:
  No interim patches need to be rolled back
  Patch 30087906 (Database Release Update Revision : 19.3.2.0.191015 (30087906)):
    Apply from 19.3.0.0.0 Release_Update 190410122720 to 19.3.2.0.0 Release_Update_Revision 190829192137
  No interim patches need to be applied

Installing patches...
Patch installation complete.  Total patches installed: 1

Validating logfiles...done
Patch 30087906 apply: SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/30087906/23124832/30087906_apply_GHORADB_2019Oct29_15_22_12.log (no errors)
SQL Patching tool complete on Tue Oct 29 15:23:30 2019

9、执行无效对象重新编译
在任意节点

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

Session altered.


TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN              2019-10-28 22:12:26

DOC>   The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC>   objects in the database. Recompilation time is proportional to the
DOC>   number of invalid objects in the database, so this command may take
DOC>   a long time to execute on a database with a large number of invalid
DOC>   objects.
DOC>
DOC>   Use the following queries to track recompilation progress:
DOC>
DOC>   1. Query returning the number of invalid objects remaining. This
DOC>      number should decrease with time.
DOC>         SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
DOC>
DOC>   2. Query returning the number of objects compiled so far. This number
DOC>      should increase with time.
DOC>         SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
DOC>
DOC>   This script automatically chooses serial or parallel recompilation
DOC>   based on the number of CPUs available (parameter cpu_count) multiplied
DOC>   by the number of threads per CPU (parameter parallel_threads_per_cpu).
DOC>   On RAC, this number is added across all RAC nodes.
DOC>
DOC>   UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
DOC>   recompilation. Jobs are created without instance affinity so that they
DOC>   can migrate across RAC nodes. Use the following queries to verify
DOC>   whether UTL_RECOMP jobs are being created and run correctly:
DOC>
DOC>   1. Query showing jobs created by UTL_RECOMP
DOC>         SELECT job_name FROM dba_scheduler_jobs
DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>
DOC>   2. Query showing UTL_RECOMP jobs that are running
DOC>         SELECT job_name FROM dba_scheduler_running_jobs
DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>#

PL/SQL procedure successfully completed.


TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END              2019-10-28 22:12:33

DOC> The following query reports the number of invalid objects.
DOC>
DOC> If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC>#

OBJECTS WITH ERRORS
-------------------
                  0

DOC> The following query reports the number of exceptions caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC> Note: Typical compilation errors (due to coding errors) are not
DOC>       logged into this table: they go into DBA_ERRORS instead.
DOC>#

ERRORS DURING RECOMPILATION
---------------------------
                          0


Function created.


PL/SQL procedure successfully completed.


Function dropped.


PL/SQL procedure successfully completed.

SQL> 

10、查看数据库版本

select banner_full from v$version;
SQL> select banner_full from v$version;

BANNER_FULL
--------------------------------------------------------------------------------
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.2.0.0

可以发现补丁版本由之前的19.3.0.0.0变成了19.3.2.0.0

select * from DBA_REGISTRY_HISTORY
set pagesize 200 linesize 200
col ACTION_TIME for a30
col action for a10
col NAMESPACE for a10
col version for a10
col COMMENTS for a100
 select ACTION_TIME,ACTION,NAMESPACE,VERSION,COMMENTS from dba_registry_history;
 

ACTION_TIME                    ACTION     NAMESPACE  VERSION    COMMENTS
------------------------------ ---------- ---------- ---------- ----------------------------------------------------------------------------------------------------
                               BOOTSTRAP  DATAPATCH  19         RDBMS_19.3.0.0.0DBRUR_LINUX.X64_190829
24-OCT-19 04.54.12.330517 PM   RU_APPLY   SERVER     19.0.0.0.0 Patch applied on 19.3.0.0.0: Release_Update - 190410122720
29-OCT-19 03.23.13.678966 PM   RU_APPLY   SERVER     19.0.0.0.0 Patch applied from 19.3.0.0.0 to 19.3.2.0.0: Release_Update_Revision - 190829192137

检查2个节点补丁列表
节点1

[grid@rac1 ~]$ $ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME |grep -i patch|more

在这里插入图片描述

节点2
在这里插入图片描述

补丁安装完毕

二、单实例

1、在oracle用户查看opatch版本

$ORACLE_HOME/OPatch/opatch version

2、检查Oracle Inventory有效性

 $ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME

查看是否有报错

3、下载19c补丁

MOS ID 2118136.2下载19c补丁
在这里插入图片描述
4、创建一个目录用于放补丁
两个节点操作

mkdir -p /home/oracle/patch

mv p30087906_190000_Linux-x86-64.zip /home/oracle/patch

使用oracle用户解压
cd /home/oracle/patch
$ unzip p30087906_190000_Linux-x86-64.zip
解压之后查看readme文档,所需opatch最小版本
附opatch下载地址https://updates.oracle.com/ARULink/PatchDetails/process_form?patch_num=6880880

5、OPatch冲突检查

[oracle@ora19c 30087906]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 12.2.0.1.17
Copyright (c) 2019, Oracle Corporation.  All rights reserved.

PREREQ session

Oracle Home       : /u01/app/oracle/product/19.3.0/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/19.3.0/db_1/oraInst.loc
OPatch version    : 12.2.0.1.17
OUI version       : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19.3.0/db_1/cfgtoollogs/opatch/opatch2019-10-29_11-32-04AM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.

6、关监听和数据库
lsnrctl stop
shutdown immediate;

7、补丁先决条件检查

[oracle@ora19c 30087906]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 12.2.0.1.17
Copyright (c) 2019, Oracle Corporation.  All rights reserved.

PREREQ session

Oracle Home       : /u01/app/oracle/product/19.3.0/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/19.3.0/db_1/oraInst.loc
OPatch version    : 12.2.0.1.17
OUI version       : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19.3.0/db_1/cfgtoollogs/opatch/opatch2019-10-29_11-32-04AM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.

8、安装补丁

[oracle@ora19c 30087906]$ $ORACLE_HOME/OPatch/opatch apply
Oracle Interim Patch Installer version 12.2.0.1.17
Copyright (c) 2019, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/19.3.0/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/19.3.0/db_1/oraInst.loc
OPatch version    : 12.2.0.1.17
OUI version       : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19.3.0/db_1/cfgtoollogs/opatch/opatch2019-10-29_11-34-58AM_1.log

Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   30087906  

Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.

Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/u01/app/oracle/product/19.3.0/db_1')


Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '30087906' to OH '/u01/app/oracle/product/19.3.0/db_1'
ApplySession: Optional component(s) [ oracle.network.gsm, 19.0.0.0.0 ] , [ oracle.rdbms.ic, 19.0.0.0.0 ] , [ oracle.options.olap.awm, 19.0.0.0.0 ] , [ oracle.network.cman, 19.0.0.0.0 ] , [ oracle.assistants.asm, 19.0.0.0.0 ] , [ oracle.oraolap.mgmt, 19.0.0.0.0 ] , [ oracle.net.cman, 19.0.0.0.0 ] , [ oracle.tfa, 19.0.0.0.0 ] , [ oracle.assistants.usm, 19.0.0.0.0 ]  not present in the Oracle Home or a higher version is found.

Patching component oracle.rdbms.rsf, 19.0.0.0.0...

Patching component oracle.rdbms, 19.0.0.0.0...

Patching component oracle.assistants.acf, 19.0.0.0.0...

Patching component oracle.assistants.deconfig, 19.0.0.0.0...

Patching component oracle.assistants.server, 19.0.0.0.0...

Patching component oracle.buildtools.rsf, 19.0.0.0.0...

Patching component oracle.ctx, 19.0.0.0.0...

Patching component oracle.ldap.rsf, 19.0.0.0.0...

Patching component oracle.network.rsf, 19.0.0.0.0...

Patching component oracle.rdbms.dbscripts, 19.0.0.0.0...

Patching component oracle.sdo, 19.0.0.0.0...

Patching component oracle.sqlplus, 19.0.0.0.0...

Patching component oracle.sdo.locator, 19.0.0.0.0...

Patching component oracle.odbc, 19.0.0.0.0...

Patching component oracle.rdbms.util, 19.0.0.0.0...

Patching component oracle.nlsrtl.rsf, 19.0.0.0.0...

Patching component oracle.rdbms.oci, 19.0.0.0.0...

Patching component oracle.ctx.rsf, 19.0.0.0.0...

Patching component oracle.ldap.rsf.ic, 19.0.0.0.0...

Patching component oracle.rdbms.deconfig, 19.0.0.0.0...

Patching component oracle.oraolap.dbscripts, 19.0.0.0.0...

Patching component oracle.rdbms.dv, 19.0.0.0.0...

Patching component oracle.rdbms.install.plugins, 19.0.0.0.0...

Patching component oracle.ovm, 19.0.0.0.0...

Patching component oracle.rdbms.rman, 19.0.0.0.0...

Patching component oracle.dbjava.jdbc, 19.0.0.0.0...

Patching component oracle.network.client, 19.0.0.0.0...

Patching component oracle.duma, 19.0.0.0.0...

Patching component oracle.sdo.locator.jrf, 19.0.0.0.0...

Patching component oracle.xdk.rsf, 19.0.0.0.0...

Patching component oracle.network.listener, 19.0.0.0.0...

Patching component oracle.sqlplus.ic, 19.0.0.0.0...

Patching component oracle.dbjava.ic, 19.0.0.0.0...

Patching component oracle.ons, 19.0.0.0.0...

Patching component oracle.dbjava.ucp, 19.0.0.0.0...

Patching component oracle.rdbms.rsf.ic, 19.0.0.0.0...

Patching component oracle.precomp.common, 19.0.0.0.0...

Patching component oracle.precomp.lang, 19.0.0.0.0...
Patch 30087906 successfully applied.
Sub-set patch [29517242] has become inactive due to the application of a super-set patch [30087906].
Please refer to Doc ID 2161861.1 for any possible further required actions.


Log file location: /u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/opatch/opatch2019-10-29_16-04-11PM_1.log


OPatch succeeded.

9、启动数据库
startup
10、执行补丁脚本

cd $ORACLE_HOME/OPatch
./datapatch -verbose

SQL> @?/rdbms/admin/utlrp.sql
SQL> set pagesize 200 linesize 200
SQL> col ACTION_TIME for a30
SQL> col action for a10
SQL> col NAMESPACE for a10
SQL> col version for a10
SQL> col COMMENTS for a100
SQL>  select ACTION_TIME,ACTION,NAMESPACE,VERSION,COMMENTS from dba_registry_history;

ACTION_TIME                    ACTION     NAMESPACE  VERSION    COMMENTS
------------------------------ ---------- ---------- ---------- ----------------------------------------------------------------------------------------------------
                               BOOTSTRAP  DATAPATCH  19         RDBMS_19.3.0.0.0DBRUR_LINUX.X64_190829
24-OCT-19 04.54.12.330517 PM   RU_APPLY   SERVER     19.0.0.0.0 Patch applied on 19.3.0.0.0: Release_Update - 190410122720
29-OCT-19 03.23.13.678966 PM   RU_APPLY   SERVER     19.0.0.0.0 Patch applied from 19.3.0.0.0 to 19.3.2.0.0: Release_Update_Revision - 190829192137
[oracle@ora19c OPatch]$ $ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME |grep -i patch|more

在这里插入图片描述

备注dg备库不用执行第10步

三、报错处理

RAC的第二个节点在安装补丁时会遇到如下报错

Start applying binary patch on home /u01/app/oracle/product/19.0.0/db_1
Binary patch applied successfully on home /u01/app/oracle/product/19.0.0/db_1


Performing postpatch operation on home /u01/app/oracle/product/19.0.0/db_1
Postpatch operation completed successfully on home /u01/app/oracle/product/19.0.0/db_1


Start applying binary patch on home /u01/app/19.0.0/grid
Failed while applying binary patches on home /u01/app/19.0.0/grid

Execution of [OPatchAutoBinaryAction] patch action failed, check log for more details. Failures:
Patch Target : ghoradb-rac2->/u01/app/19.0.0/grid Type[crs]
Details: [
---------------------------Patching Failed---------------------------------
Command execution failed during patching in home: /u01/app/19.0.0/grid, host: ghoradb-rac2.
Command failed:  /u01/app/19.0.0/grid/OPatch/opatchauto  apply /opt/patch/30135696/ -oh /u01/app/19.0.0/grid -target_type cluster -binary -invPtrLoc /u01/app/19.0.0/grid/oraInst.loc -jre /u01/app/19.0.0/grid/OPatch/jre -persistresult /u01/app/19.0.0/grid/OPatch/auto/dbsessioninfo/sessionresult_ghoradb-rac2_crs.ser -analyzedresult /u01/app/19.0.0/grid/OPatch/auto/dbsessioninfo/sessionresult_analyze_ghoradb-rac2_crs.ser
Command failure output: 
==Following patches FAILED in apply:

Patch: /opt/patch/30135696/30087906
Log: /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2019-10-29_14-48-26PM_1.log
Reason: Failed during Patching: oracle.opatch.opatchsdk.OPatchException: ApplySession failed in system modification phase... 'ApplySession::apply failed: java.io.IOException: oracle.sysman.oui.patch.PatchException: java.io.FileNotFoundException: /u01/app/oraInventory/ContentsXML/oui-patch.xml (Permission denied)' 

After fixing the cause of failure Run opatchauto resume

]
OPATCHAUTO-68061: The orchestration engine failed.
OPATCHAUTO-68061: The orchestration engine failed with return code 1
OPATCHAUTO-68061: Check the log for more details.
OPatchAuto failed.

OPatchauto session completed at Tue Oct 29 14:49:36 2019
Time taken to complete the session 7 minutes, 29 seconds

 opatchauto failed with error code 42
查看两个节点“/u01/app/oraInventory/ContentsXML/oui-patch.xml”文件权限

节点1

[root@ghoradb-rac1 ~]# ll /u01/app/oraInventory/ContentsXML/oui-patch.xml
-rw-rw---- 1 grid oinstall 174 Oct 29 14:32 /u01/app/oraInventory/ContentsXML/oui-patch.xml


节点2
[root@ghoradb-rac2 ~]# ll /u01/app/oraInventory/ContentsXML/oui-patch.xml
-rw-r--r-- 1 oracle oinstall 174 Oct 29 14:47 /u01/app/oraInventory/ContentsXML/oui-patch.xml

赋权限之后重新执行

[root@ghoradb-rac2 ~]# chmod 660 /u01/app/oraInventory/ContentsXML/oui-patch.xml

[root@ghoradb-rac2 ~]# ll /u01/app/oraInventory/ContentsXML/oui-patch.xml
       
-rw-rw---- 1 oracle oinstall 174 Oct 29 14:47 /u01/app/oraInventory/ContentsXML/oui-patch.xml
[root@ghoradb-rac2 ~]# opatchauto apply /opt/patch/30135696/                    

OPatchauto session is initiated at Tue Oct 29 14:53:59 2019

System initialization log file is /u01/app/19.0.0/grid/cfgtoollogs/opatchautodb/systemconfig2019-10-29_02-54-06PM.log.

Clusterware is either not running or not configured. You have the following 2 options:
 1. Configure and start the Clusterware on this node and re-run the tool
 2. Run the tool with '-oh <GI_HOME>' to first patch the Grid Home, then invoke tool with '-database <oracle database name>' or '-oh <RAC_HOME>' to patch the RAC home

OPATCHAUTO-72029: CLusterware home not configured.
OPATCHAUTO-72029: Clusterware is either not running or not configured or cluster is software only GI
OPATCHAUTO-72029: If only Grid Infrastructure software is installed, please run opatchauto with '-oh' option . Alternatively configure and start the Clusterware before running opatchauto.



OPatchauto session completed at Tue Oct 29 14:54:11 2019
Time taken to complete the session 0 minute, 12 seconds

Topology creation failed.
上面的报错是CRS在节点2无法启动

解决crs无法启动的问题

[root@ghoradb-rac2 ~]# clscfg -localpatch
clscfg: EXISTING configuration version 0 detected.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
[root@ghoradb-rac2 ~]# /u01/app/19.0.0/grid/crs/install/rootcrs.sh -lock
Using configuration parameter file: /u01/app/19.0.0/grid/crs/install/crsconfig_params
The log of current session can be found at:
  /u01/app/grid/crsdata/ghoradb-rac2/crsconfig/crslock_ghoradb-rac2_2019-10-29_02-56-52PM.log
2019/10/29 14:56:54 CLSRSC-329: Replacing Clusterware entries in file 'oracle-ohasd.service'
[root@ghoradb-rac2 ~]# crsctl start crs
CRS-4123: Oracle High Availability Services has been started.
[root@ghoradb-rac2 ~]# 

节点2集群恢复之后再继续打补丁

[root@ghoradb-rac2 ~]# opatchauto apply /opt/patch/30135696/  

OPatchauto session is initiated at Tue Oct 29 15:06:24 2019

System initialization log file is /u01/app/19.0.0/grid/cfgtoollogs/opatchautodb/systemconfig2019-10-29_03-06-26PM.log.

Session log file is /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/opatchauto2019-10-29_03-07-08PM.log
The id for this session is FVEP

Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/19.0.0/db_1

Executing OPatch prereq operations to verify patch applicability on home /u01/app/19.0.0/grid
Patch applicability verification failed on home /u01/app/19.0.0/grid

Patch applicability verified successfully on home /u01/app/oracle/product/19.0.0/db_1

Execution of [OPatchAutoBinaryAction] patch action failed, check log for more details. Failures:
Patch Target : ghoradb-rac2->/u01/app/19.0.0/grid Type[crs]
Details: [
---------------------------Patching Failed---------------------------------
Command execution failed during patching in home: /u01/app/19.0.0/grid, host: ghoradb-rac2.
Command failed:  /u01/app/19.0.0/grid/OPatch/opatchauto  apply /opt/patch/30135696/ -oh /u01/app/19.0.0/grid -target_type cluster -binary -invPtrLoc /u01/app/19.0.0/grid/oraInst.loc -jre /u01/app/19.0.0/grid/OPatch/jre -persistresult /u01/app/19.0.0/grid/OPatch/auto/dbsessioninfo/sessionresult_analyze_ghoradb-rac2_crs.ser -analyze -online -prepare_home
Command failure output: 
==Following patches FAILED in analysis for apply:

Patch: /opt/patch/30135696/29585399
Log: 
Reason: Failed during listing in Analysis: java.lang.Exception: oracle.opatch.opatchsdk.OPatchException: Unable to create patchObject
Possible causes are:
   ORACLE_HOME/inventory/oneoffs/30087906 is corrupted. java.lang.RuntimeException: No Patch exists,Please check. 


Patch: /opt/patch/30135696/29517247
Log: 
Reason: Failed during listing in Analysis: java.lang.Exception: oracle.opatch.opatchsdk.OPatchException: Unable to create patchObject
Possible causes are:
   ORACLE_HOME/inventory/oneoffs/30087906 is corrupted. java.lang.RuntimeException: No Patch exists,Please check. 


Patch: /opt/patch/30135696/29401763
Log: 
Reason: Failed during listing in Analysis: java.lang.Exception: oracle.opatch.opatchsdk.OPatchException: Unable to create patchObject
Possible causes are:
   ORACLE_HOME/inventory/oneoffs/30087906 is corrupted. java.lang.RuntimeException: No Patch exists,Please check. 


Patch: /opt/patch/30135696/30087906
Log: 
Reason: Failed during listing in Analysis: java.lang.Exception: oracle.opatch.opatchsdk.OPatchException: Unable to create patchObject
Possible causes are:
   ORACLE_HOME/inventory/oneoffs/30087906 is corrupted. java.lang.RuntimeException: No Patch exists,Please check. 

After fixing the cause of failure Run opatchauto resume

]
OPATCHAUTO-68061: The orchestration engine failed.
OPATCHAUTO-68061: The orchestration engine failed with return code 1
OPATCHAUTO-68061: Check the log for more details.
OPatchAuto failed.

OPatchauto session completed at Tue Oct 29 15:07:20 2019
Time taken to complete the session 0 minute, 56 seconds

 opatchauto failed with error code 42
 
 
 
 还是有报错并且
 [grid@ghoradb-rac2 ~]$ $ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME
Oracle Interim Patch Installer version 12.2.0.1.17
Copyright (c) 2019, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/19.0.0/grid
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/19.0.0/grid/oraInst.loc
OPatch version    : 12.2.0.1.17
OUI version       : 12.2.0.7.0
Log file location : /u01/app/19.0.0/grid/cfgtoollogs/opatch/opatch2019-10-29_15-10-20PM_1.log

Lsinventory Output file location : /u01/app/19.0.0/grid/cfgtoollogs/opatch/lsinv/lsinventory2019-10-29_15-10-20PM.txt

--------------------------------------------------------------------------------


Inventory load failed... OPatch cannot load inventory for the given Oracle Home.

LsInventorySession failed: Unable to create patchObject
Possible causes are:
   ORACLE_HOME/inventory/oneoffs/30087906 is corrupted. java.lang.RuntimeException: No Patch exists,Please check. 


OPatch failed with error code 73

解决方法:
将第一个节点的补丁oneoffs目录拷贝到第二个节点

[grid@ghoradb-rac1 ~]$ scp -r $ORACLE_HOME/inventory/oneoffs/30087906 grid@ghoradb-rac2:/u01/app/19.0.0/grid/inventory/oneoffs/
inventory.xml                                                                                                                       100%   68KB  20.3MB/s   00:00    
actions.xml                                                                                                                         100%  591KB  55.6MB/s   00:00

拷贝完之后再运行

[grid@ghoradb-rac2 ~]$ $ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME

无报错

继续打补丁

[root@ghoradb-rac2 ~]# opatchauto apply /opt/patch/30135696/
OPatchauto session is initiated at Tue Oct 29 15:14:38 2019

System initialization log file is /u01/app/19.0.0/grid/cfgtoollogs/opatchautodb/systemconfig2019-10-29_03-14-40PM.log.

Session log file is /u01/app/19.0.0/grid/cfgtoollogs/opatchauto/opatchauto2019-10-29_03-15-20PM.log
The id for this session is MI2E

Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/19.0.0/db_1

Executing OPatch prereq operations to verify patch applicability on home /u01/app/19.0.0/grid
Patch applicability verified successfully on home /u01/app/19.0.0/grid

Patch applicability verified successfully on home /u01/app/oracle/product/19.0.0/db_1


Verifying SQL patch applicability on home /u01/app/oracle/product/19.0.0/db_1
SQL patch applicability verified successfully on home /u01/app/oracle/product/19.0.0/db_1


Preparing to bring down database service on home /u01/app/oracle/product/19.0.0/db_1
Successfully prepared home /u01/app/oracle/product/19.0.0/db_1 to bring down database service


Preparing home /u01/app/oracle/product/19.0.0/db_1 after database service restarted
No step execution required.........
 
OPatchAuto successful.

--------------------------------Summary--------------------------------

Patching is completed successfully. Please find the summary as follows:

Host:ghoradb-rac2
CRS Home:/u01/app/19.0.0/grid
Version:19.0.0.0.0
Summary:

==Following patches were SKIPPED:

Patch: /opt/patch/30135696/29585399
Reason: This patch is already been applied, so not going to apply again.

Patch: /opt/patch/30135696/29517247
Reason: This patch is already been applied, so not going to apply again.

Patch: /opt/patch/30135696/29401763
Reason: This patch is already been applied, so not going to apply again.

Patch: /opt/patch/30135696/30087906
Reason: This patch is already been applied, so not going to apply again.


Host:ghoradb-rac2
RAC Home:/u01/app/oracle/product/19.0.0/db_1
Version:19.0.0.0.0
Summary:

==Following patches were SKIPPED:

Patch: /opt/patch/30135696/29517247
Reason: This patch is not applicable to this specified target type - "rac_database"

Patch: /opt/patch/30135696/29401763
Reason: This patch is not applicable to this specified target type - "rac_database"

Patch: /opt/patch/30135696/29585399
Reason: This patch is already been applied, so not going to apply again.

Patch: /opt/patch/30135696/30087906
Reason: This patch is already been applied, so not going to apply again.



OPatchauto session completed at Tue Oct 29 15:16:03 2019
Time taken to complete the session 1 minute, 25 seconds

节点2补丁安装完毕

  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值