Oracle 数据库更新补丁

           这里以Oracle 19c GI、DB for Oralce Linux 8.6 平台跟新官方最新补丁为例,其他版本、平台类似:

  1、登录oracle support(需购买oracle 服务),下载linux x86-64平台下19c GI 补丁:

1667985369928

2、解压缩下载的补丁文件,仔细阅读README文件,确认OPatch 工具版本满足要求,如果版本不满足要求,需下载满足要求的OPatch工具,替换现有GI、DB home OPatch 工具:

1668060638496

1668060908097

3、确认现有环境适合的打补丁方式,对于oracle rac 或者oracle restart 环境,通过opatchauto apply 更新gi、db home 补丁,对于database single-instance ,通过opatch apply 更新db home 补丁:

1668061242777

确认gi、db home 适用的补丁集:

1668062383224

对于更新了one-off patch 的生产环境,还应该执行补丁冲突检查,确认所更新的补丁是否与现有环境one-off patch冲突(gi、db home 都应该检查):

1668062673412

oracle rac 或者restart 环境:

gi home :

su  - root

# /u01/app/19.3.0/grid/OPatch/opatchauto apply /u01/app/soft/patch_34416665/34416665/ -oh /u01/app/19.3.0/grid/

OPatchauto session is initiated at Thu Nov 10 02:15:58 2022

System initialization log file is /u01/app/19.3.0/grid/cfgtoollogs/opatchautodb/systemconfig2022-11-10_02-16-00AM.log.

Session log file is /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/opatchauto2022-11-10_02-16-03AM.log
The id for this session is 35DT

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


Executing patch validation checks on home /u01/app/19.3.0/grid
Patch validation checks successfully completed on home /u01/app/19.3.0/grid


Performing prepatch operations on CRS - bringing down CRS service on home /u01/app/19.3.0/grid
Prepatch operation log file location: /u01/app/grid/crsdata/zjg-dba-bidbdr/crsconfig/hapatch_2022-11-10_02-16-51AM.log
CRS service brought down successfully on home /u01/app/19.3.0/grid


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


Performing postpatch operations on CRS - starting CRS service on home /u01/app/19.3.0/grid
Postpatch operation log file location: /u01/app/grid/crsdata/zjg-dba-bidbdr/crsconfig/hapatch_2022-11-10_02-21-26AM.log
CRS service started successfully on home /u01/app/19.3.0/grid

OPatchAuto successful.

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

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

Host:zjg-dba-bidbdr
SIHA Home:/u01/app/19.3.0/grid
Version:19.0.0.0.0
Summary:

==Following patches were SKIPPED:

Patch: /u01/app/soft/patch_34416665/34416665/33575402
Log: /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-11-10_02-16-15AM_1.log
Reason: /u01/app/soft/patch_34416665/34416665/33575402 is not required to be applied to oracle home /u01/app/19.3.0/grid


==Following patches were SUCCESSFULLY applied:

Patch: /u01/app/soft/patch_34416665/34416665/34419443
Log: /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-11-10_02-17-18AM_1.log

Patch: /u01/app/soft/patch_34416665/34416665/34428761
Log: /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-11-10_02-17-18AM_1.log

Patch: /u01/app/soft/patch_34416665/34416665/34444834
Log: /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-11-10_02-17-18AM_1.log

Patch: /u01/app/soft/patch_34416665/34416665/34580338
Log: /u01/app/19.3.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-11-10_02-17-18AM_1.log

 

OPatchauto session completed at Thu Nov 10 02:22:52 2022
Time taken to complete the session 6 minutes, 55 seconds

db home:

su  - root

# /u01/app/oracle/product/19.3.0/db_1/OPatch/opatchauto apply /u01/app/soft/patch_34416665/34416665/ -oh /u01/app/oracle/product/19.3.0/db_1/

OPatchauto session is initiated at Thu Nov 10 02:25:35 2022

System initialization log file is /u01/app/oracle/product/19.3.0/db_1/cfgtoollogs/opatchautodb/systemconfig2022-11-10_02-25-38AM.log.

Session log file is /u01/app/oracle/product/19.3.0/db_1/cfgtoollogs/opatchauto/opatchauto2022-11-10_02-25-41AM.log
The id for this session is B4DZ

Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/19.3.0/db_1
Patch applicability verified successfully on home /u01/app/oracle/product/19.3.0/db_1


Executing patch validation checks on home /u01/app/oracle/product/19.3.0/db_1
Patch validation checks successfully completed on home /u01/app/oracle/product/19.3.0/db_1


Verifying SQL patch applicability on home /u01/app/oracle/product/19.3.0/db_1
No sqlpatch prereq operations are required on the local node for this home
No step execution required.........
 

Preparing to bring down database service on home /u01/app/oracle/product/19.3.0/db_1
No step execution required.........
 

Bringing down database service on home /u01/app/oracle/product/19.3.0/db_1
Database service successfully brought down on home /u01/app/oracle/product/19.3.0/db_1


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


Starting database service on home /u01/app/oracle/product/19.3.0/db_1
Database service successfully started on home /u01/app/oracle/product/19.3.0/db_1


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

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

OPatchAuto successful.

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

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

Host:zjg-dba-bidbdr
SIDB Home:/u01/app/oracle/product/19.3.0/db_1
Summary:

==Following patches were SKIPPED:

Patch: /u01/app/soft/patch_34416665/34416665/34428761
Reason: This patch is not applicable to this specified target type - "oracle_database"

Patch: /u01/app/soft/patch_34416665/34416665/33575402
Reason: This patch is not applicable to this specified target type - "oracle_database"

Patch: /u01/app/soft/patch_34416665/34416665/34580338
Reason: This patch is not applicable to this specified target type - "oracle_database"


==Following patches were SUCCESSFULLY applied:

Patch: /u01/app/soft/patch_34416665/34416665/34419443
Log: /u01/app/oracle/product/19.3.0/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2022-11-10_02-26-27AM_1.log

Patch: /u01/app/soft/patch_34416665/34416665/34444834
Log: /u01/app/oracle/product/19.3.0/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2022-11-10_02-26-27AM_1.log

 

OPatchauto session completed at Thu Nov 10 02:29:59 2022
Time taken to complete the session 4 minutes, 24 seconds

database single-instance 环境:

su – oracle

$ORACLE_HOME/OPatch/opatch  apply  /u01/app/soft/patch_34416665/34416665/34419443

 

4、另外,gi、db home 也可以在配置、注册之前更新补丁(更新补丁之前,先升级opatch,确保满足补丁所要求的版本):

自oracle 18c 开始,gi  home 在setup 之前可以通过gridSetup.sh 更新Rlease Update 或者one-off patch:

su – grid

cd  $ORACLE_HOME

./gridSetup.sh –applyRU  patch_directory_location

./gridSetup.sh –applyOneOffs  patch_directory_location

自oracle 18c 开始,db  home 在setup 之前可以通过runInstaller 更新Rlease Update 或者one-off patch:

su – oracle

cd $ORACLE_home

./runInstaller  –applyRU  patch_directory_location

./runInstaller  –applyOneOffs  patch_directory_location

 

5、生产环境的oracle 数据库补丁更新,dba应该仔细阅读补丁集readme文件,首先在测试环境完成更新操作,协同开发、业务一同测试,确认无误,方可考虑。

   a、 对于部署了 oracle dataguard 的环境,可以先在dataguard 备库更新补丁,测试无误再更新dataguard 主库;

   b、对于部署了oracle rac 的环境,可以采用滚动更新补丁方式,一个节点一个节点进行,以确保数据库服务停机时间最短,减小业务停机时间。

posted @ 2022-11-10 15:51  踏雪无痕2017  阅读(1177)  评论(0)    收藏  举报